Eu tenho o CentOS 6.5 rodando em um host VPS de 32 bits. Está rodando somente php-fpm, nginx e mysql.
Eu tenho um site que recebe em média 20 visitantes por dia, mas recentemente recebi esta mensagem do meu provedor de hospedagem.
This is an automated notification to inform you that your VPS named 'name.here' has been severely slowed down the past hour because of swapping.
Swapping is the result of a lack of memory. If the memory of a VPS is completely filled, parts of memory are written to hard disk to prevent the server from crashing. Because hard disks are many times slower than memory your server performance is severely reduced.
Estou tentando entender isso. Como um site com conteúdo pequeno obtendo 20 visitas consome muita memória?
Não tenho certeza se isso é do php, centos ... ou outro. Mas eu tenho algumas saídas aqui que alguém pode determinar o núcleo do problema.
[[email protected]~]# free -m
total used free shared buffers cached
Mem: 498 489 9 0 1 19
-/+ buffers/cache: 469 29
Swap: 1022 180 842
top - 18:33:36 up 65 days, 1 min, 1 user, load average: 0.00, 0.02, 0.00
Tasks: 109 total, 1 running, 108 sleeping, 0 stopped, 0 zombie
Cpu(s): 1.0%us, 0.3%sy, 0.0%ni, 98.3%id, 0.3%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 510868k total, 503092k used, 7776k free, 1904k buffers
Swap: 1047544k total, 185096k used, 862448k free, 20956k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7435 mysql 20 0 352m 7752 2852 S 1.0 1.5 56:23.52 mysqld
17806 nginx 20 0 50088 12m 2640 S 0.7 2.5 18:13.65 php-fpm
984 root 20 0 8940 372 272 S 0.3 0.1 0:29.68 sshd
3148 root 20 0 2692 1128 880 R 0.3 0.2 0:00.15 top
1 root 20 0 2900 416 292 S 0.0 0.1 0:07.29 init
Qual poderia ser o problema aqui? Existe alguma correção para isso?
UPDATE
@Michael Hampton
Saída para top
> Shift M
top - 14:34:29 up 66 days, 20:02, 2 users, load average: 0.00, 0.00, 0.00
Tasks: 110 total, 1 running, 109 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3%us, 0.0%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 510868k total, 504528k used, 6340k free, 3084k buffers
Swap: 1047544k total, 179784k used, 867760k free, 19532k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
19041 nginx 20 0 58672 22m 2660 S 0.0 4.5 24:00.18 php-fpm
17805 nginx 20 0 58672 22m 2688 S 0.0 4.5 16:46.40 php-fpm
19040 nginx 20 0 58776 17m 2684 S 0.0 3.6 24:27.53 php-fpm
19046 nginx 20 0 53412 17m 2692 S 0.0 3.5 22:51.54 php-fpm
17796 nginx 20 0 53604 16m 2648 S 0.0 3.3 15:14.62 php-fpm
19042 nginx 20 0 52144 15m 2660 S 0.0 3.0 22:16.40 php-fpm
17186 nginx 20 0 52208 15m 2656 S 0.0 3.0 25:22.13 php-fpm
24580 nginx 20 0 50600 14m 2660 S 0.0 3.0 13:23.23 php-fpm
19014 nginx 20 0 52084 14m 2692 S 0.0 3.0 22:16.57 php-fpm
19007 nginx 20 0 58724 14m 2724 S 0.0 3.0 25:09.20 php-fpm
19032 nginx 20 0 50156 14m 2692 S 0.0 3.0 24:25.53 php-fpm
17830 nginx 20 0 50088 14m 2696 S 0.0 2.9 16:37.53 php-fpm
17816 nginx 20 0 49996 14m 2768 S 0.0 2.9 18:57.37 php-fpm
19043 nginx 20 0 50140 14m 2648 S 0.0 2.9 23:30.66 php-fpm
17806 nginx 20 0 50088 14m 2656 S 0.0 2.9 19:38.99 php-fpm
17188 nginx 20 0 50100 14m 2656 S 0.0 2.9 22:46.46 php-fpm
17817 nginx 20 0 49836 14m 2660 S 0.0 2.9 18:29.45 php-fpm
17820 nginx 20 0 48892 13m 2972 S 0.0 2.8 18:01.07 php-fpm
19030 nginx 20 0 58824 13m 2652 S 0.0 2.8 23:40.90 php-fpm
17798 nginx 20 0 48780 13m 2696 S 0.0 2.7 17:09.82 php-fpm
17187 nginx 20 0 58672 13m 2716 S 0.0 2.7 23:04.46 php-fpm
17807 nginx 20 0 52076 13m 2660 S 0.0 2.6 16:45.52 php-fpm
19029 nginx 20 0 58924 12m 2688 S 0.0 2.6 24:00.66 php-fpm
17808 nginx 20 0 58676 12m 2688 S 0.0 2.6 17:31.33 php-fpm
17799 nginx 20 0 50088 12m 2660 S 0.0 2.6 17:41.13 php-fpm
19015 nginx 20 0 58680 12m 2656 S 0.0 2.6 21:59.83 php-fpm
18295 nginx 20 0 48512 12m 2692 S 0.0 2.6 16:57.08 php-fpm
19027 nginx 20 0 48368 12m 2656 S 0.0 2.6 24:40.65 php-fpm
17819 nginx 20 0 48208 12m 2656 S 0.0 2.5 16:43.87 php-fpm
19031 nginx 20 0 49960 12m 2648 S 0.0 2.5 23:28.34 php-fpm
17832 nginx 20 0 47884 12m 2660 S 0.0 2.5 16:04.87 php-fpm
17818 nginx 20 0 47884 12m 2660 S 0.0 2.5 16:03.53 php-fpm
17831 nginx 20 0 47864 12m 2696 S 0.0 2.5 16:43.48 php-fpm
18249 nginx 20 0 47884 12m 2664 S 0.0 2.5 16:27.29 php-fpm
7435 mysql 20 0 352m 7780 2872 S 0.3 1.5 62:00.00 mysqld
19033 nginx 20 0 42540 7368 2676 S 0.0 1.4 24:04.93 php-fpm
31015 root 20 0 12028 3708 2940 S 0.0 0.7 0:00.17 sshd
30826 postfix 20 0 13628 2260 1640 S 0.0 0.4 0:00.00 pickup
30995 root 20 0 5252 1704 1412 S 0.0 0.3 0:00.03 bash
31020 root 20 0 5256 1704 1416 S 0.0 0.3 0:00.03 bash
19028 nginx 20 0 58668 1648 1528 S 0.0 0.3 9:11.84 php-fpm