Which reading is the median when there are an even number of latencies?
median takes the middle of the ordered sample. For an even count it averages the two central observations.
numpy.median in practice
For latencies 1,2,8,90 milliseconds, the median is five, even though no request took five milliseconds. Inspect tail observations to investigate slow requests.
import numpy as np
np.median([1,2,8,90])Result 5.0
中文
偶数条延迟观测的中位数是哪一条?
median 将样本按值排序,偶数项时取中间两项的均值。
numpy.median 算例
四次延迟 1、2、8、90 毫秒的中位数为 5 毫秒,实际请求中可以没有这个时长。只看中位数也难以发现最慢请求。
import numpy as np
np.median([1,2,8,90])结果 5.0