服务器:

阿里云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. Datagridview 实现二维表头和行合并【转载】

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; u ...

  2. export 命令 设置环境变量

    export KERN_DIR=/usr/src/kernels/2.6.18-194.11.1.el5-x86_64 设置环境变量 内核加载目录

  3. [RxJS] Filtering operators: skipWhile and skipUntil

    After takeUntil() and takeWhile() function, let's have a look on skipWhile() and skilUntil() functio ...

  4. Cstyle的UEFI导读:第18.0篇 NVRAM的工作原理(上)

        虽有句话说的好,实用的东西记在脑子里.没有的记在笔记本上. 可是如今的信息量越来越大,并且随着时间的推移记忆力会越来越不可靠,所以仅仅好把近期工作之余看的一些东西记录下来,避免被迅速忘记.这里 ...

  5. spring servlet 扩展undertow

    官方地址:http://undertow.io/documentation/servlet/servlet-extensions.html  留待学习中,mark一下 源码地址:https://git ...

  6. Linux 用户与用户组

    1  Linux 用户与组 Linux是一个多用户多任务操作系统.多用户可以在同一时间内登录同一个系统执行各自不同的任务,而互不影响. 1.1  Linux下用户的角色分类 Linux用户的角色分为3 ...

  7. OSI 网络七层模型(笔记)

    一直以来我们都在使用着互联网,每天聊着qq,上着淘宝,但是却不了解怎么运行的呢,充满了好奇.今天同过了解来总结一下OSI网络七层模型: 上一张图 OSI (open system interconne ...

  8. 用Java发送邮件

    要用Java发送邮件,除过JDK本身的jar包之外,还需要两个额外的jar包:JavaMail和JAF.当然,如果你使用的JavaEE的JDK,那就不用单独去网上下载了,因为JavaEE的JDK中已经 ...

  9. Echarts使用随笔(2)-Echarts中mapType and data

    本文出处:http://blog.csdn.net/chenxiaodan_danny/article/details/39081071  series : [                {   ...

  10. CSRF 攻击的应对之道

    转载自imb文库 CSRF(Cross Site Request Forgery, 跨站域请求伪造)是一种网络的攻击方式,该攻击可以在受害者毫不知情的情况下以受害者名义伪造请求发送给受攻击站点,从而在 ...