2010-07-09 4 views
3

입니다. 6 개 코어에 32GB 램이 있습니다. 나는 php5.3 (dotdeb.org에서)와 nginx 0.7.X 및 php5-fpm을했습니다. 중요 설정 파일 :NGINX에서 FastCGI를 통해 PHP에 연결하는 시간은

PHP5-fpm.conf 전부

<value name="listen_address">/tmp/fcgi.sock</value> 
<value name="max_children">1500</value> 
<value name="max_requests">5000</value> 

user www-data; 
worker_processes 2; 
events { 
    worker_connections 4096; 
} 
location ~ \.php$ { 
       fastcgi_pass unix:/tmp/fcgi.sock; 
       fastcgi_index index.php; 
       fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; 
       include fastcgi_params; 
} 

nginx.conf. 아파치 벤치 (ab -n 1000 -c 1000 http://url...) 1000 개의 동시 연결에 대해 250ms의 정적 파일 (크기 10kB)을 요청할 수 있습니다.

Document Path:   /inc/helper-swf.js 
Document Length:  10217 bytes 

Concurrency Level:  1000 
Time taken for tests: 0.278 seconds 
Complete requests:  1000 
Failed requests:  0 
Write errors:   0 
Total transferred:  10448124 bytes 
HTML transferred:  10219896 bytes 
Requests per second: 3600.30 [#/sec] (mean) 
Time per request:  277.755 [ms] (mean) 
Time per request:  0.278 [ms] (mean, across all concurrent requests) 
Transfer rate:   36734.70 [Kbytes/sec] received 

Connection Times (ms) 
       min mean[+/-sd] median max 
Connect:  0 27 11.1  30  41 
Processing: 16 101 57.1 102  215 
Waiting:  15 101 57.1 101  215 
Total:   28 128 56.5 136  235 

Percentage of the requests served within a certain time (ms) 
    50% 136 
    66% 167 
    75% 178 
    80% 184 
    90% 198 
    95% 205 
    98% 220 
    99% 228 
100% 235 (longest request) 

요청이 PHP 파일로 이동하면 이것은 500ms 걸렸습니까 ??? ??? PHP는 아무것도하지 않으며 파일의 첫 번째 줄은 die()입니다.

Document Path:   /test.php 
Document Length:  0 bytes 

Concurrency Level:  1000 
Time taken for tests: 0.501 seconds 
Complete requests:  1000 
Failed requests:  0 
Write errors:   0 
Total transferred:  158000 bytes 
HTML transferred:  0 bytes 
Requests per second: 1996.99 [#/sec] (mean) 
Time per request:  500.754 [ms] (mean) 
Time per request:  0.501 [ms] (mean, across all concurrent requests) 
Transfer rate:   308.13 [Kbytes/sec] received 

Connection Times (ms) 
       min mean[+/-sd] median max 
Connect:  0 28 9.5  29  41 
Processing: 15 365 117.4 395  448 
Waiting:  15 363 117.1 393  448 
Total:   27 393 122.9 425  480 

Percentage of the requests served within a certain time (ms) 
    50% 425 
    66% 434 
    75% 471 
    80% 472 
    90% 473 
    95% 474 
    98% 479 
    99% 479 
100% 480 (longest request) 

PHP 파일을 액세스 할 때 전달 할 내용이 없으면은 TCP (1000 명 동시 접속으로 800ms를 tooks)를 통해 소켓 PHP5-FPM에 Nginx의 상류에서만 존재한다. 뭐가 문제 야? 로그에 힌트가 없습니다. 열린 파일 제한은 32768입니다. php-fpm에서 응답 시간을 조정하는 방법이 있습니까?

답변

2

fastcgi는 PHP 인스턴스도로드합니다. PHP가 뚱뚱해지면 (필요없는 확장 기능), 결과입니다 : 요청 당 더 많은 시간.

내 조언은 다음과 같습니다에만

  • 사용하는 확장자를 가진

    • 재 컴파일 PHP는 APC는
  • +0

    정적 바이너리로 PHP를 컴파일 할 가치가있을 수도 있습니다 버퍼 크기를 증가 설치도 - http://ez.no/developer/blog/php_as_dso_or_as_static_php_module –

    +0

    안녕하세요. 답장을 보내 주셔서 감사합니다. PHP는 dotdeb.org 저장소에서 설치됩니다. 우리는 서버의 자동 설치를 원했기 때문에 직접 구축하는 것을 싫어합니다. APC는 이미 설치되어 있으며 성능이 20 % 향상되었습니다. 어떤 종류의 버퍼를 의미합니까? FastCGI 버퍼? – user387678

    +0

    불필요한 PHP 라이브러리를 설치할 때와 똑같이 제거 할 수 있습니다.'apt-get remove php5-gd php5-mysql php5-memcache ...' – Xeoncross