golang 性能

ha666 · · 1776 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

服务器:

阿里云ECS:1核1G内存,CentOS6.5 x64

 

返回内容:

{"ErrInfo":{"ErrCode":0,"ErrMsg":""},"Result":{"CurrentTime":"2015-10-06 09:46:26"}}

 

在直接用time.Now()返回时间,大约是4550qps,见:Web性能研究-ab压力测试

 

用从redis中请求返回结果:

[root@iZ23n2t9gynZ ~]# ab -n 200000 -c 200 http://127.0.0.1:9090/api/System.GetTime
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 20000 requests
Completed 40000 requests
Completed 60000 requests
Completed 80000 requests
Completed 100000 requests
Completed 120000 requests
Completed 140000 requests
Completed 160000 requests
Completed 180000 requests
Completed 200000 requests
Finished 200000 requests


Server Software:
Server Hostname: 127.0.0.1
Server Port: 9090

Document Path: /api/System.GetTime
Document Length: 84 bytes

Concurrency Level: 200
Time taken for tests: 55.742 seconds
Complete requests: 200000
Failed requests: 1816
(Connect: 0, Receive: 0, Length: 1816, Exceptions: 0)
Write errors: 0
Total transferred: 40176392 bytes
HTML transferred: 16776392 bytes
Requests per second: 3587.96 [#/sec] (mean)
Time per request: 55.742 [ms] (mean)
Time per request: 0.279 [ms] (mean, across all concurrent requests)
Transfer rate: 703.86 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 18 161.9 0 7000
Processing: 0 37 13.2 37 2114
Waiting: 0 37 13.2 37 2114
Total: 1 55 162.8 37 7041

Percentage of the requests served within a certain time (ms)
50% 37
66% 38
75% 39
80% 39
90% 41
95% 43
98% 55
99% 1038
100% 7041 (longest request)

 


有疑问加站长微信联系(非本文作者)

本文来自:博客园

感谢作者:ha666

查看原文:golang 性能

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1776 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传