[erlang-questions] node.js compared to erlang
Dale Harvey
dale@REDACTED
Fri Oct 8 01:18:32 CEST 2010
You arent alone, I also pretty much entirely work with javascript and
erlang.
I enjoy programming with node in a way that I dont with erlang, stuff feels
fun, I have lots of libraries that people have written for me, it already
has a package manager which to be honest embarrasses the erlang side of me
slightly.
However using node I have had problems making very simple things be
resilient to errors, async error handling is very very hard (as most erlang
people know) and there seems to be little effort with nodes community to
resolving that. So for now node is still a little fun toy to play with, but
when I want to write something that I know stays up, I use erlang.
However I am a little troubled by nodes popularity and the general dismissal
of "well erlang does it better", people are flocking to node in a way that
they are not with erlang, People are more and more needing to write the type
of async servers that node and erlang provide, programming with an embedded
server is also a huge benefit, people obviously want this but why are they
embracing node in a way they arent with erlang?
It took me 5 minutes from getting to the node website, to compiling it and
having my first hello world server up and running, a few minutes later I had
a package manager installed and some user contributed libraries that helped
me write what I wanted.
Installing erlang is mostly fine, however once I am there, there is no
standard build tools which will let me write my first module, compile it
(and by standard build tools I mean one command, not write my own emakefile,
or type c(module) at the shell) and run it, there are a bunch of web servers
to chose from which none are universally recommended and none are properly
documented, I have absolutely no idea how to install any of these servers
properly, to this day everyone had massively differing opinions on how
libraries should be bundled.
I think the erlang community really needs to sort out these problems once
and for all, and before diving into emacs, these are political problems not
technical ones.
I have had this on my mind for a while and still dont know the best
solutions, however, I am promising now that by the euc erlangotp.com will
finish its redesign with one major goal, to get a programmer completely
unfamiliar with erlang to get a "hello world" web server up and running in 5
minutes.
I think its time to settle on and promote tools like rebar / mochiweb /
learnyourselfsomeerlang / unknown package manager / and not wait for things
to be officially blessed by the otp team, they are busy making erlang
awesome, we as a community need to pick up the slack on that end.
So yeh, bit of a rant, but if anyone else is interested in lowering the
barriers to entry for erlang then shoot me an email / make a new thread, I
certainly want as much of the community as possible involved.
Cheers
Dale
On 7 October 2010 15:13, David Mercer <dmercer@REDACTED> wrote:
> I might be the only person in the world whose two favorite languages are
> Javascript and Erlang. I had been writing full-blown server-side
> Javascript
> applications for 5 or 6 years until I discovered Erlang in '07. What had
> attracted me to Javascript was the ability to replace code on the fly (for
> instance, by loading the file into a string and eval-ing it). For
> distribution (the application was distributed over about 20 machines
> internally with about 100 additional smaller-scale remote servers
> communicating with the central hub), I used the file system and TCP (and
> HTTP for negotiating across firewalls), depending on the requirements. (I
> had also originally used MSMQ, but we phased that out over time in favor of
> more expedient methods that we developed ourselves.) The end result was a
> less robust version of an Erlang application, that worked pretty well. We
> had hot code loading, and redundancy gave us the fault-tolerance we
> required.
>
>
> When I discovered Erlang in 2007 (not sure why it took me that long), I
> immediately recognized that Erlang was built to handle all the problems we
> had written around, but it had a longer history and was certainly better at
> it. We had required so much of our redundancy (20 machines running about 7
> processes each) not only to handle the load, but also to handle failures.
> Windows Script Host, which was our Javascript engine, is not as stable as
> you might think, and seemed to suffer from memory leaks which manifested
> itself over time. With 20 machines times 7 processes per machine and an
> MTBF of, say, a week, we had 10 or 20 failures a day (which were
> automatically handled). Honestly, the surprise for us was that WSH
> performed as well as it did. We had originally written our application in
> Javascript/WSH as a prototype, intending to rewrite in C/C++/Java/something
> else when we had completed our proof of concept. But as it turned out,
> processing speed wasn't really an issue for us -- network latency was
> usually the limiting issue, not CPU. However, it was surprising to us that
> WSH could, at times, run for days or weeks, processing millions of
> transactions before failing. WSH's multi-threading capabilities are
> nonexistent, and I tried various hacks to coax it into running multiple
> threads, but they tended to cause other problems (as you can imagine), so I
> wrote my own scheduler that time-sliced between various tasks. (It was
> actually a heap-based priority queue.) We isolated blocking operations
> (the
> main issue we had with blocking was that some asynchronous SQL queries were
> not working right, so we had to do them synchronously) in their own process
> so that they wouldn't block other tasks.
>
> However, Erlang does everything we wrote, and it does it better. Having
> written an equivalent system in a non-Erlang language, I really appreciate
> all the tools Erlang gives you to create manageable distributed server-side
> applications. Besides the interprocess messaging and hot code-loading, OTP
> is an excellent way of thinking about and framework for building your
> fault-tolerant servers. I did not know about Erlang and OTP when I started
> writing server-side Javascript, but if I had, I would have begun by
> rewriting Erlang and OTP (e.g., gen_server) in Javascript. It would have
> created a much better architecture, though it is not clear why I would
> write
> such a system in Javascript if I knew about Erlang. Node.js is only a
> small
> step up from WSH in that it is more portable and has better support for
> multi-tasking. I suspect you would find yourself rewriting a lot of
> Erlang/OTP in Javascript if you decided to build in Node.js your own
> server-side applications.
>
> That being said, as an old Javascript warrior myself, I'd be interested to
> hear how it goes. I, too, have considered trying out Node.js as my New
> Favorite Platform(TM), but haven't yet had the need. Today, I haven't done
> much programming in Javascript in a couple of years, but I gotta admit, as
> a
> language, it is very highly capable. I daresay, there was a time, 5-10
> years ago, when I considered myself one of the best Javascript programmers
> in the world, and I would sometimes log into Experts Exchange or somewhere
> like that to help out, only to be dismayed that the Javascript questions
> were not about the language Javascript, but about manipulating the DOM in a
> web page. No-one ever seemed to ask the tricky questions about closures or
> object context, or performance of certain approaches etc. that was my
> expertise. You see more of that nowadays, as most of these concepts have
> gained traction in the mainstream; now there are probably tens of thousands
> of people with that knowledge, not just the hundreds of a few years ago.
>
> Thank-you for this walk down memory lane. Let me know how it goes with
> Node.js. I just might have to try it out...
>
> Cheers,
>
> DBM
>
> > -----Original Message-----
> > From: erlang-questions@REDACTED [mailto:erlang-questions@REDACTED]
> On
> > Behalf Of Pablo Platt
> > Sent: Sunday, October 03, 2010 10:01 AM
> > To: erlang-questions@REDACTED
> > Subject: [erlang-questions] node.js compared to erlang
> >
> > Hi
> >
> > I'm using erlang and I love it.
> > I'm not trying to create an argument but to better understand the power
> of
> > erlang.
> >
> > In what areas erlang dominates and what areas will you consider using
> > node.js?
> > For example, would you consider building something like rabbitmq or
> > ejabberd in
> > node.js?
> > Or maybe you'll use node.js just for a simple single chat room but erlang
> > for
> > anything complicated than that.
> >
> > Are there a fundamental differences in performance or stability or use in
> > distributed systems?
> >
> > Ulf Wiger commented on the comparison of erlang and node.js
> > and said that erlang solves the problem of non blocking functions which
> > might be
> > very hard for other languages.
> > http://journal.dedasys.com/2010/04/29/erlang-vs-node-js
> >
> > Thanks
> >
> >
> >
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>
More information about the erlang-questions
mailing list