PHP

2011-07-11 5 views
5

के लिए हिपहॉप पर अपाचे बेंचमार्क हाल ही में मैंने अपाचे बेंचमार्क (एबी) के साथ PHP के लिए हिपहॉप पर एक बेंचमार्क किया है।PHP

मुझे उम्मीद है कि परिणाम के लिए एचआईपीएचओपी सामान्य अपाचे 2 वेब सर्वर से तेजी से चल रहा है, लेकिन यह दूसरी तरफ निकला।

मैं, सर्वर का परीक्षण करने के

<?php 
    $i=0; 
    while($i < 1000000){ 
    echo 'Welcome to HipHop for PHP<br />'; 
    $i++; 
    } 
?> 

इस स्क्रिप्ट का उपयोग और मैं बेंचमार्क को यह अब आदेश का उपयोग करें:

ab -n 500 -c 5 [URL] 

और मैं इस आदेश का उपयोग संकलित करने के लिए:

hphp/एचएफपी hiphop1.php -k 1 -l 3

apache2 सर्वर के लिए बेंचमार्क परिणाम:

[email protected]:~/dev/hiphop-php/doc$ ab -n 500 -c 5 http://localhost/hiphop1.php 
This is ApacheBench, Version 2.3 <$Revision: 655654 $> 
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 
Licensed to The Apache Software Foundation, http://www.apache.org/ 

Benchmarking localhost (be patient) 
Completed 100 requests 
Completed 200 requests 
Completed 300 requests 
Completed 400 requests 
Completed 500 requests 
Finished 500 requests 


Server Software:  Apache/2.2.16 
Server Hostname:  localhost 
Server Port:   80 

Document Path:   /hiphop1.php 
Document Length:  31000000 bytes 

Concurrency Level:  5 
Time taken for tests: 71.024 seconds 
Complete requests:  500 
Failed requests:  0 
Write errors:   0 
Total transferred:  15500095500 bytes 
HTML transferred:  15500000000 bytes 
Requests per second: 7.04 [#/sec] (mean) 
Time per request:  710.240 [ms] (mean) 
Time per request:  142.048 [ms] (mean, across all concurrent requests) 
Transfer rate:   213122.37 [Kbytes/sec] received 

Connection Times (ms) 
       min mean[+/-sd] median max 
Connect:  0 0 0.9  0  19 
Processing: 505 708 61.1 694  960 
Waiting:  0 0 3.3  0  67 
Total:  505 708 61.1 695  960 

Percentage of the requests served within a certain time (ms) 
    50% 695 
    66% 714 
    75% 729 
    80% 736 
    90% 781 
    95% 857 
    98% 898 
    99% 938 
100% 960 (longest request) 

और PHP के लिए HipHop के लिए बेंचमार्क:

[email protected]:~/dev/hiphop-php/doc$ ab -n 500 -c 5 http://localhost:8080/hiphop1.php 
This is ApacheBench, Version 2.3 <$Revision: 655654 $> 
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 
Licensed to The Apache Software Foundation, http://www.apache.org/ 

Benchmarking localhost (be patient) 
Completed 100 requests 
Completed 200 requests 
Completed 300 requests 
Completed 400 requests 
Completed 500 requests 
Finished 500 requests 


Server Software:   
Server Hostname:  localhost 
Server Port:   8080 

Document Path:   /hiphop1.php 
Document Length:  31000000 bytes 

Concurrency Level:  5 
Time taken for tests: 294.546 seconds 
Complete requests:  500 
Failed requests:  0 
Write errors:   0 
Total transferred:  15500052500 bytes 
HTML transferred:  15500000000 bytes 
Requests per second: 1.70 [#/sec] (mean) 
Time per request:  2945.455 [ms] (mean) 
Time per request:  589.091 [ms] (mean, across all concurrent requests) 
Transfer rate:   51390.26 [Kbytes/sec] received 

Connection Times (ms) 
       min mean[+/-sd] median max 
Connect:  0 0 1.6  0  20 
Processing: 1515 2941 579.7 2919 4734 
Waiting:  1452 2626 532.5 2609 4135 
Total:  1515 2941 579.7 2919 4734 

Percentage of the requests served within a certain time (ms) 
    50% 2919 
    66% 3147 
    75% 3334 
    80% 3448 
    90% 3704 
    95% 3937 
    98% 4223 
    99% 4394 
100% 4734 (longest request) 

सवाल है, क्यों HipHop मेरी बेंचमार्क में धीमी चलाने?

क्या स्क्रिप्ट परीक्षण के साथ कुछ गलत है?

+0

सर्वर (विशेष रूप से आउटपुट बफर) को अलग-अलग कॉन्फ़िगर किया जा सकता है। यदि बफर बहुत छोटा है तो इनपुट/आउटपुट ऑपरेशंस की आवश्यकता होती है। – LazyOne

+7

आपका परीक्षण कोड एक विशिष्ट वेब-ऐप वर्कलोड से बहुत दूर है। आधुनिक वेब ऐप्स बहुत ऑब्जेक्ट इंस्टॉलेशन, डेटाबेस आईओ, यूजर इनपुट प्रोसेसिंग इत्यादि कर रहे होंगे। आपके सभी कोड परीक्षण लूपिंग और टेक्स्ट आउटपुट हैं। यह पूरी तरह से संभव है कि हिपॉप सामान्य वास्तविक दुनिया के उपयोग के तहत तेज़ है लेकिन एक या दो बहुत ही विशिष्ट मामलों में धीमा है। – GordonM

+1

वेब अनुप्रयोग बेंचमार्किंग में कोई सुझाव? विशेष रूप से PHP के लिए हिपहॉप? मुझे नहीं पता कि बेंचमार्किंग वेब सर्वर – Kiddo

उत्तर

3

यह एक आम गलतफहमी है कि PHP हिप-हॉप PHP कोड निष्पादन को गति देता है। यह जरूरी नहीं है। फेसबुक ने इसे विकसित किया क्योंकि उनका पूरा मंच दो PHP फाइलों में बनाया गया है, और उन फ़ाइलों को इतनी बार निष्पादित किया जाता है और इतने बड़े हैं कि यह शुद्ध PHP का उपयोग करने में अक्षम होगा।

हिप-हॉप का उपयोग करके केवल PHP के निष्पादन के लिए एक कदम जोड़ रहा है, आपको कभी भी 'सरल' कोड के लिए PHP हिप-हॉप का उपयोग नहीं करना चाहिए।

इसके अलावा, पीएचपी कुछ कार्यों कि मूल रूप से उनके PHP स्क्रिप्ट के साथ में सी + क्रियान्वित कर रहे हैं निष्पादित करता है।

संबंधित मुद्दे

 संबंधित मुद्दे