服务器:

阿里云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)

golang 性能的更多相关文章

  1. 通过 profiling 定位 golang 性能问题 - 内存篇 原创 张威虎 滴滴技术 2019-08-02

    通过 profiling 定位 golang 性能问题 - 内存篇 原创 张威虎 滴滴技术 2019-08-02

  2. Golang 性能优化实战

    小结: 1. 性能查看工具 pprof,trace 及压测工具 wrk 或其他压测工具的使用要比较了解. 代码逻辑层面的走读非常重要,要尽量避免无效逻辑. 对于 golang 自身库存在缺陷的,可以寻 ...

  3. golang 性能调优分析工具 pprof (上)

    一.golang 程序性能调优 在 golang 程序中,有哪些内容需要调试优化? 一般常规内容: cpu:程序对cpu的使用情况 - 使用时长,占比等 内存:程序对cpu的使用情况 - 使用时长,占 ...

  4. golang 性能调优分析工具 pprof(下)

    golang 性能调优分析工具 pprof(上)篇, 这是下篇. 四.net/http/pprof 4.1 代码例子 1 go version go1.13.9 把上面的程序例子稍微改动下,命名为 d ...

  5. golang 性能优化分析:benchmark 结合 pprof

    前面 2 篇 golang 性能优化分析系列文章: golang 性能优化分析工具 pprof (上) golang 性能优化分析工具 pprof (下) 一.基准测试 benchmark 简介 在 ...

  6. Golang性能调优入门

    如何利用golang自带的profile工具进行应用程序的性能调优,前一段时间我做的日志分析系统在线上遇到了一个问题,就是分任务的系统down机了,日志处理延迟了10几个小时,这个时候任务分发系统重启 ...

  7. golang 性能剖析pprof

    作为一个golang coder,使用golang编写代码是基本的要求. 能够写出代码,并能够熟悉程序执行过程中各方面的性能指标,则是更上一层楼. 如果在程序出现性能问题的时候,可以快速定位和解决问题 ...

  8. Golang性能分析与优化

    在公司的分享,去除了相关的敏感信息.

  9. 2019年,Golang开始吊打Java性能了!!!

    最近要同事debug性能,不经意间发现现在Golang性能开始吊打Java了!!!感觉Go发展神速!! 之前Go和Java基本是平手,甚至还有较大差距,请见https://www.cnblogs.co ...

随机推荐

  1. SQL Server 2008 常见异常收集(持续更新)

    写在前面: 最近,在使用SQL Server 2008时,出现了不少问题.发现,很多问题都是以前碰见过的,并且当时也寻找到了解决方法(绝大部分来源于“百度”与“Google”),只是时间一长,又忘记了 ...

  2. Java NIO——Selector机制源码分析---转

    一直不明白pipe是如何唤醒selector的,所以又去看了jdk的源码(openjdk下载),整理了如下: 以Java nio自带demo : OperationServer.java   Oper ...

  3. JTA 深度历险 - 原理与实现---转

    利用 JTA 处理事务 什么是事务处理 事务是计算机应用中不可或缺的组件模型,它保证了用户操作的原子性 ( Atomicity ).一致性 ( Consistency ).隔离性 ( Isolatio ...

  4. iOS流布局UICollectionView使用FlowLayout进行更灵活布局

    一.引言 前面的博客介绍了UICollectionView的相关方法和其协议中的方法,但对布局的管理类UICollectionViewFlowLayout没有着重探讨,这篇博客介绍关于布局的相关设置和 ...

  5. spring下载dist.zip

    http://repo.springsource.org/libs-release-local/org/springframework/spring/ 选择对应版本下载即可

  6. ASP.NET MVC 第三回 Controller与View

    这节我们让ASP.NET MVC真正的跑起来 一.新建Controller 首先我们自己新建一个新的Controller在Controllers上点右键,添加,Controller选项   之后出现一 ...

  7. HTML5 autocomplete属性、表单自动完成

    autocomplete属性 1.定义autocomplete属性规范表单是否启用自动完成功能.自动完成允许浏览器对字段的输入,是基于之前输入的值.2.应用范围autocomplete使用<fo ...

  8. move file create directory.

    If we want to move file to the directory that does not exist,and if we perform a File.Move,it will r ...

  9. C# DataTable去除重复,极其简便、简单

    其中sourceDT是获取到的一个DataTable类型的集合对象 去重复使用方式: 实例化一个DataView对象 假设为dv,直接dv.ToTable()即可,ToTable中可为(true,&q ...

  10. mysql workbench 建表时 PK,NN,UQ,BIN,UN,ZF,AI解释

    mysql workbench 建表时 - PK: primary key (column is part of a pk) 主键 - NN: not null (column is nullable ...