PHP Swoole and Nodejs performance analysis

Source: Internet
Author: User
Tags min connect mysql net php and version

JS out of a nodejs, our technology boss before a period of time sent a technical mail said that PHP support multithreading, asynchronous, Non-blocking also under the banner said to destroy Nodejs, the official website said Swoole performance has at least also and Nodejs can match, this need to use data to speak, On the weekend when the time is convenient to test the two Dongdong! The following is a test report, huh?

First I use the 127.0.0.1:8000 port test swoole, with 127.0.0.1:1337 test Nodejs

There is a picture of the truth: (later, will not use the Mac to save the screenshot!) Sweat! Who's going to teach me, everybody? Programming has become stupid.)

Test environment:

Processor: 2.7GHz i7

Memory: 16GB 1600hz DDR3

System MAC OS X

First put test results:

Test results for 1.PHPswoole:

~mysql? Ab-n 5000-c Http://127.0.0.1:8000/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/B enchmarking 127.0.0.1 (Be patient) Completed requests Completed 1000 requests Completed 1500 requests Completed Equests Completed 2500 Requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 req Uests Completed 5000 requests finished 5000 requests Server Software:server hostname:127.0.0.1 server P ort:8000 document Path:/document length:0 bytes concurrency level:100 time taken fo R tests:1.411 seconds Complete requests:5000 Failed requests:0 Write errors:0 Total Transferre       d:55330 bytes HTML transferred:0 bytes Requests per second:3543.00 [#/sec] (mean) time/request: 28.225 [MS] (MeA) time per request:0.282 [MS] (mean, across all concurrent requests) Transfer rate:38.29 [kbytes/sec] R Eceived Connection times (ms) min MEAN[+/-SD] Median max connect:0 3 1.2 3 7 Pro     Cessing:17 16.7 143 waiting:1 9 12.9 7 136 total:20 28 16.6 26
  143 percentage of the requests served within a certain time (MS) 50% 26 66% 27 75% 27 80% 27 90% 98% 99% 100% 143 (Longest request)

Test results for 2.nodejs:
~mysql? Ab-n 5000-c Http://127.0.0.1:1337/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/B enchmarking 127.0.0.1 (Be patient) Completed requests Completed 1000 requests Completed 1500 requests Completed Equests Completed 2500 Requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 req Uests Completed 5000 requests finished 5000 requests Server Software:server hostname:127.0.0.1 server P ort:1337 document Path:/document length:12 bytes Concurrency level:100 time taken F or tests:1.215 seconds Complete requests:5000 Failed requests:0 Write errors:0 Total Transferr        ed:565000 bytes HTML transferred:60000 bytes Requests per second:4116.49 [#/sec] (mean) time/request: 24.293 [MS] (mean) time/request:0.243 [MS] (mean, across all concurrent requests) Transfer rate:454.26 [Kbytes       /SEC] received Connection times (ms) min MEAN[+/-SD] median max connect:0 0 0.6 0     5 processing:2 21.0 175 waiting:2 20.8 174 24 20.9     175 percentage of the requests served within a certain time (MS) 50% 21 66% 22 75% 23 80% 90% 98% 159 99% 170 100% 175 (Longest request)

In the AB test above: 100 concurrent volumes per second are requested 5,000 times for the interface.

PHP and Nodejs scores are good, the key is Swoole environment I used--debug led to a lot of orders will be output, temporarily will not be changed back, (later in the company test environment again under test)

Time taken for tests:1.411 seconds total time consuming

Requests per second:3543.00 [#/sec] (mean)

Nodejs

Time taken for tests:1.215 seconds total time consuming

Requests per second:4116.49 [#/sec] (mean)

From the test results, although swoole test data slightly less, but this does not affect my view of swoole (and the configuration may not be very good), I think for a C language PHP, this is already more than our current environment is much better.




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.