PHP swoole and nodeJs performance analysis_PHP tutorial
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 |
|
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 |
|
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.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



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

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

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

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

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

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

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

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
