我的网站每天平均有20个访问者,但我最近收到了来自我的主机提供商的此消息.
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.
我想弄清楚这一点.内容较少的网站如何获得20次访问会消耗那么多内存?
我不确定这是来自PHP,centos ……还是其他.但我在这里有一些输出,有人可能会确定问题的核心.
[root@site.name~]# free -m total used free shared buffers cachedMem: 498 489 9 0 1 19-/+ buffers/cache: 469 29Swap: 1022 180 842
top - 18:33:36 up 65 days,1 min,1 user,load average: 0.00,0.02,0.00Tasks: 109 total,1 running,108 sleePing,0 stopped,0 zombIEcpu(s): 1.0%us,0.3%sy,0.0%ni,98.3%ID,0.3%wa,0.0%hi,0.0%si,0.0%stMem: 510868k total,503092k used,7776k free,1904k buffersSwap: 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 MysqLd17806 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
这可能是什么问题?它有什么问题吗?
UPDATE
@Michael Hampton输出顶部>转移M.
top - 14:34:29 up 66 days,20:02,2 users,0.00,0.00Tasks: 110 total,109 sleePing,0 zombIEcpu(s): 0.3%us,0.0%sy,99.7%ID,0.0%wa,504528k used,6340k free,3084k buffersSwap: 1047544k total,179784k used,867760k free,19532k cached PID USER PR NI VIRT RES SHR S %cpu %MEM TIME+ COMMAND19041 Nginx 20 0 58672 22m 2660 S 0.0 4.5 24:00.18 PHP-fpm17805 Nginx 20 0 58672 22m 2688 S 0.0 4.5 16:46.40 PHP-fpm19040 Nginx 20 0 58776 17m 2684 S 0.0 3.6 24:27.53 PHP-fpm19046 Nginx 20 0 53412 17m 2692 S 0.0 3.5 22:51.54 PHP-fpm17796 Nginx 20 0 53604 16m 2648 S 0.0 3.3 15:14.62 PHP-fpm19042 Nginx 20 0 52144 15m 2660 S 0.0 3.0 22:16.40 PHP-fpm17186 Nginx 20 0 52208 15m 2656 S 0.0 3.0 25:22.13 PHP-fpm24580 Nginx 20 0 50600 14m 2660 S 0.0 3.0 13:23.23 PHP-fpm19014 Nginx 20 0 52084 14m 2692 S 0.0 3.0 22:16.57 PHP-fpm19007 Nginx 20 0 58724 14m 2724 S 0.0 3.0 25:09.20 PHP-fpm19032 Nginx 20 0 50156 14m 2692 S 0.0 3.0 24:25.53 PHP-fpm17830 Nginx 20 0 50088 14m 2696 S 0.0 2.9 16:37.53 PHP-fpm17816 Nginx 20 0 49996 14m 2768 S 0.0 2.9 18:57.37 PHP-fpm19043 Nginx 20 0 50140 14m 2648 S 0.0 2.9 23:30.66 PHP-fpm17806 Nginx 20 0 50088 14m 2656 S 0.0 2.9 19:38.99 PHP-fpm17188 Nginx 20 0 50100 14m 2656 S 0.0 2.9 22:46.46 PHP-fpm17817 Nginx 20 0 49836 14m 2660 S 0.0 2.9 18:29.45 PHP-fpm17820 Nginx 20 0 48892 13m 2972 S 0.0 2.8 18:01.07 PHP-fpm19030 Nginx 20 0 58824 13m 2652 S 0.0 2.8 23:40.90 PHP-fpm17798 Nginx 20 0 48780 13m 2696 S 0.0 2.7 17:09.82 PHP-fpm17187 Nginx 20 0 58672 13m 2716 S 0.0 2.7 23:04.46 PHP-fpm17807 Nginx 20 0 52076 13m 2660 S 0.0 2.6 16:45.52 PHP-fpm19029 Nginx 20 0 58924 12m 2688 S 0.0 2.6 24:00.66 PHP-fpm17808 Nginx 20 0 58676 12m 2688 S 0.0 2.6 17:31.33 PHP-fpm17799 Nginx 20 0 50088 12m 2660 S 0.0 2.6 17:41.13 PHP-fpm19015 Nginx 20 0 58680 12m 2656 S 0.0 2.6 21:59.83 PHP-fpm18295 Nginx 20 0 48512 12m 2692 S 0.0 2.6 16:57.08 PHP-fpm19027 Nginx 20 0 48368 12m 2656 S 0.0 2.6 24:40.65 PHP-fpm17819 Nginx 20 0 48208 12m 2656 S 0.0 2.5 16:43.87 PHP-fpm19031 Nginx 20 0 49960 12m 2648 S 0.0 2.5 23:28.34 PHP-fpm17832 Nginx 20 0 47884 12m 2660 S 0.0 2.5 16:04.87 PHP-fpm17818 Nginx 20 0 47884 12m 2660 S 0.0 2.5 16:03.53 PHP-fpm17831 Nginx 20 0 47864 12m 2696 S 0.0 2.5 16:43.48 PHP-fpm18249 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 MysqLd19033 Nginx 20 0 42540 7368 2676 S 0.0 1.4 24:04.93 PHP-fpm31015 root 20 0 12028 3708 2940 S 0.0 0.7 0:00.17 sshd30826 postfix 20 0 13628 2260 1640 S 0.0 0.4 0:00.00 pickup30995 root 20 0 5252 1704 1412 S 0.0 0.3 0:00.03 bash31020 root 20 0 5256 1704 1416 S 0.0 0.3 0:00.03 bash19028 Nginx 20 0 58668 1648 1528 S 0.0 0.3 9:11.84 PHP-fpm解决方法 我们可以从您更新的输出中看到您有34个PHP工作程序正在运行(不包括主进程),所有这些都占用内存并且完全空闲.这意味着你已经调整了PHP-fpm以在更大容量的机器上运行,远远超过你实际获得的流量.或者,或许,根本没有调整它.
目前,这些进程占用了VM的3/4以上,并且绝对没有任何好处.
因此,检查PHP-fpm池配置中的调优,例如默认的/etc/PHP-fpm.d/www.conf.对于像这样的小型VPS,我可能会在某处开始:
pm = dynamicpm.max_children = 10pm.start_servers = 3pm.min_spare_servers = 3pm.max_spare_servers = 5总结
以上是内存溢出为你收集整理的linux – 交换内存耗尽服务器甚至站点都有小访问者全部内容,希望文章能够帮你解决linux – 交换内存耗尽服务器甚至站点都有小访问者所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)