I had reason to believe that the thunder-lock option might be
negatively affecting the performance of my application. I still
haven't properly tested it under real conditions, but I cooked up some
isolated tests that actually suggest quite the opposite.

I tested this with trivial Perl programs (submitted in
https://github.com/unbit/uwsgi/pull/613/files) which start up a uWSGI
I compiled from trunk with a given number of processes, and test with
and without the thunder-lock. I then make 10k requests to them with
ab(1) with 32 requests in parallel.

This is how long that takes, in seconds, with the number of processes
I spawned and whether I used the thunder lock or not.

For a trivial "hello world" program (should be entirely CPU bound):

$ perl t/perl/test_benchmark.pl t/perl/test_hello.psgi
1.392    16 procs wo/TL
1.743    32 procs wo/TL
2.374    64 procs wo/TL
3.530   128 procs wo/TL
4.984   256 procs wo/TL
8.258   512 procs wo/TL
9.343   1024 procs wo/TL
1.134    16 procs  w/TL
1.284    32 procs  w/TL
1.152    64 procs  w/TL
1.084   128 procs  w/TL
1.286   256 procs  w/TL
1.559   512 procs  w/TL
1.537   1024 procs  w/TL

For a program that sleeps 2..20ms in both the main and cleanup phases:

$ perl t/perl/test_benchmark.pl t/perl/test_sleepy.psgi
7.128    16 procs wo/TL
3.547    32 procs wo/TL
2.038    64 procs wo/TL
2.880   128 procs wo/TL
4.578   256 procs wo/TL
8.199   512 procs wo/TL
13.379  1024 procs wo/TL
7.123    16 procs  w/TL
3.559    32 procs  w/TL
2.036    64 procs  w/TL
1.972   128 procs  w/TL
2.026   256 procs  w/TL
2.172   512 procs  w/TL
2.412   1024 procs  w/TL

It's interesting that as you scale up the number of processes without
the thunderlock for the hello world psgi that 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.
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to