我正在做一个项目,我应该在我们的REST Service
上做分析。然后算出服务的90 percentile
或95 percentile
是多少。表示调用在90% of time
或95% percent of time
中占用的时间
下面是我通过分析我的服务创建的直方图-
0 came back between 1 and 2 ms
0 came back between 3 and 4 ms
0 came back between 5 and 8 ms
0 came back between 9 and 16 ms
0 came back between 17 and 32 ms
2205 came back between 33 and 64 ms
141 came back between 65 and 128 ms
50 came back greater than 128 ms
从上面的直方图来看,这意味着2205
调用在33 and 64 ms
之间返回,141 calls
调用在65 and 128 ms
之间返回。
所以现在我想弄清楚如何计算90 percentile
或95 percentile
是什么?意味着90 percentage of time
呼叫在多少毫秒内返回?
对于上面的直方图,我也有一个地图,如果我们不能从上面的直方图中找出这个百分位数,那么我们也可以使用这个地图。
仅从这张地图,我创建了上面的直方图-
{213 = 114 = 185 = 1, 131 = 1, 40 = 145, 67 = 8, 49 = 35, 537 = 2, 164 = 565 = 1,55= 13,96 = 1,546 = 1,117 = 1,68 = 10,62 = 6,83 = 1,34 =333, 41=108, 179=1,48 = 48、111 = 129 = 1,69 = 11日33 = 1,173 = 61 = 8,541 = 74 = 7,180 = 2,42= 78,47 = 46,56 = 11,84 = 2,70 = 12,228 = 1,273 = 1,46 = 52,102 = 1,225 =181= 2,181 = 1,563 = 1,549 = 1,137 = 1,73 = 3,235 = 1,53 = 17,90 = 1,36 =190,118=1, 45=78, 35=267, 72=9, 63=16, 54=11, 271=1, 189=1, 209=1, 175=451=23, 203=2, 37=186, 58=5, 196= 2,237 = 1,86 = 3,44 =81, 64= 15,92 =3,224= 1,71 = 8,251 = 1,52 = 12,78 = 3,43 =75, 147= 1,133 = 1,580 = 1,57 =11,263= 1,566 = 1,85 = 1,243 = 1,38 =161, 559= 1,80 = 3,132 = 1,194 = 1,107 =6,65= 5,183 = 1,222 = 1,93 = 1,60 = 12,231 = 1,94 = 1,66 = 12,122 = 1,39 =135,50 = 76 = 1, 59 = 6, 104 = 158 = 1, 113 = 1, 204 = 87 = 115 = 2}
图中key
为毫秒数,值为total number of calls
例如-
213=1
表示1
调用返回到213 milliseconds
。
114=2
2
呼叫返回114 milliseconds
。
histogram
或上面的Map
创建百分位的东西
如果您正在进行性能调优,那么我建议您使用Metrics,它可以告诉您实际情况