0

If I need to turn off swap on a linux server mysql database so I can increase the size of the swap, what would happen to the database?

The database is using all 8GB of swap. What would be the best way to increase the database swap to 16GB?

It has 16GB of RAM and swapiness of 1 and it used up all 8GB of swap, would it not eat up 16GB of swap too?

CzipO2
  • 127
  • 1
  • 1
  • 4

2 Answers2

2

There is no single solution to adding swap, and it depends on your goal. As long as you disable swap before resizing the underlying block device you won't loose data (but you might crash your system if you don't have enough memory.)

You can have more then 1 swap file/device, so an alternative would be to simply add a second swap device which you can do without removing the existing swap. You could also create a new temporary swap, enable it, then disable the existing swap, resize it, enable it and disable the temp swap. This would hit performance hard while the process is in motion but can be done without downtime.

davidgo
  • 5,964
  • 2
  • 21
  • 38
  • Thank you for the input. I just edited the post because I realized that my first sentence didn't make any sense. But you managed to answer my question anyways. – CzipO2 Feb 05 '20 at 13:47
0

Swapping of MySQL is terrible for performance. It is better to decrease setting so that MySQL does not swap at all. Please provide the contents of my.cnf; the issues may be obvious there.

MySQL assumes it has a variety of things readily accessible in RAM, so it thinks nothing about scanning an entire, say, "table cache", or the "buffer pool". If you are swapping, this leads to lots of I/O.

Rick James
  • 2,058
  • 5
  • 11