I recently jumped into the Erlang world, mostly seduced by the message-passing concurrency model (as opposed to the shared-state concurrency model) [1]. This was a choice a priori without real objective (I mean without project, just as learning experience).

Now we have (project in my company) to implement an “efficient” and scalable server: fast, robust and highly-available (as any servers, of course). Coming from a really bad Python threaded-server experience, I’d rather read some hints before to go to any platform or framework (Stackless Python, Twisted, Erlang/OTP, Java, C/C++ …). Here are some available documents related to high performance network servers:

Wow! that’s tough to decide anything! Where I’m a bit surprised is that concurrency model choice is often viewed as Thread vs. Event, and each side argue about throughput , switching context cost, and latency. As I understand, message-passing and event is not the same: most of the event model I’ve seen do not enable pre-emption without relying on threads to manage some event loops. And I naively assume that pre-emption is a good choice to implement robust and available server.

To conclude, if I have to choose something today, I would still choose Erlang! Because it implements efficient lightweight process: easy as threads, message passing model, and pre-emption able [2]. Furthermore Erlang proposes through OTP a whole framework for robust application, and I see a (good) framework as an invaluable experienced-user knowledge (thank you OTP folks!).

Notes:
[1] Indeed Erlang feature an efficient implementation of so-called processes (also known as lightweight-thread, micro-thread, greenlet or tasklet … but the term process emphasize on the absence of shared-state common to many thread implementation). Erlang made also the choice of functional programming style as a programming guide to context independent code (unique affectation of variable, reduced side-effects).

[2] Having a lot of Python code, I had to compared Erlang vs. Stackless Python. In fact they share a lot of characteristics but Stackless has not the whole OTP framework and more importantly Stackless message sending block if there is no receptor of the message (more in this discussion about Stackless vs. Erlang).

Advertisements