This is a creation in
Article, where the information may have evolved or changed.
This is a Hyper-V virtual machine with a single core of 1G memory that I have opened, first we use the language and framework version to show you:
root@kerisy:/home/zoujiaqing# go versiongo version go1.5.1 linux/amd64root@kerisy:/ home/zoujiaqing# ldc2 --versionldc - the llvm d compiler (0.15.0): based on dmd v2.066.1 and llvm 3.5.0 default target: x86_64-pc-linux-gnu Host CPU: core-avx2 http://dlang.org - http://wiki.dlang.org/ldc registered targets: aarch64 - AArch64 (Little endian) aarch64_be - AArch64 (big endian) arm - ARM arm64 - AArch64 (Little endian) arm64_be - AArch64 (Big endian) armeb - ARM (Big endian) cpp - C++ backend hexagon - Hexagon mips - Mips mips64 - mips64 [experimental] mips64el - mips64el [experimental] mipsel - mipsel msp430 - MSP430 [experimental] nvptx - NVIDIA PTX 32-bit nvptx64 - NVIDIA PTX 64-bit ppc32 - PowerPC 32 ppc64 - powerpc 64 ppc64le - powerpc 64 le r600 - amd gpus hd2xxx-hd6xxx sparc - Sparc sparcv9 - sparc v9 systemz - systemz thumb - thumb thumbeb - Thumb (Big endian) x86 - 32-bit X86: Pentium-Pro and above x86-64 - 64-bit X86: EM64T and AMD64 xcore - xcoreroot@kerisy:/home/zoujiaqing# nodejsnodejsroot@kerisy:/home/ Zoujiaqing# nodejs --versionv4.2.2root@kerisy:/home/zoujiaqing# php --versionphp 5.6.14-1 (CLI) Copyright (c) 1997-2015 The PHP GroupZend Engine v2.6.0, Copyright (c) 1998-2015 zend technologies with zend opcache v7.0.6-dev , copyright (c) 1999-2015, by zend technologies
You can see the corresponding version:
golang:1.5.1
Dlang (LDC2): 2.066.1
nodejs:4.2.2
php:4.6.14
Golang Code:
Package Mainimport ("io" "net/http" "Log") Func HelloServer (w http. Responsewriter, req *http. Request) {io. WriteString (W, "Hello, world!\n")}func Main () {http. Handlefunc ("/hello", HelloServer) Err: = http. Listenandserve (": 1234", nil) if err! = Nil {log. Fatal ("Listenandserve:", Err)}}
Dlang Code:
Import Std.stdio;import kerisy.http.server;import kerisy.utils;import kerisy.net;int main (string[] args) {Address Address = Address ("0.0.0.0", 9999); Httpserver Server = new Httpserver;server.listen (address); return 0;}
Nodejs Code:
var http = require (' http '), var url = require (' URL '), Http.createserver (function (req, res) {var path = Url.parse (req. URL). Pathname; var dt=new Date (); Res.writehead ($, {' Content-type ': ' Text/plain '}); Res.write ("Hello,world! \ n "+dt.gettime ()); Res.end ();}). Listen (8888, "127.0.0.1");
PHP Code:
#! /usr/bin/env Php<?phprequire __dir__. '/vendor/autoload.php '; $app = require_once __dir__. '/application/bootstrap.php '; $status = $app->handleconsole (new symfony\component\console\input\argvinput, new Sy Mfony\component\console\output\consoleoutput); exit ($status);
The results of the operation are as follows:
Root@kerisy:/home/zoujiaqing# ab -n 10000 -c 1000 http://127.0.0.1:9999/this is ApacheBench, Version 2.3 < $Revision: 1706008 $>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 1000 requestscompleted 2000 requestscompleted 3000 requestsCompleted 4000 requestsCompleted 5000 requestsCompleted 6000 requestscompleted 7000 requestscompleted 8000 requestscompleted 9000 requestscompleted 10000 requestsfinished 10000 requestsserver software: Server Hostname: 127.0.0.1server port: 9999document path: /Document Length: 15 bytesconcurrency level: 1000time taken for tests: 0.760 secondsComplete requests: 10000Failed requests: 0total transferred: 1170000 bytesHTML transferred: 150000 bytesrequests per second: 13152.77 [#/sec] (mean) Time per request: 76.030 [ms] (mean) time per request : 0.076 [ms] (mean, across all concurrent requests) transfer rate: 1502.81 [kbytes/sec] receivedconnection times (MS) min mean[+/-sd] median maxconnect: 0 2 5.0 1 25Processing: 2 12 6.9 10 215waiting: 2 10 6.5 9 213total: 3 15 9.9 11 217percentage of the requests served within a certain time (MS) 50% 11 66% 14 75% 17 80% 19 90% 23 95% 42 98% 45 99% 48 100% 217 (longest request) root@kerisy:/home/zoujiaqing# ab -n 10000 -c 1000 http://127.0.0.1:1234/this is apachebench, version 2.3 <$ Revision: 1706008 $>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 1000 requestscompleted 2000 requestscompleted 3000 requestscompleted 4000 requestscompleted 5000 requestscompleted 6000 requestscompleted 7000 requestscompleted 8000 requestscompleted 9000 requestsCompleted 10000 requestsFinished 10000 requestsServer Software: Server Hostname: 127.0.0.1Server Port: 1234document path: /document length: 19 bytesConcurrency Level: 1000time taken for tests: 1.039 secondscomplete requests : 10000failed requests: 0non-2xx responses: 10000total transferred: 1760000 byteshtml transferred: 190000 bytesrequests per second: 9622.04 [#/sec] (mean) time per request: 103.928 [ms] (mean) time per request: 0.104 [ms] (mean, across all concurrent requests) Transfer rate: 1653.79 [kbytes/sec] receivedconnection Times (MS) min mean[+/-sd] median maxConnect: 0 18 17.6 16 50processing: 0 28 18.4 24 217Waiting: 0 22 13.3 19 217Total: 0 46 33.6 46 217percentage of the requests served within a certain time (MS) 50% 46 66% 60 75% 75 80% 84 90% 95 95% 99 98% 112 99% 117 100% 217 (longest Request) root@kerisy:/home/zoujiaqing# ab -n 10000 -c 1000 http://127.0.0.1:8888/this is apachebench, version 2.3 < $Revision: 1706008 $>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 1000 requestscompleted 2000 requestscompleted 3000 requestscompleted 4000 requestscompleted 5000 requestscompleted 6000 requestscompleted 7000 requestscompleted 8000 requestscompleted 9000 requestscompleted 10000 requestsfinished 10000 requestsserver software: Server Hostname: 127.0.0.1server port: 8888document path: /Document Length: 28 bytesConcurrency level: 1000time taken for tests: 1.827 secondsComplete requests: 10000Failed requests: 0Total transferred: 1290000 byteshtml transferred: 280000 bytesrequests per second: 5474.02 [#/sec] (mean) time per request: 182.681 [ms] (mean) time per request: 0.183 [ms] (mean, across all concurrent requests) Transfer rate: 689.60 [Kbytes/sec] receivedConnection Times (MS) &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;MIN&NBSP;&NBSP;MEAN[+/-SD] median maxconnect: 0 13 113.4 0 998Processing: 12 24 30.8 20 428waiting: 12 24 30.8 20 428total: 12 38 136.7 20 1425percentage of the requests served within a certain time (MS) 50% 20 66% 22 75% 24 80 % 25 90% 28 95% 32 98% 61 99% 1026 100% 1425 (longest request) root@kerisy:/home/zoujiaqing# ab -n 10000 -c 1000 http://127.0.0.1:8080/this is apachebench, version 2.3 <$ Revision: 1706008 $>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 1000 requestscompleted 2000 requestscompleted 3000 requestscompleted 4000 requestscompleted 5000 requestscompleted 6000 requestscompleted 7000 requestscompleted 8000 requestscompleted 9000 requestsCompleted 10000 requestsFinished 10000 requestsServer software: swoole-http-serverserver hostname: 127.0.0.1Server Port: 8080document path: / Document length: 12 bytesconcurrency level: 1000Time taken for tests: 1.466 secondscomplete requests: 10000failed requests: 0Total transferred: 1600000 Byteshtml transferred: 120000 bytesrequests per second: 6819.48 [#/sec] (mean) time per request: 146.639 [ms] (mean) time per request: 0.147 [ms] (mean, across all concurrent requests) transfer rate: 1065.54 [Kbytes/sec] receivedConnection Times (MS) min mean[+/-sd] median maxconnect: 23 59 11.5 60 89processing: 24 84 23.3 79 156waiting: 20 60 15.2 59 110Total: 82 143 24.4 139 207percentage of the requests served within a certain time (MS) 50% 139 66% 150 75% 155 80% 160 90% 174 95% 191 98% 204 99% 205 100% 207 ( Longest request)
According to this AB test results to see the worst performance is Nodejs, the best is the Dlang framework, followed by the Golang HTTP module, PHP worker framework performance is still possible, I believe PHP7 can have a lot of promotion after.
golang:9622 QPS
dlang:13152 QPS
nodejs:5474 QPS
php:6819 QPS