You Can Change It Later

The Blog Of David Marks

Why is mysql swapping when I have plenty of RAM?

Posted on | September 30, 2010 | No Comments

Olivetti M40 hard disk from the 1980's

Image courtesy Aldo Aldoz http://www.flickr.com/photos/aldoaldoz/

If you’ve run large mysql systems, you may have noticed a frustrating situation where mysql starts swapping to disk on multi-core systems when you have plenty of RAM free.

You’re not the only one. There are dozens of hits on Google for people asking this question.

Talented mysql consultant Jeremy Cole appears to have discovered the cause for this problem and written up a must-read blog post about it. Go read it.

To sum things up quickly and badly:

NUMA architecture systems allocate RAM to each processor node, and mysql allocates data and cache to that RAM unevenly. So you run out of RAM on one node, and then mysql starts swapping away. But frustratingly, there’s plenty of free memory on the other node(s).

There’s a solution to this problem which entails interleaving the memory allocated using a one-line command, but I’m going to encourage you to go to Jeremy’s blog to read about it.

I have to imagine there are other large, memory-intensive applications which suffer from this kind of issue besides mysql.

Comments

Leave a Reply