重要的web程序性能指标

1、Web  Server: 
          Processor :  Processon  time  \  Tatol    cpu时间 
          Memory      :  Availalle  MbyteAvai  应用服务器的内存 
          Requst  Quened  : 进入HTTP队列的时间 = 队列 / 每秒 
          Total  request        : 总请求数时间 
          Avg  Rps                : 平均每秒钟响应次数 =  总请求时间  /  秒数 
          Avg  time  to  last  byte  per  terstion  (mstes) : 平均每秒迭代次数  = 上一个页面到下一个页面的时间是你录入角本的一个过程的执行 
          Http  Error             : 无效请求次数 
          Send                      :发送请求次数字节数 


2、Webload的压力参数: 

          Load  Size :压力规模大小 
          Round  Time(请求时间) 
 Rounds  (请求数) 
 Successful  Rounds(成功的请求) 
 Failed    Rounds  (失败的请求) 
 Rounds  Per  Second  (每秒请求次数)(是指你录入角本的任务在一秒中执行的次数,类似Avg  time  to  last  byte  per  terstion  (mstes)) 
 Successful  Rounds  Per  Second(每秒成功的请求次数) 
 Failed    Rounds  Per  Second(每秒失败的请求次数) 
 Page  Time  页面响应时间 
 Pages  (页面数) 
 Pages    Per  Second  (每秒页面响应数) 
 Hit      Time(点击时间) 
 Hits(点击次数,也可以是请求次数,不过有一些不一样) 
 Successful    Hits  (成功的点击次数) 
 Failed    Hits  (失败的点击次数) 
 Hits  Per  Second  (每秒点击数) 
 Successful    Hits  Per  Second  (每秒成功的点击次数) 
 Failed    Hits  Per  Second  (每秒失败的点击次数) 
 Attempted    Connections  (尝试链接数) 
 Successful    Connections(成功的连接数) 
 Failed      Connections(失败的连接数) 
 Connect    Time(连接时间) 
 Process    Time(系统执行时间,一般用来显示CPU的运算量,服务器端与客户端都要记录) 
 Receive    Time(接受时间) 
 Send      Time(请求时间) 
 Time      To      First    Byte  () 
 Throughput      (Bytes    Per    Second)() 
 Response    Time(回应时间) 
 Response    Data      Size() 
 Responses() 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要获取 Go 程序性能指标,可以使用 Go 的内置工具 `pprof`。`pprof` 可以帮助你分析 Go 应用程序的 CPU 使用情况、内存分配情况以及阻塞情况等。 以下是使用 `pprof` 获取程序性能指标的步骤: 1. 在你的 Go 代码中导入 `net/http/pprof` 包: ```go import _ "net/http/pprof" ``` 2. 启动一个 HTTP 服务,用于提供性能分析数据: ```go import ( "log" "net/http" ) func main() { go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }() // your Go code here } ``` 3. 运行你的 Go 程序,并使用 `go tool pprof` 命令连接到 HTTP 服务: ```sh go tool pprof http://localhost:6060/debug/pprof/profile ``` 4. 进行性能分析。`pprof` 提供了多种命令,如 `top`、`list`、`web` 等,可以帮助你分析性能瓶颈。 例如,使用 `top` 命令可以查看 CPU 使用率最高的函数: ``` (pprof) top Showing nodes accounting for 16360ms, 100% of 16360ms total Dropped 28 nodes (cum <= 81.80ms) Showing top 10 nodes out of 41 flat flat% sum% cum cum% 2660ms 16.25% 16.25% 2660ms 16.25% fmt.(*fmt).fmtInteger 1630ms 9.96% 26.21% 1630ms 9.96% strconv.(*numParser).parseInt 1500ms 9.17% 35.38% 1500ms 9.17% fmt.(*fmt).fmtFloat 1180ms 7.21% 42.60% 1180ms 7.21% regexp.(*bitState).doMatch 1030ms 6.30% 48.91% 1030ms 6.30% regexp/syntax.(*parser).parse ... ``` 使用 `list` 命令可以查看某个函数的代码实现: ``` (pprof) list fmt.(*fmt).fmtInteger Total: 2.66s ROUTINE ======================== fmt.(*fmt).fmtInteger in /usr/local/go/src/fmt/format.go 2.66s 1.77s (flat, cum) 66.54% of Total . . 1123: case 'v': . . 1124: if !f.widPresent && !f.precPresent { . . 1125: f.int(buf, int64(v), verb) . . 1126: continue . . 1127: } 1.27s 1.27s 1128: fallthrough 1.27s 1.27s 1129: case 'd', 'b', 'o', 'x', 'X', 'U': 1.27s 1.27s 1130: fv := new(fmtVerb) ... ``` 使用 `web` 命令可以在浏览器中展示程序的执行路径: ``` (pprof) web ``` 更多关于 `pprof` 的使用方法可以参考官方文档:https://golang.org/pkg/net/http/pprof/

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值