Maison > base de données > tutoriel mysql > Linux 64-bit, MySQL, Swap and Memory

Linux 64-bit, MySQL, Swap and Memory

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Libérer: 2016-06-07 16:54:43
original
939 Les gens l'ont consulté

The VM for Linux prefers system cache over application memory. What does this mean? The best way I can explain is by exa

The VM for Linux prefers system cache over application memory. What does this mean? The best way I can explain is by example.

Imagine you have 32 GB of RAM

MySQL is set to take 20 GB of RAM for a process based buffer and up to 6M for the various thread buffers.

Over a period of time the box swaps. The only thing that is running is mysql and its memory size is around 21GB for resident memory. Why does swap grow when there is plenty of memory? The reason is when a memory alloc is needed (thread based buffer is tickled) the VM will choose to use swap over allocating from the system cache, when there is not enough free memory.

DO NOT TURN OFF SWAP to prevent this. Your box will crawl, kswapd will chew up a lot of the processor, Linux needs swap enabled, lets just hope its not used.

So how do you stop Nagios pages because of swap usage? Well if you have a few choices.

reboot the box

or

stop mysql && swapoff -a;swapon -a;

or just

swapoff -a;swapon -a;

Doing the latter command is rather scary and fun at the same time. Because you can either crash mysql or not. I just did the swap* commands live, I was very certain nothing was using swap and it worked. YAY no more pages and I didn't have to shut down the service!

linux

Étiquettes associées:
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Derniers numéros
MySQL arrête le processus
Depuis 1970-01-01 08:00:00
0
0
0
Env中mysql
Depuis 1970-01-01 08:00:00
0
0
0
Erreur lors de l'installation de MySQL sous Linux
Depuis 1970-01-01 08:00:00
0
0
0
php - problème de surveillance MySQL
Depuis 1970-01-01 08:00:00
0
0
0
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal