किया है मैं CentOS 6.3 पर इस परीक्षण पूरा कर लिया है nginx 1.2.7
, apache 2.4.3
और php 5.4.12
का उपयोग करके सभी को डिफ़ॉल्ट रूप से कोई बदलाव नहीं मिला है।
./configure
make && make install
php के अपवाद मैं कहाँ सक्षम php-एफ पी एम
./configure --enable-fpm
साथ
सभी सर्वर के रूप में नीचे उल्लिखित को छोड़कर 100% डिफ़ॉल्ट config है। सभी परीक्षण परीक्षण सर्वर पर किए गए थे, परीक्षण के बीच कोई लोड और रीबूट नहीं था।
<?php
$testing = 0;
for ($i = 0; $i < 1000; $i++) {
$testing++;
}
echo $testing;
मैं भी: सर्वर एक इंटेल (आर) जिऑन (आर) सीपीयू E3-1230 है, RAID में 1GB RAM और 2 एक्स 60GB SSD 1. टेस्ट ab -n 50000 -c 500 http://127.0.0.1/test.php
टेस्ट PHP स्क्रिप्ट का उपयोग कर चलाए गए nginx.conf
में php को सक्षम करना था क्योंकि यह डिफ़ॉल्ट रूप से सक्षम नहीं है।
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
Nginx - पीएचपी-एफ पी एम पर 127.0.0.1:9000
Concurrency Level: 500
Time taken for tests: 10.932 seconds
Complete requests: 50000
Failed requests: 336
(Connect: 0, Receive: 0, Length: 336, Exceptions: 0)
Write errors: 0
Non-2xx responses: 336
Total transferred: 7837824 bytes
HTML transferred: 379088 bytes
Requests per second: 4573.83 [#/sec] (mean)
Time per request: 109.317 [ms] (mean)
Time per request: 0.219 [ms] (mean, across all concurrent requests)
Transfer rate: 700.17 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 34 338.5 0 7000
Processing: 0 34 166.5 23 8120
Waiting: 0 34 166.5 23 8120
Total: 13 68 409.2 23 9846
Percentage of the requests served within a certain time (ms)
50% 23
66% 28
75% 32
80% 33
90% 34
95% 46
98% 61
99% 1030
100% 9846 (longest request)
Nginx - पीएचपी-एफ पी एम सॉकेट के माध्यम से (fastcgi_pass को config परिवर्तन)
fastcgi_pass unix:/var/lib/php/php.sock;
Concurrency Level: 500
Time taken for tests: 7.054 seconds
Complete requests: 50000
Failed requests: 351
(Connect: 0, Receive: 0, Length: 351, Exceptions: 0)
Write errors: 0
Non-2xx responses: 351
Total transferred: 7846209 bytes
HTML transferred: 387083 bytes
Requests per second: 7087.70 [#/sec] (mean)
Time per request: 70.545 [ms] (mean)
Time per request: 0.141 [ms] (mean, across all concurrent requests)
Transfer rate: 1086.16 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 26 252.5 0 7001
Processing: 0 24 112.9 17 3683
Waiting: 0 24 112.9 17 3683
Total: 7 50 306.4 17 7001
Percentage of the requests served within a certain time (ms)
50% 17
66% 19
75% 20
80% 21
90% 23
95% 31
98% 55
99% 1019
100% 7001 (longest request)
अपाचे - mod_php
Concurrency Level: 500
Time taken for tests: 10.979 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 9800000 bytes
HTML transferred: 200000 bytes
Requests per second: 4554.02 [#/sec] (mean)
Time per request: 109.793 [ms] (mean)
Time per request: 0.220 [ms] (mean, across all concurrent requests)
Transfer rate: 871.67 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 22 230.2 1 7006
Processing: 0 58 426.0 18 9612
Waiting: 0 58 425.9 18 9611
Total: 5 80 523.8 19 10613
Percentage of the requests served within a certain time (ms)
50% 19
66% 23
75% 25
80% 26
90% 31
95% 36
98% 1012
99% 1889
100% 10613 (longest request)
मैं धुन से खुश रहूंगा अपाचे आगे, लेकिन ऐसा लगता है कि अपाचे बस नहीं रह सकता है। स्पष्ट विजेता सॉकेट के माध्यम से php-fpm के साथ nginx है।
"बस PHP को संसाधित करना" न तो mod_php और न ही php-fpm php प्रोसेसिंग स्वयं करता है। वे सिर्फ एक एम्बेड दुभाषिया कहते हैं जो उनके लिए सभी नौकरी करता है। और दोनों मामलों में PHP दुभाषिया समान है। – VBart
नहीं, यह पूरी तरह से नहीं, या अधिक सटीक नहीं है। पहले मामले में दुभाषिया को अपाचे के लिए मॉड्यूल के रूप में बनाया गया है, जिसका अर्थ है कि यह मूल रूप से अपाचे के अंदर चल रहा है, इसके हिस्से के रूप में, जबकि दूसरा एफपीएम है, जो एक फास्टसीजीआई सेवा है जिसे थोड़ी देर के लिए PHP के साथ भेज दिया गया है। हालांकि उत्तर में स्पष्ट रूप से nginx और FPM सर्वर के बीच संचार समय शामिल होगा, जो इस मामले में प्रसंस्करण समय का हिस्सा है। क्षमा करें अगर प्रश्न पूरी तरह स्पष्ट नहीं था। – petermolnar