都在談論高併發,可是高併發系統的指標有哪些呢?網絡
QPS(TPS)= 併發數 / 平均響應時間併發
併發數 = QPS * 平均響應時間高併發
好比:性能
有四次請求耗時分別爲:2ms,10ms,100ms,1000mscode
private static int tp(List<Integer> times, int percent) { float percentF = (float)percent/100; int index = (int)(percentF * times.size() - 1); Collections.sort(times); return times.get(index); }
0.99 * 3 = 2.97 取整爲3 第三個值爲100ms排序
以後咱們能夠設置這個指標做爲監控閾值,保證方法調用消耗時間少於這個值,若是超過此值,則報警。事務
TP90,TP99,TP999計算方法相同,表明了不一樣的性能要求,TP50相對較低,TP90則較高,TP99則要求很高get