2012-03-06 2 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를 실행하면 가끔 완료되지만 대부분의 시간은하지 않습니다 때로는

apr_socket_recv: Connection reset by peer (104) 

socket: No buffer space available (105) 

을 httpd.conf 항목과 같은 오류를 가져옵니다

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 분은 동안 매우 불규칙적이다 테스트) :

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을 사용하여 PHP를 실행하는 경우 1GB는 그리 많지 않습니다. 귀하의 MaxClients는 40 대가 아닌 10-20 일 것입니다.

몇 주 전에 저는 서버의 최대 값을 결정하는 데 도움이되는 Apache httpd를 조정하는 스크립트를 작성했습니다. 웹 로그 항목은 http://surniaulula.com/2012/11/09/check-apache-httpd-mpm-config-limits/이며 스크립트는 Google 코드에도 있습니다.

즐기십시오!

js.

+0

제공된 링크, +1을 얻은 주셔서 감사합니다. –

관련 문제