Php asynchronous multi-thread swoole instance program

Source: Internet
Author: User
Swoole redefined the PHP language's high-performance network communication framework and provided the PHP language's asynchronous multithreading service. let's test it in order to prove it. swoole provides PHP asynchronous multi-thread server, asynchronous TCP... swoole redefined the PHP language's high-performance network communication framework and provided the PHP language's asynchronous multithreading service. let's test it in order to prove it.

Swoole provides PHP asynchronous multi-thread server, asynchronous TCP/UDP network client, asynchronous MySQL, database connection pool, AsyncTask, message queue, millisecond timer, asynchronous file read/write, asynchronous DNS query.

Swoole has heard of it before. the server used to play games is simply an artifact... Today, I felt a little bit. I set up an environment in ubuntu and tested it. the test code is as follows:

 Get (12)-> get (); $ this-> swoole-> tpl-> assign ('data', $ data ); $ html = $ this-> swoole-> tpl-> fetch('test.html '); $ time = $ this-> showTime (); return $ html. $ time ;}} shell AB-c 100-n 1000-k http: // 127.0.0.1/index/Requests per second Time per request (mean) Time per request (mean, using SS all concurrent requests) run Swoole EventTCP Swoole SelectTCP Swoole BlockTCP Apache/Prefork single process 571.70 [#/sec] 174.916 [MS] 1.749 [MS] 659.01 [#/sec] 151.743 [MS] 1.517 [MS]] 561.24 [#/sec] 178.178 [MS] 1.782 80.57 1241.083 [MS] 12.411 [MS] 4 process 1153.63 [#/sec] 86.683 [MS] 0.867 [MS] 1010.08 [# /sec] 99.002 [MS] 0.990 [MS] 1094.58 [#/sec] 91.359 [MS] 0.914 [MS]

Apache has such a high efficiency. it will be useful in the future.

Address:

Reprinted at will, but please attach the article address :-)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.