IO/Swap Spikes, causing server issues.

I'm running a fairly trafficed (wordpress / LAMP) site, that seems to get random spikes on the IO graph. (Attached)

~~![](<URL url=)http://i.imgur.com/keZkPXN.jpg" />

Being new to the server game I'm almost positive I shouldn't be seeing this much swap happen. (But maybe I should?) Usually when I get a spike I get a error from wordpress establishing a database connection (not sure if that would be a clue or not?).

Any help is much appreciated!~~

7 Replies

Your swapping too much, search the forum for Apache MaxClients there's plenty on posts on it and it's probably your problem. If that doesn't work let us know.

<ifmodule mpm_prefork_module="">StartServers 2 MinSpareServers 6 MaxSpareServers 12 MaxClients 40 MaxRequestsPerChild 3000</ifmodule>

I had it set to 40 on a 1024 Linode, guess that would be to much? From what I just read through it's seems 50 and below *should be ok?

Here's the rest of my settings, maybe something here is a little high?

MySQL:

max_connections = 75
key_buffer = 32M
max_allowed_packet = 1M
thread_stack = 128K
table_cache = 64

PHP:

max_execution_time = 30
memory_limit = 256M
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = Off
log_errors = On
;error_log = php_errors.log
register_globals = Off

40 clients with prefork is waaay too much for a 1024. Try 10-15

Did you solve your problem? I'm having a similar issue with high I/O spikes periodically, without correlation to network traffic. I'm on a 2048 linode, and have settings similar to the ones you listed.

I'm particularly interested in the recommendation to back off from 40 clients with prefork to 10 to 15, as I've got mine set at 80, which was the linode how-to's recommendation for a 2048 (i.e. doubling the 1024's 40). So I'm wondering if you tried that, and if that helped.

Thanks!

80? o_O With apache prefork you really don't want that. You'll go oom, start swapping and indeed get lots of I/O during that time.

I would say the Linode Guide is wrong. Maybe they meant 8 or something, not 80.

You'd be better of with nginx, especially if you need 80 clients.

@Nuvini: thanks for the comment.

From the comments in this thread, I scaled back maxclients from 80 to 40.

I ran the "apachememoryusage.sh" script before and after the change to see how Apache's memory utilization looked with both settings. With maxclients at 80, Apache memory usage was 740MB (under light loading) and average process size was 56MB. Then, with maxclients at 40, and after half a day running that way, Apache memory usage was at 833MB (under moderate loading) and average process size was 64MB. After several weeks with the reduced maxclients setting, my site's OOM problems appeared to have gone away.

That was on a 2GB Linode that had 2GB RAM plus 8 shared CPU cores. Last week, the Linode dashboard informed me that those 2GB Linodes were getting migrated to a new 4GB configuration that had 4 shared CPU cores, and I upgraded my site to the new Linode style with 4GB RAM. I suspect this larger RAM allocation will make the 40 maxclients setting even safer, but will report back if any more OOM problems arise.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct