接口性能P99,P95计算

如何减少P99响应耗时?(收藏)

https://jishuin.proginn.com/p/763bfbd6a7d5

 

https://docs.aws.amazon.com/zh_cn/elasticbeanstalk/latest/dg/health-enhanced-metrics.html

 

 

S了张屠户就得吃带毛猪,TMD,自己算。

一个月内的P99个数

SELECT 
  FORMAT(cnt*0.01,0) P99_CNT,
  FORMAT(cnt*0.05,0) P95_CNT,
  FORMAT(cnt*0.10,0) P90_CNT
FROM
(
SELECT COUNT(id) cnt FROM sys_api_pt_log
WHERE TIMESTAMPDIFF(MONTH, create_date, CURRENT_TIMESTAMP) <1
) a

 

计算这些值的平均值

SELECT 
    FORMAT(AVG(sub.invoke_ms),0) ms 
FROM
(SELECT a.*
FROM sys_api_pt_log a 
WHERE
TIMESTAMPDIFF(MONTH, create_date, CURRENT_TIMESTAMP) <1
ORDER BY a.invoke_ms DESC 
LIMIT 10380
)sub

 

posted @ 2022-03-09 09:26  multitude  阅读(1144)  评论(0编辑  收藏  举报