当前位置:网站首页>PHP FPM, workman, spoole, golang simple performance test
PHP FPM, workman, spoole, golang simple performance test
2022-06-25 19:16:00 【kankan231】
Test environment :
operating system :CentOS Linux release 7.6.1810 (Core) Single core 2G Cloud server
PHP edition :PHP 7.4.21
golang edition :1.17
workerman:4.0.22( already installed event Expand )
swoole:4.7.0
Testing tools :ab ,webbench
Test script
The test script is simple , produce 1000 individual 100-999 The random number , Calculate the sum of random numbers and output
php
$sum = 0;
foreach(range(1,1000) as $i){
$sum += mt_rand(100,1000);
}
echo "sum=$sum";go
package main
import (
"fmt"
"math/rand"
"net/http"
"time"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
var sum int
rand.Seed(time.Now().UnixNano())
for index := 1; index <= 1000; index++ {
sum += rand.Intn(900) + 100
}
w.Write([]byte(fmt.Sprintf("sum=%d", sum)))
})
http.ListenAndServe("127.0.0.1:8000", nil)
}ab test result :
The test command :ab -n 100000 -c 100 http://127.0.0.1: port /
1,php-fpm
Concurrency Level: 100
Time taken for tests: 26.163 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 18900000 bytes
HTML transferred: 1000000 bytes
Requests per second: 3822.12 [#/sec] (mean)
Time per request: 26.163 [ms] (mean)
Time per request: 0.262 [ms] (mean, across all concurrent requests)
Transfer rate: 705.45 [Kbytes/sec] received
2,workerman( Use webman Framework testing )
Concurrency Level: 100
Time taken for tests: 12.198 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 13100000 bytes
HTML transferred: 1000000 bytes
Requests per second: 8198.21 [#/sec] (mean)
Time per request: 12.198 [ms] (mean)
Time per request: 0.122 [ms] (mean, across all concurrent requests)
Transfer rate: 1048.79 [Kbytes/sec] received
3,swoole asynchronous http server
Concurrency Level: 100
Time taken for tests: 11.454 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 15800000 bytes
HTML transferred: 1000000 bytes
Requests per second: 8730.33 [#/sec] (mean)
Time per request: 11.454 [ms] (mean)
Time per request: 0.115 [ms] (mean, across all concurrent requests)
Transfer rate: 1347.06 [Kbytes/sec] received
4,swoole coroutines http server
Concurrency Level: 100
Time taken for tests: 10.579 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 15800000 bytes
HTML transferred: 1000000 bytes
Requests per second: 9453.09 [#/sec] (mean)
Time per request: 10.579 [ms] (mean)
Time per request: 0.106 [ms] (mean, across all concurrent requests)
Transfer rate: 1458.58 [Kbytes/sec] received
5,golang http server
Concurrency Level: 100
Time taken for tests: 11.433 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 12700000 bytes
HTML transferred: 1000000 bytes
Requests per second: 8746.31 [#/sec] (mean)
Time per request: 11.433 [ms] (mean)
Time per request: 0.114 [ms] (mean, across all concurrent requests)
Transfer rate: 1084.75 [Kbytes/sec] received
rps Compare :swoole coroutines http server > golang http server = swoole asynchronous http server > workerman > php-fpm
webbench test result
The test command :webbench -c 100 -t 30 http://127.0.0.1/
1,php-fpm
Benchmarking: GET http://127.0.0.1/test.php
100 clients, running 30 sec.
Speed=210944 pages/min, 664473 bytes/sec.
Requests: 105472 susceed, 0 failed.2,workerman( Use webman Framework testing )
Benchmarking: GET http://127.0.0.1:8787/
100 clients, running 30 sec.
Speed=466696 pages/min, 1018952 bytes/sec.
Requests: 233348 susceed, 0 failed.3,swoole asynchronous http server
Benchmarking: GET http://127.0.0.1:9501/
100 clients, running 30 sec.
Speed=491948 pages/min, 1295463 bytes/sec.
Requests: 245974 susceed, 0 failed.4,swoole coroutines http server
Benchmarking: GET http://127.0.0.1:9502/
100 clients, running 30 sec.
Speed=542284 pages/min, 1428014 bytes/sec.
Requests: 271142 susceed, 0 failed.
5,golang http server
Benchmarking: GET http://127.0.0.1:8000/
100 clients, running 30 sec.
Speed=498384 pages/min, 1054912 bytes/sec.
Requests: 249192 susceed, 0 failed.
webbench Test results and ab almost
The test code is simple , No file IO operation , Database operation, etc , Results are for reference only ,workerman This kind of pure php The performance of the framework is good
边栏推荐
- 广州华锐互动VR全景为各行各业带来发展
- Network security detection and prevention test questions (II)
- QQ机器人:群成员自我禁言管理【最新beta2版本】
- From the perspective of the core competitiveness of ABT, the Internet giant, who fell first
- Is CICC wealth safe? How long does it take to open an account
- [today in history] June 25: the father of notebook was born; Windows 98 release; First commercial use of generic product code
- PostgreSQL change table owner
- Analysis on development scale and development trend of China's night economy industry in 2021 [figure]
- MySQL view explanation
- 五、HikariCP源码分析之初始化分析二
猜你喜欢

One night I worked as an XPath Terminator: XPath Helper Plus

Ali visual AI training camp -day05- creativity day - your image recognition project

wooyun-2014-065513

How to quickly close port 8080

广州华锐互动VR全景为各行各业带来发展

What are Baidu collection skills? 2022 Baidu article collection skills

Miner's Diary: why should I go mining on April 5, 2021

Connecting PHP to MySQL instances in the lamp environment of alicloud's liunx system

Cutting feet to fit shoes - talking about the ramp reconstruction on the track

LeetCode-101-对称二叉树
随机推荐
JS some small problems about adding and accessing values to arrays
Principles of MySQL clustered index and non clustered index
Gbpnzd firm offer for 14 months, simulation for 19 months, test stable
什么是算子?
QQ robot official plug-in loading configuration method [beta2 version]
The meanings of /32, /48, /64 in IPv6 addresses
请问同花顺开户安全吗?
最新数据挖掘赛事方案梳理!
一、HikariCP获取连接流程源码分析一
Ali visual AI training camp -day03- construction of electronic photo album (face and expression recognition)
PHP database connection version1.1
Record Baidu search optimization thinking analysis
Jump jump games auxiliary (manual version) py code implementation
如何快速关闭8080端口
二、HikariCP獲取連接流程源碼分析二
mysql my. Understanding CNF depends on configuration
TCP/IP 测试题(二)
English name of each stage of software version
Kotlin compose terminate todo project Click to edit and modify todo
Shell jump loop shift parameter left use of function