Right now I'm running a PHP script on my LAMP (CentOS/Apache/MySQL/PHP) stack that generates dynamic images using GD. I'm caching them on the hard drive for 5 minutes. If a cached version exists, I pull that instead of generating a new one. This saves CPU time, but since Apache is still running the PHP file it generates a new Apache process for each image.
Apache typically ran at about 30MB, I rewrote a good portion of the config and got it down to about 10MB per process. However, with ~30 concurrent processes this adds up quickly. This server also has to serve normal website content. I was wondering if there was a good way to set up another lightweight server, or optimize Apache/PHP further? Here is my prefork setup on 500MB RAM:
StartServers 10
MinSpareServers 20
MaxSpareServers 30
ServerLimit 128
MaxClients 128
MaxRequestsPerChild 256