之前帮同学做的一个简单的图片保存访问和管理网站,昨晚他说访问很慢,然后登陆后台服务器用netstat查看

[root@iZ2832m5qa1Z ~]# netstat | grep ESTABLISHED
tcp        0  15840 iZ2832m5qa1Z:http       70.146.93.117.bro:52017 ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       115.173.87.59:51486     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       115.173.87.59:51484     ESTABLISHED
tcp        0  17520 iZ2832m5qa1Z:http       33.25.164.222.sta:49385 ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       180.165.67.91:64912     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       117.139.14.90:23150     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       139.205.81.137:18076    ESTABLISHED
tcp        0  20440 iZ2832m5qa1Z:http       KD182251243016.au:41106 ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       42.84.222.165:49941     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       pppoe214.net213.o:56491 ESTABLISHED
tcp        0  10880 iZ2832m5qa1Z:http       103.30.98.234:59365     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       42.84.222.165:49938     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       pw126253225030.6.:61449 ESTABLISHED
tcp        0  14520 iZ2832m5qa1Z:http       183.208.245.224:50679   ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       182.41.29.245:55637     ESTABLISHED
tcp        0  14000 iZ2832m5qa1Z:http       117.136.16.105:12603    ESTABLISHED
tcp        0   9685 iZ2832m5qa1Z:http       61.159.21.88:52751      ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       118.123.72.35:27057     ESTABLISHED
tcp        0  15400 iZ2832m5qa1Z:http       117.136.16.105:12602    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       70.146.93.117.bro:52014 ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       hn.kd.ny.adsl:5527      ESTABLISHED
tcp        0   5184 iZ2832m5qa1Z:ssh        157.61.153.165:64214    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       hn.kd.ny.adsl:5526      ESTABLISHED
tcp        0  14000 iZ2832m5qa1Z:http       27.211.243.243:45558    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       117.139.14.90:23149     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       27.8.105.143:50135      ESTABLISHED
tcp        0   5503 iZ2832m5qa1Z:http       113.89.36.247:10958     ESTABLISHED
tcp        0  15840 iZ2832m5qa1Z:http       113.89.36.247:10957     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       61.159.21.88:52750      ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       114.85.101.145:13878    ESTABLISHED
tcp        0  17280 iZ2832m5qa1Z:http       pppoe214.net213.o:53090 ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       36.5.27.214:16960       ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       113.143.49.201:58216    ESTABLISHED
tcp        0   5045 iZ2832m5qa1Z:http       103.40.223.36:52853     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       113.89.36.247:10954     ESTABLISHED
tcp        0  18200 iZ2832m5qa1Z:http       183.138.35.202:61349    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       103.40.223.36:52852     ESTABLISHED
tcp        0  18720 iZ2832m5qa1Z:http       3.52.184.60.broad:53417 ESTABLISHED
tcp        0   8385 iZ2832m5qa1Z:http       125.36.248.155:21057    ESTABLISHED
tcp        0  20160 iZ2832m5qa1Z:http       3.52.184.60.broad:53418 ESTABLISHED
tcp        0  15840 iZ2832m5qa1Z:http       61.159.21.88:52754      ESTABLISHED
tcp        0  19600 iZ2832m5qa1Z:http       OFSfx-12p8-167.pp:39607 ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       180.112.206.79:53807    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       180.112.206.79:53804    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       113.143.49.201:58213    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       113.143.49.201:58214    ESTABLISHED
tcp        0  13140 iZ2832m5qa1Z:http       KD182251243016.au:41091 ESTABLISHED
tcp        0  19600 iZ2832m5qa1Z:http       220.172.205.84:64506    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       183.138.35.202:61351    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       124.228.157.148:cm      ESTABLISHED
tcp        0  14095 iZ2832m5qa1Z:http       115.77.130.139:57265    ESTABLISHED
tcp        0   2575 iZ2832m5qa1Z:http       125.36.248.155:21058    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:ssh        157.61.153.165:63820    ESTABLISHED
tcp        0  11520 iZ2832m5qa1Z:http       180.175.15.94:60250     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       hn.kd.ny.adsl:5525      ESTABLISHED
tcp        0  16800 iZ2832m5qa1Z:http       36.104.17.199:12445     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       124.23.133.76:36709     ESTABLISHED
tcp        0  25410 iZ2832m5qa1Z:http       221.227.160.76:50909    ESTABLISHED
tcp        0  27377 iZ2832m5qa1Z:http       36.104.17.199:12444     ESTABLISHED
tcp        0   5695 iZ2832m5qa1Z:http       89.42.62.210:17259      ESTABLISHED
tcp        0   9617 iZ2832m5qa1Z:http       113.118.244.198:21199   ESTABLISHED
tcp        0  18200 iZ2832m5qa1Z:http       hn.kd.ny.adsl:52590     ESTABLISHED
tcp        0   5365 iZ2832m5qa1Z:http       113.118.244.198:21200   ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       175.152.152.119:54357   ESTABLISHED
tcp        0   2623 iZ2832m5qa1Z:http       114.138.243.190:52567   ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       180.175.15.94:60249     ESTABLISHED
tcp        0  16060 iZ2832m5qa1Z:http       sp49-98-175-192.m:62563 ESTABLISHED
tcp        0  18161 iZ2832m5qa1Z:http       221.227.160.76:50910    ESTABLISHED
tcp        0  16800 iZ2832m5qa1Z:http       220.202.153.122:61180   ESTABLISHED
tcp        0  17205 iZ2832m5qa1Z:http       117.136.82.1:9890       ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       183.249.139.93:19404    ESTABLISHED
tcp        0  11520 iZ2832m5qa1Z:http       180.175.15.94:60251     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       111.14.82.93:8895       ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       115.216.229.234:50027   ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       45.19.224.121.broa:7317 ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       103.40.223.36:52855     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       223.101.243.33:29598    ESTABLISHED
tcp        0  15840 iZ2832m5qa1Z:http       115.77.130.139:57272    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       182.84.62.177:16124     ESTABLISHED
tcp        0  11072 iZ2832m5qa1Z:http       89.42.62.210:17262      ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       3.52.184.60.broad:53461 ESTABLISHED
tcp        0   2859 iZ2832m5qa1Z:http       89.42.62.210:17263      ESTABLISHED
tcp        0  15714 iZ2832m5qa1Z:http       183.204.8.177:37090     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       118.206.38.35:53403     ESTABLISHED
tcp        0  17280 iZ2832m5qa1Z:http       180.175.15.94:60252     ESTABLISHED
tcp        0   1412 iZ2832m5qa1Z:ssh        157.61.153.165:64208    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       203.152.92.76:61435     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       ppp118-208-236-25:55869 ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       171.232.170.106:56428   ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       228.148.61.59.bro:59308 ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       223.73.223.248:tsspmap  ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       220.202.153.122:61179   ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       175.165.26.63:56572     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       158.121.164.124.a:62007 ESTABLISHED
tcp        0   5045 iZ2832m5qa1Z:http       176.59.5.50:63602       ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       121.31.250.178:37454    ESTABLISHED
tcp        0  34080 iZ2832m5qa1Z:http       softbank060099014:63654 ESTABLISHED
tcp        0  17280 iZ2832m5qa1Z:http       14.159.99.11:53809      ESTABLISHED
tcp        0  14005 iZ2832m5qa1Z:http       36.104.17.199:12439     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       228.148.61.59.bro:19657 ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       14.159.99.11:53811      ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:ssh        157.61.153.165:63816    ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:10019      106.11.68.13:http       ESTABLISHED
tcp        0  12914 iZ2832m5qa1Z:http       hn.kd.ny.adsl:52588     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       175.165.26.63:56575     ESTABLISHED
tcp        0  16789 iZ2832m5qa1Z:http       221.227.160.76:50911    ESTABLISHED
tcp        0  14600 iZ2832m5qa1Z:http       176.59.5.50:63605       ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       113.222.234.253:26039   ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       222.82.92.2:infolibria  ESTABLISHED
tcp        0   4063 iZ2832m5qa1Z:http       113.118.244.198:21201   ESTABLISHED
tcp        0  11263 iZ2832m5qa1Z:http       222.82.92.2:siebel-ns   ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       117.136.23.13:32643     ESTABLISHED
tcp        0      0 iZ2832m5qa1Z:http       222.82.92.2:ultrabac    ESTABLISHED
tcp        0  16749 iZ2832m5qa1Z:http       124.94.104.65:50974     ESTABLISHED
[root@iZ2832m5qa1Z ~]# 

top - 15:37:34 up  1:08,  3 users,  load average: 0.06, 0.10, 0.11
Tasks: 172 total,   2 running, 170 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.4 us,  1.7 sy,  0.0 ni, 89.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   1016656 total,   488972 used,   527684 free,    30400 buffers
KiB Swap:        0 total,        0 used,        0 free.   107448 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                                                    
 1558 root      20   0   64208   5280   3904 S  0.7  0.5   0:11.14 AliYunDun                                                                                                                  
11417 www       20   0  281096  10020   4076 S  0.7  1.0   0:00.06 httpd                                                                                                                      
11586 www       20   0  282632  11428   4076 S  0.7  1.1   0:00.11 httpd                                                                                                                      
11627 www       20   0  280840   9636   4076 S  0.7  0.9   0:00.02 httpd                                                                                                                      
11817 www       20   0  282632  11408   4076 S  0.7  1.1   0:00.06 httpd                                                                                                                      
11899 www       20   0  282632  11472   4132 S  0.7  1.1   0:00.08 httpd                                                                                                                      
12145 www       20   0  282632  11412   4076 S  0.7  1.1   0:00.06 httpd                                                                                                                      
12160 www       20   0  282632  11468   4132 S  0.7  1.1   0:00.03 httpd                                                                                                                      
12176 www       20   0  282632  11408   4068 S  0.7  1.1   0:00.05 httpd                                                                                                                      
12247 www       20   0  280840   9624   4068 S  0.7  0.9   0:00.02 httpd                                                                                                                      
   24 root      20   0       0      0      0 S  0.3  0.0   0:03.19 rcu_sched                                                                                                                  
   25 root      20   0       0      0      0 R  0.3  0.0   0:06.95 rcuos/0                                                                                                                    
 1174 mysql     20   0  797928  45012   5308 S  0.3  4.4   0:07.13 mysqld                                                                                                                     
 1574 root      20   0   78596   8676   5044 S  0.3  0.9   0:13.55 AliHids                                                                                                                    
11486 www       20   0  282632  11440   4076 S  0.3  1.1   0:00.06 httpd                                                                                                                      
12159 www       20   0  280840   9628   4068 S  0.3  0.9   0:00.01 httpd                                                                                                                      
    1 root      20   0   49552   3652   2292 S  0.0  0.4   0:00.74 systemd                                                                                                                    
    2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd                                                                                                                   
    3 root      20   0       0      0      0 S  0.0  0.0   0:00.07 ksoftirqd/0                                                                                                                
    5 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kworker/0:0H                                                                                                               
    6 root      20   0       0      0      0 S  0.0  0.0   0:00.06 kworker/u30:0                                                                                                              
    7 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0                                                                                                                
    8 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcu_bh                                                                                                                     
    9 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcuob/0                                                                                                                    
   10 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcuob/1                                                                                                                    
   11 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcuob/2           

        HTTP进程超级多,怎么会事,怎么会有那么多人访问啊!受到攻击了?然后问了说确实是很多人。于是判断是高并发导致,于是改下httpd.conf和httpd-mpm.conf配置,有

Timeout 30
KeepAlive On
MaxKeepAliveRequests 80
KeepAliveTimeout 15
<IfModule prefork.c>
    ServerLimit 1024
    StartServers      5
    MinSpareServers   5
    MaxSpareServers   10
    MaxClients       1024
    MaxRequestsPerChild 100
</IfModule> 
<IfModule mpm_prefork_module>
    StartServers            5
    MinSpareServers         5
    MaxSpareServers         10
    MaxClients              1000
    MaxRequestWorkers      1000
    MaxConnectionsPerChild   0
</IfModule>
<IfModule mpm_winnt_module>
    ThreadsPerChild        1000
    MaxConnectionsPerChild   0
</IfModule>

        不过,好像然并卵,访问还是那么慢,很卡。

        同学登陆阿里云一看,服务器的带宽是1M,那么访问经常是900多K。。。

        带宽不足啊,服务器访问一分钟有100个IP吧,不过看了CPU和内存还是OK的啊。

        于是,升级带宽到2M,访问快啦。。。