Node.js or Erlang

后端 未结 9 1403
你的背包
你的背包 2021-01-29 19:15

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

相关标签:
9条回答
  • 2021-01-29 19:55

    whatsapp could never achieve the level of scalability and reliability without erlang https://www.youtube.com/watch?v=c12cYAUTXXs

    0 讨论(0)
  • 2021-01-29 19:58

    I can't speak for Erlang, but a few things that haven't been mentioned about node:

    • Node uses Google's V8 engine to actually compile javascript into machine code. So node is actually pretty fast. So that's on top of the speed benefits offered by event-driven programming and non-blocking io.
    • Node has a pretty active community. Hop onto their IRC group on freenode and you'll see what I mean
    • I've noticed the above comments push Erlang on the basis that it will be useful to learn a functional programming language. While I agree it's important to expand your skillset and get one of those under your belt, you shouldn't base a project on the fact that you want to learn a new programming style
    • On the other hand, Javascript is already in a paradigm you feel comfortable writing in! Plus it's javascript, so when you write client side code it will look and feel consistent.
    • node's community has already pumped out tons of modules! There are modules for redis, mongodb, couch, and what have you. Another good module to look into is Express (think Sinatra for 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.

    0 讨论(0)
  • 2021-01-29 20:01

    I'm a long-time Erlang programmer, and this question prompted me to take a look at node.js. It looks pretty damn good.

    It does appear that you need to spawn multiple processes to take advantage of multiple cores. I can't see anything about setting processor affinity though. You could use taskset on linux, but it probably should be parametrized and set in the program.

    I also noticed that the platform support might be a little weaker. Specifically, it looks like you would need to run under Cygwin for Windows support.

    Looks good though.


    Edit

    Node.js now has native support for Windows.

    0 讨论(0)
  • 2021-01-29 20:02

    There is one more language on the same VM that erlang is -> Elixir

    It's a very interesting alternative to Erlang, check this one out.

    Also it has a fast-growing web framework based on it-> Phoenix Framework

    0 讨论(0)
  • 2021-01-29 20:06

    I will Prefer Erlang over Node. If you want concurrency, Node can be substituted by Erlang or Golang because of their light weight processes.

    Erlang is not easy to learn so requires a lot of effort but its community is active so can get help from that, this is only the reason why people prefer Node .

    0 讨论(0)
  • 2021-01-29 20:09

    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.

    0 讨论(0)
提交回复
热议问题