So, I have an Apache Web Server with 1GB of Ram on a VPS. No SWAP SPACE. It is running wordpress with APC and W3TC for cache control. However when I get slashdotted, Apache takes 100% of the servers memory and then some and slows to a crawl. I would think at 1GB of memory I should be able to handle over 1,000 hits an hour.Here is the affected settings I believe. Request more info and I will give it # # Timeout: The number of seconds before receives and sends time out. # Timeout 2 # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. # KeepAlive Off # # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. Set to 0 to allow an unlimited amount. # We recommend you leave this number high, for maximum performance. # MaxKeepAliveRequests 0 # # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 1 ## ## Server-Pool Size Regulation (MPM specific) ## # prefork MPM # StartServers: number of server processes to start # MinSpareServers: minimum number of server processes which are kept spare # MaxSpareServers: maximum number of server processes which are kept spare # ServerLimit: maximum value for MaxClients for the lifetime of the server # MaxClients: maximum number of server processes allowed to start # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule prefork.c> StartServers 3 MinSpareServers 2 MaxSpareServers 1 ServerLimit 40 MaxClients 40 MaxRequestsPerChild 0 </IfModule>
These settings are fine for 1gb of memory, what you need to do is track the pid when its spikes and find out what the process is actually doing and what script your running eats all the memory. You can do a strace on the pid # and log it, as you wont be able to keep up with it running live. Timeout 30 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 2 StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 100 MaxRequestsPerChild 1000 Code (markup):