musthero
musthero

Reputation: 1288

Cherrypy: multiprocessing

I launch my Cherrypy code as

python -u myApp.py

It works fine. However, when I do ps ax | grep myApp I can see 21 copies of python -u myApp.py running. Why is this and what is this for?

Upvotes: 2

Views: 1771

Answers (1)

culix
culix

Reputation: 10616

CherryPy uses multiple threads to handle connections. You can control how many it uses by editing the ThreadPool settings.

There are some details on how the worker thread works in the WSGI docs:

  • The server’s listening thread runs a very tight loop, sticking incoming connections onto a Queue
  • Worker threads are kept in a pool and poll the Queue, popping off and then handling each connection
  • Each connection can consist of an arbitrary number of requests and their responses

You could probably lower the number of threads in the thread pool if you really don't want to use them, but that may lower performance.

Upvotes: 1

Related Questions