|Here is a typical conversation we get pulled into: Why again did you chose Erlang for a Web2.0 app ? Surely, you must have heard of Rails ? Erlang is such an obscure language. What about database support, documentation, a vibrant community, a developing environment, debugger, migration tools, etc… these do make a big difference in the long run (and surely outweighs the fact that YAWS, the Erlang app server, might or might not be faster than Apache)||[removed] digg_url=‘http://slideaware.typepad.com/slideaware/2007/05/there_is_a_worl.html’; [removed] [removed][removed]||[removed]reddit_url=‘http://slideaware.typepad.com/slideaware/2007/05/there_is_a_worl.html’[removed] [removed]reddit_title=‘There is a world outside of Ruby on Rails’[removed] [removed][removed]|
Well, these are all valid points, and this is precisely because Erlang is strong in all of these aspects that we ended up selecting it as our language of choice. Let’s digg a little further if you will.
Erlang is an obscure language
However you look at it, functional languages (Lisp, Haskell, Ocaml, Erlang) are less popular than your typical Ruby/Python/Java/C#. But who said the most popular language was the best ? (wouldn’t we all be programming in VB if this was the case :-) Maybe it is possible that there exists some hidden gems out there and it might be worth the time investigating these obscure languages. Notice that Paul Graham faced the exact same questions when he decided to go with Lisp for his startup in 98 !
If you pay close attention to the current trend in language development, you will notice that more and more functional programing features are making their way into procedural languages:
- the clever use of blocks in Ruby (usually called closures in most other languages).
There is a reason for this: they do make programing easier (and not to forget the Python crowd, Erlang supports list comprehension. Sweet…) I cannot wait to see these languages adopt pattern matching (no, not your typical string regexp pattern matching, but the type which allows you to write a IPv4 header parses in just a few lines) . This is so elegant once you understand how it works…
One thing to be note though is that Erlang is not object oriented. This might seem like a small detail, but after having been taught for years that objects are the answer to every programing problem (including curing cancer and ending world hunger), it does require a little bit of an initial shift in your thought process…
Who needs Oracle/Mysql when you have Mnesia, a free, distributed, in memory database ? The ability to store native Erlang structures out of the box is so liberating: suddenly the need for your object-database mapping layer almost vanishes (well, not 100% to be fairly honest, but a big chunk of it: no need to create a 1-to-n relationship or a n-to-n relationship and a mapping table in many simple cases)
Not to mention that Mnesia supports table replication and is fully distributed, with the ability to add new ‘nodes’ on the fly. All of this out of the box ! (did I mention it was free too ?) This makes scaling up almost a joke. Compare this to the usual nightmares (and cost) of trying to implement a distributed Mysql/Oracle…
This is where Erlang really shines. Remember that Erlang was initially created by Ericsson to ease the development of a highly scalable, fault tolerant telephony system. Not only did they create the language Erlang, they also came up with OTP (Open Telephony Platform). The name might be misleading: OTP is whole set of tools/libraries meant to make development in Erlang easier (and all of this is now open source)
The database Mnesia, for instance is part of OTP (and it comes with a graphical table explorer). Other tools, like a process explorer, and a graphical debugger are there as well. The ability to reload code on the fly is almost native to Erlang. And with a few lines of code you can do this across processes/machines (this starts becoming critical once your deployment infrastructure grows).
Also, OTP comes with what is known in Erlang world as gen_servers, which basically allows you to easily create synchronous and/or asynchronous services which can be called from any Erlang node. Another one of these hidden gems which makes your life way easier…
The Erlang community is definitely smaller than the Ruby/Python communities, no doubt about this. But maybe this is not such a bad thing: small communities tend be more proactive in helping newcomers. People are more available (it’s not unusual to see Joe Armstrong, the father of Erlang, reply to your posts on the mailing lists…). It’s the same warm, small community feeling you experience when you get a Mac. Hard to describe though…
The best tool for the job
Let’s forget about languages for a second. Let’s look at what you really need to develop a scalable Web2.0 app. With Ajax being all over the place, you start seeing the need to serve a lot of small requests (don’t render the whole page again, but only areas affected by your click. Single page apps are the new black !) This is where having a language explicitly designed to handle massive concurrent processes brings you a competitive advantage.
Look at our latest code push for instance. We just introduced the ability to have live review sessions for PowerPoint slides. You basically see other people currently reviewing the same presentation, you can leave real time notes and also have to ability to send quick IM messages. Think about what really happens in the background for a second. Because all of this is real time, every user is constantly going to the server asking “is there any new note/IM message to display” ? Now, we decided to go with a simple polling approach (== no Comet). This means we have to handle a lot of tiny requests/responses. This would be almost suicidal in any other language (or you would need to start adding plenty of servers to support any decent number of users). But not quite so in Erlang since the language was designed for this type of workload… It just scales beautifully (and yes, we still need to add extra servers as well to handle a large load, but just not as many…)
Here is a picture of what our app looks like (to fully appreciate the live functionality, you will have to sign up)
I could just go on and on about why I think Erlang is going to be a source of competitive advantage in the Web2.0 world. I am convinced we will start seeing more and more startups out there leveraging the power of massive concurrency. At the end of the day, the question you should be asking is not why WE are using Erlang, but why you are NOT using it ?
ps: just so that there is no confusion, this is not a RoR bashing article. I am myself a huge rails fan (and DHH is my hero, of course). But let’s keep in mind that rails is not the answer to everything…
<!—AddThis Bookmark Button BEGIN—>
[removed]var addthis_pub = ‘email@example.com’;[removed][removed][removed]
<!—AddThis Bookmark Button END—>
<!—technorati tags start—>
<!—technorati tags end—>
Categories: Companies SlideAware
Erlang on Twitter
» athoune (Mathieu Lecarme): More realistic bench with #basho_bench of #carbon : https://t.co/LRL5eX0r8v #erlang #python #graphite
More realistic bench with #basho_bench of #carbon : https://t.co/LRL5eX0r8v #erlang #python #graphite
» gluegadget (Amir Mohammad Saied): @erlangfactory re Dublin EFL: is Steve’s 14:45-17:45 “Tutorial: Erlang Web Frameworks” track free as well?
@erlangfactory re Dublin EFL: is Steve’s 14:45-17:45 “Tutorial: Erlang Web Frameworks” track free as well?
» raandari (Rara Tri Wulandari): Telimikiciiii oyeh2 nyaaa :* @andriyan_erlang
Telimikiciiii oyeh2 nyaaa :* @andriyan_erlang
» MogulAzam (MogulAzam): RT @newsycombinator: How and Why We Switched from Erlang to Python http://t.co/SbwC2PvZvh
RT @newsycombinator: How and Why We Switched from Erlang to Python http://t.co/SbwC2PvZvh
» al_maisan (Muharem Hrnjadovic): just booked my ticket for the #erlang user conference in Stockholm next month :)
just booked my ticket for the #erlang user conference in Stockholm next month :)
» izhal_aja (Izhal Putra Pribadhi): Ente memang bakhil @bdalbig cc: @erlang_kayla
Ente memang bakhil @bdalbig cc: @erlang_kayla
» fimbul11 (蔵人紗音のじ): オンラインゲームのサーバサイドはもちろんErlangですよね？？？
» Kentzo (Ilya Kulakov): Имеет смысл заюзать protobuf чтобы связать #erlang с другой программой через ports?
Имеет смысл заюзать protobuf чтобы связать #erlang с другой программой через ports?
» emanuelpeg (Emanuel): Emanuel Goette, alias Crespo: Concurrencia en #Erlang http://t.co/vzxkaZciOX
Emanuel Goette, alias Crespo: Concurrencia en #Erlang http://t.co/vzxkaZciOX
Number of aggregated posts: 10649
Most recent article: May 19, 2013
» Moraru on This is Why You Spent All that Time Learning to Program: It is true that computer science was a pain in the back at time that i’ve had to learn it…
» Commercial hand dryers on Couchbase Meetup at new HQ: Buy online from here where you will get so much of variety in Commercial hand dryers for people. If you…
» Fort McMurray Homes on Motivated Reasoning and Erlang vs Python vs Node: I don’t really understand why this post is motivational? I don’t even see a post, just a title. Fort McMurray…