My FreeBSD server is giving a lot of swap errors. Every day the daily reporting email was filled with kernel messages like these:
my.server.com kernel log messages: +swap_pager_getswapspace(31): failed +swap_pager_getswapspace(32): failed ... and many more ...
After figuring out which process was causing this, it seemed MySQL was to blame.
That was odd, because these are the number of mysqltuner is reporting about my configuration:
[--] Physical Memory : 8.0G [--] Max MySQL memory : 845.4M
Max 850 MB
After a lot of googling, reading MySQL, it seemd the performance schema could be to blame. Because is is completely stored in memory.
Now for several days in a row, I don't have the swaperrors ☺️
To disable the MySQL permance schema place the following in
[mysqld] performance_schema = 0
Btw. I'm not sure if I need the performance scheme ..
⚠️ Followup a few weeks later
Unfortunately this isn't the solution. MySQL is still running out of swap space. I simply don't get it, because the memory usage should be limited
Followup more weeks later ;-)
ZFS ARC is taking a lot of memory...
Somehow MySQL checks the 'free' space and decides by itself to use swap. So the ZFS ARC memory is never released and MySQL .
To solve it limit the zfs arc memory