2012-03-06 19 views
0

私は1GBのVPSを持っており、Apacheは起動からほとんどクロールするのが遅くなります。私はstatic.htmlファイルでApacheBenchを実行したが、状況は変わらなかった。しかし、サイトにはMySQLとPHPの両方があり、大量のAJAXリクエストがあるので、それを調整したいと思います。私は再起動するとhttpd.confで1GBのApacheパフォーマンスチューニング

、エラーログは、ほとんどすぐにこれを示す:

[エラー]サーバーに到達MaxClientsの設定、

ab -n 1000 -c 1000 

ショーMaxClients設定引き上げを検討:

Document Path:   /static.html 
Document Length:  7 bytes 

Concurrency Level:  1000 
Time taken for tests: 57.784 seconds 
Complete requests:  1000 
Failed requests:  64 
    (Connect: 0, Receive: 0, Length: 64, Exceptions: 0) 
Write errors:   0 
Total transferred:  309816 bytes 
HTML transferred:  6552 bytes 
Requests per second: 17.31 [#/sec] (mean) 
Time per request:  57784.327 [ms] (mean) 
Time per request:  57.784 [ms] (mean, across all concurrent requests) 
Transfer rate:   5.24 [Kbytes/sec] received 

Connection Times (ms) 
       min mean[+/-sd] median max 
Connect:  0 25 13.4  25  48 
Processing: 1070 16183 15379.4 9601 57737 
Waiting:  0 14205 15176.5 9591 42516 
Total:  1070 16208 15385.0 9635 57783 

Percentage of the requests served within a certain time (ms) 
    50% 9635 
    66% 20591 
    75% 20629 
    80% 36357 
    90% 42518 
    95% 42538 
    98% 42556 
    99% 42560 
100% 57783 (longest request) 

私はphpファイルでabを実行すると、時には終了します。

Timeout 10 
KeepAlive On 
MaxKeepAliveRequests 100 
KeepAliveTimeout 1 

<IfModule prefork.c> 
StartServers 3 
MinSpareServers 5 
MaxSpareServers 9 
ServerLimit 40 
MaxClients 40 
MaxRequestsPerChild 5000 
</IfModule> 

トップ...(CPUと負荷1分の間に非常に不安定です:時間は、それがないと、時々

apr_socket_recv: Connection reset by peer (104) 

socket: No buffer space available (105) 

のhttpd.confのアイテムのようなエラーを取得しますテスト):

top - 10:44:51 up 11:50, 3 users, load average: 0.17, 0.42, 0.90 
Tasks: 84 total, 2 running, 82 sleeping, 0 stopped, 0 zombie 
Cpu(s): 2.8%us, 3.1%sy, 0.0%ni, 94.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st 
Mem: 1793072k total, 743604k used, 1049468k free,  0k buffers 
Swap:  0k total,  0k used,  0k free,  0k cached 

    PID USER  PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND        
21831 mysql  18 0 506m 71m 6688 S 0.7 4.1 4:03.18 mysqld        
1828 root  15 0 113m 52m 2052 S 0.0 3.0 0:02.85 spamd         
1830 popuser 18 0 113m 51m 956 S 0.0 2.9 0:00.00 spamd         
8012 apache 15 0 327m 35m 17m S 3.7 2.0 0:11.83 httpd         
8041 apache 15 0 320m 28m 15m S 0.0 1.6 0:11.83 httpd         
8022 apache 15 0 321m 27m 14m S 2.3 1.6 0:11.05 httpd         
8033 apache 15 0 320m 27m 14m S 1.7 1.6 0:10.06 httpd 

ここで間違っているのは分かりませんか?トラブルシューティングの次のステップは何ですか?

答えて

3

メモリが不足しているような音がします。プリフォークとMySQLを同じサーバー上で実行しているときは、1GBほどではありません。あなたのMaxClientsは40でなく10-20でなければなりません。

数週間前、私はあなたのサーバーの最大値を決定するのに役立つだろうApache httpdを調整するためのスクリプトを書きました。ウェブログのエントリはhttp://surniaulula.com/2012/11/09/check-apache-httpd-mpm-config-limits/で、スクリプトはGoogle Codeにもあります。

お楽しみください!

js。

+0

提供されたリンクありがとうございます。獲得した+1 –

関連する問題