Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is --thunder-lock beneficial?

Tags:

python

uwsgi

This long, detailed, and entertaining article describes the history and design of --thunder-lock: http://uwsgi-docs.readthedocs.org/en/latest/articles/SerializingAccept.html

But it doesn't help me decide when I need it!

When is and isn't --thunder-lock beneficial?

like image 275
John Bachir Avatar asked Jan 16 '16 07:01

John Bachir


2 Answers

Well... the answer is not that easy. But in general, you should use it when you're using multiple workers with multiple threads. But...

There are dozens of different operating systems and thunder locking is highly dependent on their capabilities. There are at least six different mechanisms of thunder locking, which are choosed by uWSGI based on operating system capabilities, some of them are better than other. If you're using for example Linux with robust pthread support, you're 99.999999% safe to use thunder-lock.

like image 65
GwynBleidD Avatar answered Nov 16 '22 09:11

GwynBleidD


Some performance comparison using very simple and small example is available here

It's interesting that as you scale up the number of processes without the thunderlock for the "hello world" the response time goes up seemingly linearly as a function of the number of processes I have spawned. Presumably something checking whether a process is free is scaling with the number of processes.

The thunder-lock doesn't suffer as badly from that, although there's a slight performance degradation, although possibly from the OS having to manage that many processes.

like image 34
H S Rathore Avatar answered Nov 16 '22 09:11

H S Rathore