Home Backend Development PHP Tutorial PHP swoole and nodeJs performance analysis_PHP tutorial

PHP swoole and nodeJs performance analysis_PHP tutorial

Jul 13, 2016 am 10:35 AM
php swoole and

js has a nodejs. Our technical boss sent a technical email some time ago saying that php supports multi-threading, asynchronous, and non-blocking. He also said that nodejs would be destroyed. The official website said that the performance of swoole is at least as good as Nodejs is comparable. This requires data to speak for itself. I tested these two things when I had time on the weekend! Below is the test report.

First I used port 127.0.0.1:8000 to test swoole and 127.0.0.1:1337 to test nodejs

There are pictures and the truth: (I will upload it later, I don’t know how to save screenshots on Mac! Sigh! Can any of you viewers teach me how to do it! Programming has become stupid)

Test environment:

Processor: 2.7GHz i7

Memory: 16GB 1600hz DDR3

System MAC OS X

The test results will be posted first:

1.PHPswoole test results:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

~mysql|? ab -n 5000 -c 100 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/

 

Benchmarking 127.0.0.1 (be patient)

Completed 500 requests

Completed 1000 requests

Completed 1500 requests

Completed 2000 requests

Completed 2500 requests

Completed 3000 requests

Completed 3500 requests

Completed 4000 requests

Completed 4500 requests

Completed 5000 requests

Finished 5000 requests

 

 

Server Software:       

Server Hostname:        127.0.0.1

Server Port:            8000

 

Document Path:          /

Document Length:        0 bytes

 

Concurrency Level:      100

Time taken for tests:   1.411 seconds

Complete requests:      5000

Failed requests:        0

Write errors:           0

Total transferred:      55330 bytes

HTML transferred:       0 bytes

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

Time per request:       28.225 [ms] (mean)

Time per request:       0.282 [ms] (mean, across all concurrent requests)

Transfer rate:          38.29 [Kbytes/sec] received

 

Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        0    3   1.2      3       7

Processing:    17   25  16.7     23     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%     28

  95%     29

  98%    141

  99%    142

 100%    143 (longest request)

Copy after login

2.nodejs test results:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

~mysql|? ab -n 5000 -c 100 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/

 

Benchmarking 127.0.0.1 (be patient)

Completed 500 requests

Completed 1000 requests

Completed 1500 requests

Completed 2000 requests

Completed 2500 requests

Completed 3000 requests

Completed 3500 requests

Completed 4000 requests

Completed 4500 requests

Completed 5000 requests

Finished 5000 requests

 

 

Server Software:       

Server Hostname:        127.0.0.1

Server Port:            1337

 

Document Path:          /

Document Length:        12 bytes

 

Concurrency Level:      100

Time taken for tests:   1.215 seconds

Complete requests:      5000

Failed requests:        0

Write errors:           0

Total transferred:      565000 bytes

HTML transferred:       60000 bytes

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

Time per request:       24.293 [ms] (mean)

Time per 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   24  21.0     21     175

Waiting:        2   24  20.8     21     174

Total:          6   24  20.9     21     175

 

Percentage of the requests served within a certain time (ms)

  50%     21

  66%     22

  75%     23

  80%     24

  90%     26

  95%     32

  98%    159

  99%    170

 100%    175 (longest request)

Copy after login

In the ab test above: a concurrency of 100 per second made a total of 5,000 requests to the interface.

The results of PHP and nodejs are pretty good. The key is that I used --debug in the Swoole environment, which resulted in a lot of commands being output. I will not change it back for the time being. (I will retest it in the company's test environment later)

Time taken for tests: 1.411 seconds Total time spent

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

nodeJS

Time taken for tests: 1.215 seconds Total time spent

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

Judging from the test results, although the test data of swoole is slightly inferior, it does not affect my opinion of swoole (besides, the configuration may not be very good). I feel that for a PHP written in C language, this It’s already much better than our current environment.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/742409.htmlTechArticlejs has a nodejs. Our technical boss sent a technical email some time ago saying that php supports multi-threading and asynchronous. Non-blocking also claims to destroy nodejs. The official website says that the performance of swoole...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP Working with Database CakePHP Working with Database Sep 10, 2024 pm 05:25 PM

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

CakePHP Logging CakePHP Logging Sep 10, 2024 pm 05:26 PM

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

See all articles