I really like these tools when it comes to the concurrency level it can handle.
Erlang/OTP looks like much more stable solution but requires much more learning and a lot of diving into functional language paradigm. And it looks like Erlang/OTP makes it much better when it comes to multi-core CPUs (correct me if I am wrong).
But which should I choose? Which one is better in the short and long term perspective?
My goal is to learn a tool which makes scaling my Web projects under high load easier than traditional languages.
9条答案
按热度按时间ujv3wf0j1#
我会给予Erlang一个尝试。虽然这将是一个陡峭的学习曲线,你会从中得到更多,因为你将学习一个函数式编程语言。而且,由于Erlang是专门设计来创建可靠的,高度并发的系统,你会学到很多关于创建高度可伸缩的服务在同一时间。
zzlelutf2#
I can't speak for Erlang, but a few things that haven't been mentioned about node:
Check out the video on yahoo's blog by Ryan Dahl, the guy who actually wrote node. I think that will help give you a better idea where node is at, and where it's going.
Keep in mind that node still is in late development stages, and so has been undergoing quite a few changes—changes that have broke earlier code. However, supposedly it's at a point where you can expect the API not to change too much more. So if you're looking for something fun, I'd say node is a great choice.
g9icjywg3#
我是一个长期的Erlang程序员,这个问题促使我看一看node.js。
看起来你确实需要产生多个进程来利用多个内核。我看不到任何关于设置处理器亲和性的东西。你可以在linux上使用taskset,但它可能应该在程序中参数化和设置。
我还注意到平台支持可能会弱一点。具体来说,看起来你需要在Cygwin下运行才能获得Windows支持。
看起来不错。
编辑
Node.js现在具有对Windows的本机支持。
n9vozmp44#
I'm looking at the same two alternatives you are, gotts, for multiple projects.
So far, the best razor I've come up with to decide between them for a given project is whether I need to use Javascript. One existing system I'm looking to migrate is already written in Javascript, so its next version is likely to be done in node.js. Other projects will be done in some Erlang web framework because there is no existing code base to migrate.
Another consideration is that Erlang scales well beyond just multiple cores, it can scale to a whole datacenter. I don't see a built-in mechanism in node.js that lets me send another JS process a message without caring which machine it is on, but that's built right into Erlang at the lowest levels. If your problem isn't big enough to need multiple machines or if it doesn't require multiple cooperating processes, this advantage isn't likely to matter, so you should ignore it.
Erlang is indeed a deep pool to dive into. I would suggest writing a standalone functional program first before you start building web apps. An even easier first step, since you seem comfortable with Javascript, is to try programming JS in a more functional style. If you use jQuery or Prototype, you've already started down this path. Try bouncing between pure functional programming in Erlang or one of its kin (Haskell, F#, Scala...) and functional JS.
Once you're comfortable with functional programming, seek out one of the many Erlang web frameworks; you probably shouldn't be writing your app directly to something low-level like
inets
at this late stage. Look at something like Nitrogen , for instance.eqqqjvef5#
While I'd personally go for Erlang, I'll admit that I'm a little biased against JavaScript. My advice is that you evaluate few points:
Erlang has really fine-tuned concurrency & network-transparent parallel distributed system. Depending on what exactly is the project, the availability of a mature implementation of such system might outweigh any issues regarding learning a new language. There are also two other languages that work on Erlang VM which you can use, the Ruby/Python-like Reia and Lisp-Flavored Erlang .
Yet another option is to use both, especially with Erlang being used as kind of "hub". I'm unsure if Node.js has Foreign Function Interface system, but if it has, Erlang has C library for external processes to interface with the system just like any other Erlang process.
qxsslcnc6#
看起来Erlang在相对低端的服务器(512MB 4核2.4GHz AMD VM)中的部署性能更好。这是通过SyncPad's experience比较Erlang与Node.js的虚拟白板服务器应用程序实现。
3wabscal7#
在同一个虚拟机上,还有一种语言是erlang-〉Elixir
这是一个非常有趣的替代Erlang,看看这个。
此外,它还有一个基于它的快速增长的Web框架-〉Phoenix Framework
50pmv0ei8#
如果没有erlang https://www.youtube.com/watch?v=c12cYAUTXXs,whatsapp永远无法达到可伸缩性和可靠性的水平
lf5gs5x29#
我更喜欢Erlang而不是Node。如果你想要并发,Node可以被Erlang或Golang代替,因为它们的进程很轻。
Erlang不容易学习,所以需要很多努力,但它的社区是活跃的,所以可以得到帮助,这只是为什么人们喜欢节点的原因。