6👍
The reason you’re seeing multiple processes is because runfcgi
uses method=prefork
by default. With this method, a bunch of FCGI processes are forked to handle requests; obviously method=threaded
uses a multithreaded FCGI process instead.
There are advantages and disadvantages to each. The prefork method will use more memory, since a process uses more memory than a thread. It will also take a bit more time to start up, since forking takes more time than creating a new thread. However, generally preforking handles load better than threading, so if your app has a high load, it may perform better with preforking (if it doesn’t, you probably won’t notice much of a difference either way).
Why does the second command spawn 6 processes? How do you limit the amount of processes spawned?
Django will spawn a default number of processes when preforking, if you don’t specify how many to spawn. You can change this with the maxspare
or maxchildren
options.