Golang: pprof
压测的时候,如果在应用包里加入runtime包,会对压测产生非常严重的干扰。
测试1:开启runtime包
[luwenwei@test-weishi01v ~]$ siege -c 100 --time=15s -q -f /tmp/SafeBizEngine.siege.2 Lifting the server siege... done. Transactions: 310 hits Availability: 76.92 % Elapsed time: 14.37 secs Data transferred: 10.86 MB Response time: 3.77 secs Transaction rate: 21.57 trans/sec Throughput: 0.76 MB/sec Concurrency: 81.29 Successful transactions: 310 Failed transactions: 93 Longest transaction: 10.03 Shortest transaction: 0.02
测试2:把runtime包注释掉
[luwenwei@test-weishi01v ~]$ siege -c 100 --time=15s -q -f /tmp/SafeBizEngine.siege.2 Lifting the server siege... done. Transactions: 1137 hits Availability: 100.00 % Elapsed time: 14.88 secs Data transferred: 39.65 MB Response time: 0.76 secs Transaction rate: 76.41 trans/sec Throughput: 2.66 MB/sec Concurrency: 57.99 Successful transactions: 1137 Failed transactions: 0 Longest transaction: 2.83 Shortest transaction: 0.16
实验1,2对比发现:引入runtime包后的错误率很高,从而影响压测的关键数据QPS。