在技术层面上,和ErlangOTP 相比,Node.js有什么优势

JavaScript021

在技术层面上,和ErlangOTP 相比,Node.js有什么优势,第1张

之前做过这方面的功课,Erlang是可以KO掉 node.js的,当时整理的资料摘录于下:

互联网从来不缺观点,缺少的是数据和事实,下面按照干货的多少推荐几篇文章:

A comparison between Misultin, Mochiweb, Cowboy, NodeJS and Tornadoweb

ostinelli|net

发表时间May 2011

恰如其名,这篇文章比较了 Misultin, Mochiweb, Cowboy, NodeJS and Tornadoweb,看比较图吧,评论也精彩:

socket.io-erlang-vs-nodejs

Papipo/socket.io-erlang-vs-nodejs 路 GitHub

基于socket.io项目做的erlang与node.js的比较

In the webpage that will be displayed when you go to http://localhost:3000, you can set a number of messages to be sent to the server via socket.io.

In my computer nodejs processes 10k messages in 1250ms, and erlang version does the same in 1050ms.

With 100k messages, erlang handles them in 70secs, and node drops the connection thus failing the test.

We know that benchmarks aren't really that useful, since they differ from real production code. But this one served me to decide to go with erlang instead of node for a game I will be developing. Not being able to handle 100k messages is a no-no, given that erlang is able to handle them without problem.

Node.js vs Erlang: SyncPad’s Experience

墙内地址: Node.js vs Erlang: SyncPad’s Experience

原文在墙外:http://blog.mysyncpad.com/post/2073441622/node-js-vs-erlang-syncpads-experience

2010年2月2日的文章,SyncPad’s 的开发者比较Node.js和Erlang的方案.应该说作者在Node.js上是遇到不少问题的CPU飙高,内存泄漏,在node.js还是下了很多功夫的甚至尝试了multi-node:

Node.js v. Erlang

January 25, 2012的文章

墙内地址:Node.js v. Erlang

原文在墙外: Karel Sedláček

从实现机制上做了一个比较,对两种技术的关键点做了高度的概括,节录文章开头和结尾:

Node and Erlang both set out to solve an issue that developers of a particular class of systems routinely face: dealing with massive concurrency.

In the end, Node and Erlang find their way to almost the same place. They are both dynamic languages, with similar native datastructures, and one can see that Node’s ubiquitous EventEmitter is, in many ways, isomorphic to Erlang’s message passing scheme. Libraries like hook.ioprovide some semblance of the agnosticism with which one treats the location of an adressee in Erlang. Hotplugging of code is possible with no particular hassle, but—arguably as it should be—the responsibility of the programmer to do in such a way as to not break the application. They both are ideall suited to workloads that are primarily bottlenecked on IO, and both excel at shifting data from one place to another.

Node.js vs Erlang is the wrong battle.

墙内地址:Node.js vs Erlang is the wrong battle.

原文在墙外:http://jlouisramblings.blogspot.com/2011/05/nodejs-vs-erlang-is-wrong-battle.html

墙内地址:Differences between Node.js and Erlang

原文在墙外:http://jlouisramblings.blogspot.com/2010/12/differences-between-nodejs-and-erlang_14.html

评论更精彩:Node.js vs Erlang is the wrong battle : programming

作者第二篇文章要实际一些,conclusion写得很搞:

My main goal was to set out and exemplify a major difference in how a system like Node.js handles requests compared to Erlang. I think I have succeeded. It underpins the idea that you need to solve problems depending on platform. In Node.js, you will need to break up long-running jobs manually to give others a chance at the CPU (this is essentially cooperative multitasking). In Erlang, this is not a problem — and a single bad process can’t hose the system as a whole. On the other hand, I am sure there are problems for which Node.js shines and it will have to be worked around in Erlang.

Erlang vs node.js

Posted by David N. Welton on Thursday, April 29, 2010

Erlang vs node.js

"Good enough" concurrency, combined with a language that is at least an order of magnitude more popular than Erlang, and a fast runtime, combined with ease of use in general (it's way easier to get started with node.js than with most Erlang web stuff) make for a system that's likely to do fairly well in terms of diffusion and popularity, and is going to "eat some of Erlang's lunch". Or perhaps, rather than actually taking users away from Erlang, it's likely to attract people that might have otherwise gone to Erlang.

Felix's Node.js Convincing the boss guide

Felix's Node.js Convincing the boss guide

Felix Geisendörfer, an early node.js core contributor and co-founder of transloadit.com.

But please be careful here, since JavaScript is a dynamic / garbage collected language, your response times may sometimes vary depending on how often and long the garbage collection kicks in (at which point your program is stopped). So don't try to build hard realtime systems in node, that require consistent response times. Erlang is probably a better choice for these kinds of applications.

问答站

这种问题肯定会在技术问答站落户,从争论中找到学习的路径,分析的方法,收获不止这一个问题那么简单了:

StackOverflow上的这篇:

Node.js or Erlang

Node.js or Erlangnode-js-or-erlang

Node.Js in Erlang style?

Node.Js in Erlang style?

StackExchange站点围观地址:

Learning Erlang vs learning node.js

Learning Erlang vs learning node.js

这里的讨论包含了很多学习的指导,其中提到了这篇妙趣横生的 An Open Letter to the Erlang Beginner (or Onlooker) ferd.ca ->An Open Letter to the Erlang Beginner (or Onlooker)

Google Group围观地址:node.js compared to erlang

http://groups.google.com/group/erlang-programming/browse_thread/thread/142aed19df0decd9/a6fbf0414b50c8ee

在这个讨论中,惊现神人:Erlang之父Joe Armstrong 以及Nabble – Erlang 的作者Max Lapshin等等

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<meta http-equiv=Content-Type content="text/htmlcharset=gb2312">

<script type="text/javascript">

function cal() {

var typeVal = document.getElementById("type").value

var cntVal = document.getElementById("cnt").value

var totalObj = document.getElementById("total")

totalObj.value = typeVal * cntVal

}

</script>

</head>

<body>

种类:

<select id="type" onChange="cal()">

<option value="50000">5万</option>

<option value="100000">10万</option>

<option value="150000">15万</option>

<option value="200000">20万</option>

<option value="250000">25万</option>

<option value="300000">30万</option>

</select>

<br />

数量:

<select id="cnt" onChange="cal()">

<option value="1">1</option>

<option value="2">2</option>

<option value="3">3</option>

<option value="4">4</option>

<option value="5">5</option>

</select>

<br />

金币数:

<input id="total" type="text" width="100px">

</body>

</html>