Unfortunately, it also comes with its share of problems. Basically, if requests come in faster than your server can handle them, you're screwed :-)
One way to deal with that is to use load-balancing. This basically means that several threads or processes will be serving the pages. It is only efficient if you have several machines or if your machine has several processors. (otherwise, the same processor will just run several threads or processes, but the overall speed will be the same).
Of course, this means that you have to take care of the data sharing between the threads/processes. One way to do that is to use a database where you store all the data that needs to be shared amongst the processes. All processes read and write to the same database, insuring that they all have the same informations.
There are two ways to do load-balancing with CherryPy. One of them is easier to set up, but only applies to multi-processor machines running a Unix-based OS.
Then all you have to do is use a simple load-balancer (there are many of those out there) to redirect the requests to your CherryPy servers.
Let's take an example:
Here is what we have to do:
[server] socketPort=8080
[server] socketPort=8081
[host1] % python MyServer.py -C MyServer8080.cfg [host2] % python MyServer.py -C MyServer8080.cfg [host3] % python MyServer.py -C MyServer8080.cfg
[host1] % python MyServer.py -C MyServer8081.cfg
[host1] % /usr/sbin/balance 80 host1:8080 host1:8081 host2:8080 host3:8080
The trick is to create the socket where the CherryPy server will listen, and then do a fork(). This way, we'll have multiple processes listening on the same socket. When one process is busy building a page, the next one will be listening on the socket and thus serving a request that might come in.
This feature is built in. All you have to do to use it is to use the fixedNumberOfProcesses option in the configuration file (in the [server] section):
[server] socketPort=80 fixedNumberOfProcesses=3
Note: This method is only useful if your machine has several processors. If not, then the processor will run multiple CherryPy processes, but the overall speed won't be improved.
See About this document... for information on suggesting changes.