PHP¿ò¼ÜÐÔÄܲâÊÔ±¨¸æ

5年以前  |  阅读数:749 次  |  编程语言:PHP 

×÷Ϊһ¸oPHP¿ª¢Õߣ¬¶øÇÒÊdzo´´ÆoÒµÍŶӵļ¼Êo¿ª¢Õߣ¬Ñ¡Ôñ¿ª*¢¿o¼ÜÊǸoºÜ¼eÄѵÄÊÂÇe¡£

ÓÃThinkPHPµÄ»°£¬ÕÐƸһ¸o¸Õ´ÓÅaѵ»u¹¹³oÀ´µÄ¿ª¢Õ߾ͿÉÒÔÉÏÊÖÁË£¬µ«ÊÇÐÔÄܺͺoÆÚ´uÂe½añiÊǸoÈÃÈËÍÌÛµÄÊÂÇe¡£²»¹ýºÜ¶aµÚÈý½¹¦Äܲ»ÐeÒª×Ô¼ºÐ´£¬ÖÚ¶a´oÅ£ÒѾ­¸øÆ̺ÃÂÁË¡£

ÓÃLaravelµÄ»°£¬´«ËµÐ´ÆðÀ´ºÜˬÀ(C)Õ¹ÐÔÒ²¹»£¬µ«ÊÇѧϰ³É±¾Óеa¸ß£¬×ܲ»Äܸø³o¼¶¿ª¢Õß°e¸oÔµÄʱ¼aȥѧϰ¿o¼Ü°É¡£¶øÇÒ¾Ý˵½­ºþÈËʿ͸Â(C)£¬LaravelÐÔÄܲ»ÔoôÑu£¬ÎĵµÒ²²¢²»ÊÇÌرða¸»¡£

ÓÃYiiµÄ»°£¬Ói¨Óеa†ªa£¬Ç°ºo¶Ë´uÂeÖÀeÓеaСÂe³£¬²»¹ýÐÔÄÜÊÇdz£ºÃµÄ£¬¶øÇÒÒѾ­ÓÐÖÚ¶a¹uÄÚ´o¹«Ë¾ÔÚʹÓÃÁË£¬³oÏÖÒaÍa¿ÉÒÔ¿iËÙµÄÕÒµ½´oÅ£´ðÒɽa»o¡£

²»Èç×o¸o¼oµ¥µÄÐÔÄÜÆÀ²a£¬Ñ¡¸oÐÔÄܳoÉ«µÄ×ܲ»»a³o´i

ÐÔÄܲaÊÔ
²aÊÔʱ¼a£º 2016Äe05ÔÂ06ÈÕ
²aÊÔ¹¤¾ß£º siege (ÒoΪMACϵͳµÄab×ÜÊÇ»a³oÏÖ pr_socket_recv: Connection reset by peer (54) µÄ´iÎo£¬ËuÒÔÑ¡ÔñÁËsiege)
²aÊÔ»uÆ÷£º MacPro Core i5 ´¦ÀiÆ÷/8GBÄÚ´ae/256GB SSDÉÁ´ae
²aÊÔ»¾³£º Apache PHP5.6
¿o¼Ü°ae±¾£º ThinkPHP 3.2.3 Laravel 5.2 Yii2.0.5
²aÊÔÔ­Ôo£º ÿ´Î²aÊÔÑ­»
5´Î£¬È¡ÖеÈÊý¾Ý
²¹³a˵Ã÷£ºËuÓÐÏiÄ¿¶¼ÊÇÈÃÔÚ×ÓĿ¼ÖÐ

½a¹u˵Ã÷


    Transactions:        2119 hits ´¦ÀiÇeÇo×ÜÊýÁ¿
    Availability:        96.85 % ¿ÉÓÃÐÔ
    Elapsed time:        9.74 secs ÔËÐÐʱ¼a
    Data transferred:      1.31 MB Êý¾Ý´«ÊaÁ¿
    Response time:        0.60 secs ÏiӦʱ¼a
    Transaction rate:     217.56 trans/sec ÿÃe´¦ÀiЧÂÊ
    Throughput:        0.13 MB/sec ÿÃe´¦ÀiÊý¾Ý
    Concurrency:       130.28 ²¢*¢
    Successful transactions:    2162 ³É¹¦µÄÇeÇo
    Failed transactions:       69 ʧ°ÜµÄÇeÇo
    Longest transaction:      2.85 ×i³¤µÄµ¥¸oÇeÇo
    Shortest transaction:      0.01 ×i¶ÌµÄµ¥¸oÇeÇo

¿ªÊ¼²aÊÔ

Ôo¼ÓÒ»¸o¿ØÖÆÆ÷£¬²¢ÔÚ¿ØÖÆÆ÷ÖÐÊaÈe10000´ÎHelloWorld

²¢¢50Ñ­»10´Î£º

Ê×ÏÈÏoÎÒÃÇ×ßÀ´µÄÊÇThinkPHP£¬¿´ÉÏÈ¥»¹ÐÐ


    Transactions:         500 hits
    Availability:       100.00 %
    Elapsed time:        2.81 secs
    Data transferred:      52.45 MB
    Response time:        0.26 secs
    Transaction rate:     177.94 trans/sec
    Throughput:        18.67 MB/sec
    Concurrency:        47.10
    Successful transactions:     500
    Failed transactions:        0
    Longest transaction:      0.48
    Shortest transaction:      0.03

È»ºoÊÇLaravle£¬aÅ£¬ÂÔ΢ÓÐÐ(C)ʧÍu


    Transactions:         500 hits
    Availability:       100.00 %
    Elapsed time:        13.33 secs
    Data transferred:      52.45 MB
    Response time:        1.27 secs
    Transaction rate:      37.51 trans/sec
    Throughput:        3.93 MB/sec
    Concurrency:        47.55
    Successful transactions:     500
    Failed transactions:        0
    Longest transaction:      3.64
    Shortest transaction:      0.07

×iºoÈuÇ°±È½Ï¿´ºÃµÄYii


    Transactions:         500 hits
    Availability:       100.00 %
    Elapsed time:        4.84 secs
    Data transferred:      52.45 MB
    Response time:        0.46 secs
    Transaction rate:     103.31 trans/sec
    Throughput:        10.84 MB/sec
    Concurrency:        47.65
    Successful transactions:     500
    Failed transactions:        0
    Longest transaction:      0.88
    Shortest transaction:      0.04

²¢¢200Ñ­»10´Î£º

Ê×ÏÈÊÇThinkPHP


    Transactions:        1977 hits
    Availability:        98.85 %
    Elapsed time:        10.03 secs
    Data transferred:     207.40 MB
    Response time:        0.95 secs
    Transaction rate:     197.11 trans/sec
    Throughput:        20.68 MB/sec
    Concurrency:       187.68
    Successful transactions:    1977
    Failed transactions:       23
    Longest transaction:      1.22
    Shortest transaction:      0.02

È»ºoÊÇLaravel


    Transactions:        1890 hits
    Availability:        94.50 %
    Elapsed time:        51.85 secs
    Data transferred:     198.27 MB
    Response time:        4.88 secs
    Transaction rate:      36.45 trans/sec
    Throughput:        3.82 MB/sec
    Concurrency:       178.00
    Successful transactions:    1890
    Failed transactions:       110
    Longest transaction:      26.01
    Shortest transaction:      0.07

×iºoÊÇYii


    Transactions:        1996 hits
    Availability:        99.80 %
    Elapsed time:        18.95 secs
    Data transferred:     209.39 MB
    Response time:        1.79 secs
    Transaction rate:     105.33 trans/sec
    Throughput:        11.05 MB/sec
    Concurrency:       188.57
    Successful transactions:    1996
    Failed transactions:        4
    Longest transaction:      3.29
    Shortest transaction:      0.10

ûÏeµ½ÔÚûÓÐÓÅ»¯µÄÇe¿oÏ£¬ThinkPHPµÄËÙ¶ÈÊÇ×i¿iµÄ£¬YiiÂÔ΢¶aÒ»Ð(C)£¬Laravel²½ÂÄoçoǵÄÅÜÍeÁ˲aÊÔ¡£½a¹uÊÇÓÐÐ(C)³oÈËÒaÁϵģ¬²»¹ýÉÏÊoµÄ²aÊÔÖ»´u±iÁË¿ª¢»¾³£¬ÏÂÃae»a¶Ô¿o¼Ü½øÐÐÓÅ»¯£¬Ä£ÄaÏßÉÏ»*¾³¡£

ÓÅ»¯¿o¼Ü

ThinkPHP£º


    APP_DEBUG¸ÄΪfalse


Laravel£º


    APP_DEBUG¸ÄΪfalse
    php artisan route:cache
    php artisan optimize
    php artisan config:cache
    composer dumpautoload -o

Yii£º

YII_DEBUG¸ÄΪfalse
composer dumpautoload -o
²¢¢200Ñ­»10´Î£º

ThinkPHP


    Transactions:        1655 hits
    Availability:        82.75 %
    Elapsed time:        8.21 secs
    Data transferred:     173.62 MB
    Response time:        0.69 secs
    Transaction rate:     201.58 trans/sec
    Throughput:        21.15 MB/sec
    Concurrency:       139.29
    Successful transactions:    1655
    Failed transactions:       345
    Longest transaction:      7.83
    Shortest transaction:      0.00

Laravel:


    Transactions:        1520 hits
    Availability:        76.00 %
    Elapsed time:        34.95 secs
    Data transferred:     159.45 MB
    Response time:        3.15 secs
    Transaction rate:      43.49 trans/sec
    Throughput:        4.56 MB/sec
    Concurrency:       136.84
    Successful transactions:    1520
    Failed transactions:       480
    Longest transaction:      19.18
    Shortest transaction:      0.00

Yii:


    Transactions:        1704 hits
    Availability:        85.20 %
    Elapsed time:        15.16 secs
    Data transferred:     178.76 MB
    Response time:        1.46 secs
    Transaction rate:     112.40 trans/sec
    Throughput:        11.79 MB/sec
    Concurrency:       164.21
    Successful transactions:    1704
    Failed transactions:       296
    Longest transaction:      9.04
    Shortest transaction:      0.00

±È½ÏÆae¹ÖµÄÒ»µa£¬µ±¿o¼Ü¹Øµoµ÷ÊÔģʽºo¶¼³oÏÖÁ˽϶aʧ°ÜµÄÇe¿o¡£²»¹ýÃ÷ÏԵĿ´µ½£¬Laravel½øÐмoµ¥µÄÓÅ»¯ºo£¬ÐÔÄÜ´o´oµÄÌaÉýÁË£¬µ«»¹ÊǵÍÓÚÆaËuÁ½¸o¿o¼Ü¡£

½aÂÛ

ÔÚ²aÊԵĹý³ÌÖУ¬ÆaËuÎÒµÄÐÄÇeÊǾÚÉ¥µÄ£¬¸Ð¾o×Ô¼ºµÄÈý¹ÛÊÀ½çÒѾ­±ÀËuÁË£¬±ÀËuÖÁÔu¡£

ThinkPHPµÄÐÔÄܱÈYii¸ß³oÒ»±¶£¬±ÈLaravel¸ß³o½uËı¶
YiiµÄÐÔÄܱȽÏÖÐÓ¹£¬µ«ÊÇÔÚ²aÊÔÖлaÃ÷ÏÔ*¢ÏÖÇeÇoʧ°ÜµÄÇe¿o±ÈÆaËuÁ½¸o¿o¼ÜÒªÉÙ
LaravelÒÀ¾ÉÓÅÑÅ£¬²»¹ýÐÔÄÜ¿°ÓÇ£¬ÓÃÍøÓѵĻ°ÐÎÈݱȽϺà ѧ֮ÕßÉuÓÃÖ®ÕßËÀ

×iºo

ÎÒµÄÏiÄ¿×iºoʹÓÃÁË×Ô½¨¿o¼Ü½øÐпª¢£¬µÃÒaeÓÚcomposerµÄÇ¿´o£¬¿ª¢µÄ¹ý³Ìdz£Ë³Àu£¬×iºo¸½ÉÏ×ÔÓпo¼ÜÔÚ200²¢¢10´ÎÑ­»*µÄÊý¾Ý£¬¿o¼Ü¿ªÔ´µ«ÊǸuбȽÏ棬»¶Ó­ÔÚgithubÉÏËÑË÷PPPHP£¬ºÍÎÒÒ»Æð´i½¨¿o¼Ü¡£


    Transactions:        1672 hits
    Availability:        83.60 %
    Elapsed time:        6.18 secs
    Data transferred:     175.40 MB
    Response time:        0.57 secs
    Transaction rate:     270.55 trans/sec
    Throughput:        28.38 MB/sec
    Concurrency:       153.16
    Successful transactions:    1672
    Failed transactions:       328
    Longest transaction:      4.57
    Shortest transaction:      0.01

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8