[erlang-questions] Erlang is the best choice for building commercial application servers
Thu Mar 15 02:31:13 CET 2012
Richard O'Keefe wrote:
> There is often surprisingly little connection between the speed of a
> _language_ (implementation) and the speed of _systems_ built using it.
Which is almost the point - there's a rather direct correlation between
the speed of a system, and how well the system architecture aligns with
the constructs and run-time environment of the language it's implemented in.
If you're building a system that is highly concurrent in nature,
implementing it in Erlang is a big win, while implementing it in Java is
a big loss. Yes, you can take something that's inherently concurrent,
and design an efficient Java design, but you end up with something
that's a conceptual mess.
The example that comes to mind is simulation. In a previous life, I
worked for a company that made military simulation software (massively
multiplayer games for folks who shoot real bullets).
Having a networking background, where the natural inclination is to
spawn a process for every incoming task, I assumed that our simulators
operated in a similar way - simulate 1000s tanks, spawn 1000 processes
and do everything asynchronously. But no... as our coders informed me
(I'm a systems guy), you can't do that in Java (or C++, which was the
bulk of our code) - the context switching would bring everything to its
Instead, each tank was implemented as an object - with 4 main threads
winding their way through every object, 40 times per second. The code
was fast, but not surprisingly, it was amazingly brittle - change one
object (say add a new weapon to a particular tank) and all kinds of
things would have to be rewritten.
My instinct that yes, indeed, one could implement each entity as an
actor is what led me to discover Erlang - as pretty much the ONLY
run-time environment optimized for massive concurrency.
On the other hand, inherently serial applications probably run faster in
languages and run-time environments optimized for small numbers of threads.
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
More information about the erlang-questions