Firebase trace showing wrong median time latency?

2019-01-27 04:17发布

问题:

I am adding Firebase performance trace in my app and below image is data for last 24 Hrs

As you can see the Median is 647ms, where as 95% time latency is 14.81s and for 5% it is 460ms.

How can the median be 647ms, it should be near around 14 sec? Am I missing something here?

Edit -

In below image data is for last 7 days

As you can see in last 24 Hrs I had data where 95th percentile was 14.81s, but how can in last 7 days graph there is no mention of the 14 secs trace? all traces are below 5.95s?

Also in the distribution image latency is between 460 ms to 2.94s but as 95th percentile in first image is 14.81s and in second image it is 5.95s but distribution is only showing data between 460ms-2.94s? Then what is this distribution data showing? Shouldn't they show here all requests time delay in the last 7 days?

Also when I am checking in devices samples

the time delay maximum in all cases is 5.60s not 14.81s?

回答1:

95% does not mean 95% of the time, it is the 95th percentile in the value range, not to be confused with frequency.

Most (90%) of your "executions" will be between 5-95% so it makes sense that the median is 647 ms.

I don't know exactly what the 95% value represents, it could be an average of the top 5% execution times or it could be the first value in the range.



回答2:

I think the behavior that you are facing is this:

You are sending this metrics (sorted):

Day 1: ..., 460ms, ..., ..., 647ms, ..., ..., 14.81s, ... 5th 50th 95th

That explains the first graph, in the next days you are sending different total number of metrics. (I set some random numbers):

Day 2: ..., 460ms, ..., ..., 647ms, ..., ..., 2.95s, ... 5th 50th 95th

Day 3: ..., 460ms, ..., ..., 647ms, ..., ..., 2.95s, ... 5th 50th 95th

Day 4: ..., 619ms, ..., ..., 971ms, ..., ..., 5.95s, ... 5th 50th 95th

Day 5: ..., 460ms, ..., ..., 647ms, ..., ..., 2.94s, ... 5th 50th 95th

Day 6: ..., 460ms, ..., ..., 647ms, ..., ..., 2.01s, ... 5th 50th 95th

That could explain second graph, and since the third graph shows a distribution across 7 days (merge all your metrics into a single array and computes the percentiles), that explains how the 95th which it should be different than most of your every day 95th (unless the metrics that you send are the same every day).

In addition I noticed that you in fact can check the 100th in the response of the network request made by the Firebase Console from your browser, (I think UI decided to don't render this value).