Erlang vs Python – Is Erlang Worth It Compared to Python with GIL?

erlangmultithreadingperformancepython

So, I've finally gotten myself to a point where I'm comfortable enough with Python (using Pyramid as my framework of choice) to undertake a rather large personal project. As it's a personal project, I have the luxury of taking my time having absolutely no deadlines other than self-imposed ones.

I love learning new frameworks, languages, etc. so if given a reason, I don't mind pushing back on development for a month or so while learning a new language and framework (takes longer when you're doing it on your own time ;)).

I recently learned about CPython's GIL (Global Interpreter Lock), which raised my eyebrow a bit. If I understand it correctly, this means that if I have a Queue in my web app and have threads that complete jobs in the queue, then the code is locked until the thread for that request is complete, meaning that any subsequent request is locked while the previous thread is executing.

Question:

Has anyone in "real world" applications found this to be a problem? Is it worthwhile to learn a language that supports real concurrency out of the box, such as Erlang? I'm most interested in any benchmarks that anyone has done in real world apps and whether or not anyone has seen any real noticeable issues with the GIL.

Best Answer

I have run up against the GIL in server side programming in almost every instance where I need something to scale to millions of concurrent users on multiple core machines.

Python is great for command line tools and things that don't need true concurrency to extract every last bit of performance from a given piece of hardware.

But for things that really need to squeeze everything out of something like a Sun T2000, you don't want to write anything in Python, it will be a operational maintenance nightmare running 32 separate processes and trying to management them all.

I abandoned Twisted in favor of Erlang a few years ago, Python just doesn't cut it in the large scale concurrency space. The transparent distributed nature of Erlang means it scales horizontally as well as vertically.