I have 开发者_如何学Pythona web service using lighttpd and fastCGI (using TCP) where lighttpd causes a processor bottleneck. How can I optimize the performance of lighttpd and fastCGI?
Best Regards
I highly doubt Lighttpd will cause a cpu bottleneck - before your network or hdd dies.. fastCGI is only a interfaces, but I assume you are using it with PHP? Check http://xcache.lighttpd.net/
Though this questions contains far too less info in order to help you correctly...
Lighttpd was designed as a single-process and single-threaded webserver. This means lighttpd uses only one core to accept new connections, search for files, open files, send data back, receive data, and also open, send and receive data from or to a FastCGI backend.
My fair advice is to use another web server, like nginx, if you really see lighttpd going to 100 CPU%.
However, if you are forced to use lighttpd (>=1.4), you could also use:
server.max-worker = 2
which will spawn 2 lighttpd processes, both accepting new connection(s). (You can substitude 2 with a higher number, ofc.)
However, this will really only spawn two processes without communication between them, leading to various "misbehaviours":
- Modules collecting datas only collect them for their process. Meaning the mod_status page will only show the statistics of the worker process which took your connection.
- Logs are just written from 2 (or more) processes. Sometimes mixing up the logs, wenn the write buffer is written with 2 sequential write calls.
- Any configured limit for the whole server is per worker process in reality.
- Other things, maybe.
精彩评论