multithreading - How to count the threads and process of WSGI? -


i have deployed wsgi application on apache , have configured this: wsgidaemonprocess wsgi-pcapi user= group= processes=2 threads=15

after restart apache counting number of threads: ps -efl | grep | grep -c httpd

the local apache running 1 wsgi app number 36 , cannot understand why. know there 2 processes , 15 threads means: 15*2+2=32 why have 4 more?

you mean why have 3 per mod_wsgi daemon process.

for configuration, 15 new threads created handling requests. other 3 in process due to:

  1. the main thread process started as. wait until appropriate signal received shutdown process.
  2. a monitor thread checks events occur , signal process shutdown.
  3. a deadlock thread checks see if deadlock has occurred in python interpreter. if occur, sent event thread (2) detect. thread (2) send signal process quit. signal detected thread (1) gracefully exit process , try , cleanup properly.

so threads ensuring whole system robust in event of various things can occur. plus ensuring when process being shutdown python sub intepreters destroyed allow atexit registered python code run own cleanup.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -