这是我本机开的一个单核1G内存的Hyper-V虚拟机,首先我们使用的语言和框架版本给大家看一下:

root@kerisy:/home/zoujiaqing# go version

go version go1.5.1 linux/amd64

root@kerisy:/home/zoujiaqing# ldc2 --version

LDC - 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      - XCore

root@kerisy:/home/zoujiaqing# nodejs

nodejs

root@kerisy:/home/zoujiaqing# nodejs --version

v4.2.2

root@kerisy:/home/zoujiaqing# php --version

PHP 5.6.14-1 (cli)

Copyright (c) 1997-2015 The PHP Group

Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

可以看到对应的版本:

golang: 1.5.1

dlang(ldc2): 2.066.1

nodejs: 4.2.2

php: 4.6.14

golang代码:

package main

import (

"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代码:

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代码:

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(200, {'Content-Type': 'text/plain'});

res.write("Hello,World ! \n"+dt.getTime());

res.end();}).listen(8888, "127.0.0.1");

php代码:

#! /usr/bin/env php

require __DIR__ . '/vendor/autoload.php';

$app = require_once __DIR__ . '/application/bootstrap.php';

$status = $app->handleConsole(

new Symfony\Component\Console\Input\ArgvInput,

new Symfony\Component\Console\Output\ConsoleOutput

);

exit($status);

运行结果如下:

root@kerisy:/home/zoujiaqing# ab -n 10000 -c 1000 http://127.0.0.1:9999/

This is ApacheBench, Version 2.3

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 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests

Server Software:

Server Hostname:        127.0.0.1

Server Port:            9999

Document Path:          /

Document Length:        15 bytes

Concurrency Level:      1000

Time taken for tests:   0.760 seconds

Complete requests:      10000

Failed requests:        0

Total transferred:      1170000 bytes

HTML transferred:       150000 bytes

Requests 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] received

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:        0    2   5.0      1      25

Processing:     2   12   6.9     10     215

Waiting:        2   10   6.5      9     213

Total:          3   15   9.9     11     217

Percentage 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

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 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests

Server Software:

Server Hostname:        127.0.0.1

Server Port:            1234

Document Path:          /

Document Length:        19 bytes

Concurrency Level:      1000

Time taken for tests:   1.039 seconds

Complete requests:      10000

Failed requests:        0

Non-2xx responses:      10000

Total transferred:      1760000 bytes

HTML transferred:       190000 bytes

Requests 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] received

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:        0   18  17.6     16      50

Processing:     0   28  18.4     24     217

Waiting:        0   22  13.3     19     217

Total:          0   46  33.6     46     217

Percentage 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

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 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests

Server Software:

Server Hostname:        127.0.0.1

Server Port:            8888

Document Path:          /

Document Length:        28 bytes

Concurrency Level:      1000

Time taken for tests:   1.827 seconds

Complete requests:      10000

Failed requests:        0

Total transferred:      1290000 bytes

HTML transferred:       280000 bytes

Requests 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] received

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:        0   13 113.4      0     998

Processing:    12   24  30.8     20     428

Waiting:       12   24  30.8     20     428

Total:         12   38 136.7     20    1425

Percentage 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

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 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests

Server Software:        swoole-http-server

Server Hostname:        127.0.0.1

Server Port:            8080

Document Path:          /

Document Length:        12 bytes

Concurrency Level:      1000

Time taken for tests:   1.466 seconds

Complete requests:      10000

Failed requests:        0

Total transferred:      1600000 bytes

HTML transferred:       120000 bytes

Requests 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] received

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:       23   59  11.5     60      89

Processing:    24   84  23.3     79     156

Waiting:       20   60  15.2     59     110

Total:         82  143  24.4    139     207

Percentage 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)

按照这个ab测试结果来看性能最差的是nodejs,最好的是dlang的框架,其次是golang的http模块,php的worker框架性能还是可以的,相信php7出来以后还能有很多提升。

golang:  9622 qps

dlang: 13152 qps

nodejs: 5474 qps

php: 6819 qps

golang php mysql性能_golang vs dlang vs nodejs vs php 性能对比较量相关推荐

  1. golang mysql 回调_Golang操作MySQL的正确姿势

    封装原因: 查看了很多网上提供的ORM类型的数据库操作,觉得比较麻烦,需要提前配置很多的表结构体,然后才能使用,对于数据表很多的项目就配置起来就比较麻烦,所以对golang的mysql包进行了外层包装 ...

  2. go mysql存储过程_Golang 调用MySQL存储过程

    Golang 调用MySQL存储过程 最近写项目发现,很多逻辑业务的实现,写到数据库的存储过程中,然后调用,真的非常方便.后端代码量大大减少,最重要的是性能高,速度快! 引用说明:项目使用数据库ORM ...

  3. Golang 调用MySQL存储过程

    原创:转载请标明出处: https://blog.csdn.net/ming2316780/article/details/86499344 本文出自:[iGoogle.ink的博客] Golang ...

  4. mysql序列号生成_忘掉 Snowflake,感受一下性能高出587倍的全局唯一ID生成算法

    今天我们来拆解 Snowflake 算法,同时领略百度.美团.腾讯等大厂在全局唯一 ID 服务方面做的设计,接着根据具体需求设计一款全新的全局唯一 ID 生成算法.这还不够,我们会讨论到全局唯一 ID ...

  5. Mysql中where条件一个单引号引发的性能损耗

    日常写SQL中可能会有一些小细节忽略了导致整个sql的性能下降了好几倍甚至几十倍,几百倍.以下这个示例就是mysql语句中的一个单引号('')引发的性能耗损,我相信很多朋友都遇到过,甚至还在这样写. ...

  6. golang操作mysql用例

    ❤️强烈推荐人工智能学习网站❤️ golang操作mysql的demo,直接上代码 package mainimport ("database/sql""fmt" ...

  7. golang操作mysql

    后台开发语言访问数据库,下面看一下golang访问mysql的常见API. sql.Open() //连接数据库 db.Query() //查询 db.QueryRow() //查询一行 db.Exe ...

  8. golang mysql商业用例_完美起航-golang操作mysql用例

    golang操作mysql的demo,直接上代码 package main import ( "database/sql" "fmt" _ "gith ...

  9. 数据库性能优化—MySQL单表最大记录数超过多少时性能会严重下降

    以前没有想过MySQL数据库的单表最大行数,直到最近interview时被问到c语言中int类型的最大值是多少时才想到Mysql单表最大行数的问题. 一开始被问到C语言中int类型的最大值有点懵逼,一 ...

  10. 监控mysql业务数据分析_MySQL数据库监控指标之执行性能总结

    查询性能 MySQL 用户监控查询延迟的方式有很多,既可以通过 MySQL 内置的指标,也可以通过查询性能模式.从 MySQL 5.6.6 版本开始默认启用,MySQL 的 performance_s ...

最新文章

  1. python中notebook_Jupyter Notebook--学习python必不可少的工具
  2. Lifecycle Activity和Fragment生命周期感知组件 LifecycleObserver MD
  3. python 和php的数据通信_python服务端 和 php客户端通信一
  4. mysql --verbose --help
  5. xgboost分类器直接调用验证集的评估结果
  6. java面向对象编程集合边框_Java学习系列(七)Java面向对象之集合框架详解(上)
  7. c char转int_c/c++基础之sizeof用法
  8. Atitit.ati dwr的原理and设计 attilax 总结 java php 版本
  9. 电视视频直播在线播放网站PHP源码V1.2
  10. 《MySQL数据操作与查询》- 综合项目 - 学生管理系统
  11. 格林第一季/全集Grimm迅雷下载
  12. HTML中的SEO优化
  13. 算法——重构字符串使得相邻字符不同
  14. SQL server 实验五 (sql 查询语句)
  15. [转]稳定排序和不稳定排序
  16. 模拟IIC读取SHT30温湿度传感器数据
  17. 【Spring】Spring MVC原理及配置详解
  18. exfat fat_正确的名称是exFAT还是FAT64?
  19. 颠覆IoT行业的开发神器!涂鸦智能重磅推出TuyaOS操作系统【程序员必备】
  20. ssh、git环境配置

热门文章

  1. 计算机无法关机 总是自动启动不了怎么办,电脑不能关机,小编教你电脑关机后总是重启怎么办...
  2. BZOJ4049][CERC2014]Mountainous landscape-[线段树+凸包+二分]
  3. 图文并茂讲VLAN,让你看一遍就理解VLAN
  4. 火狐怎么导入旧的火狐数据_如何与Firefox分手
  5. php 创建临时id_使用PHP创建ID3标签阅读器
  6. 【linux内核分析与应用-陈莉君】动手实践--内核多任务并发实例
  7. 一对一语音视频直播双端原生APP源码/thinkphp后台源码/社交交友语音视频聊天即时通信APP源码
  8. vs code快捷键
  9. javacpp-opencv图像处理系列:国内车辆牌照检测识别系统(万份测试车牌识别准确率99.7%以上,单次平均耗时39ms)...
  10. gitter 卸载_最佳Gitter渠道:材料设计