cescurules / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

Why are the default # of processes and threads set to 1 and 15, respectively? #308

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This is not really a defect in the program, but rather an open question as to 
the logic behind the default values.

Given that CPython doesn't scale as well across threads as it does across 
processes and mod_wsgi is linked to CPython, why is the default 1 process and 
15 threads? 15 processes and 1 thread would surely make more sense. 

Think of all the poor developers who don't understand the performance 
implications of the GIL and they want their application to "just work".

Original issue reported on code.google.com by meha...@gmail.com on 7 Oct 2013 at 5:19

GoogleCodeExporter commented 8 years ago
If nothing else, the documentation on this page could suggest some reasonable 
defaults for a typical Python web application:

https://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines

Original comment by meha...@gmail.com on 7 Oct 2013 at 5:21

GoogleCodeExporter commented 8 years ago
Please note that the mailing list is a better forum for discussion.

http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Asking_Your_Questions

Because web applications are normally I/O bound, the GIL is not the big problem 
people think it is and multithreading tends to be more than adequate. 
Multiprocessing only becomes more important when you are talking about CPU 
bound activities.

More important in web applications is usually memory usage and using single 
threading and many processes will use a lot lot more memory. This will often 
exhaust a users system memory long before they reach any performance issue due 
to the use of threading.

So overall the safer option for the typical user is a single process with 
multiple threads.

As to reasonable defaults, that is an impossible question to answer as it 
depends on your specific web application. There is no one right way.

I would suggest you go watch my talks:

http://lanyrd.com/2012/pycon/spcdg/
http://lanyrd.com/2013/pycon/scdyzk/

Original comment by Graham.Dumpleton@gmail.com on 8 Oct 2013 at 5:42

GoogleCodeExporter commented 8 years ago
OK, well thanks for the reply. I agree that "reasonable defaults" is 
subjective, and I will check out the talks. Thanks again.

Original comment by meha...@gmail.com on 11 Oct 2013 at 6:55

GoogleCodeExporter commented 8 years ago
Closing out documentation issues. Will pick up another time on github side when 
get enough momentum to work on documentation again.

Original comment by Graham.Dumpleton@gmail.com on 12 Nov 2014 at 11:03