-1

One of my database server running mysql/debian is out of memory. I added a swap file but as far as I know it's not used by the system.

I can confirm that the swap is enabled when I execute the free -h command:

             total       used       free     shared    buffers     cached
Mem:          497M       489M       7.5M         0B       432K       285M
-/+ buffers/cache:       203M       293M
Swap:         1.5G       2.7M       1.5G

When I look at the memory usage I can see that my system is out of ram but the swap is untouched.

MemTotal:         508944 kB
MemFree:            6300 kB
Cached:           292064 kB
SwapCached:           32 kB
SwapTotal:       1535996 kB
SwapFree:        1533240 kB

I tried to increase the swappiness from 60 to 100 but it didn't change anything.

I'm out of ideas, am I missing something?

1 Answers1

1

The Linux kernel won't swap much while cached memory is available. It will evict used memory from cache first.

Also, you don't want to swap. That is last resort only. You shouldn't be worried about your database using the cache, they always do. If you double the memory you will still have the same issue. Unused memory is wasted memory. You should only be worried if the kernel kills your database (OOM).

gbolo
  • 593
  • 4
  • 7