w3c / navigation-timing

Navigation Timing
https://w3c.github.io/navigation-timing/
Other
116 stars 30 forks source link

AppCache meaning #140

Closed ThierryMajutec closed 2 years ago

ThierryMajutec commented 3 years ago

AppCache defined in the Time Navigation API does of course correspond to the time it takes by the browser to check the cache, but not only I guess. Do you confirm that the waiting time in case the browser has already established 6 TCP sessions to the same hostname and waits for a slot to be available ? Are there any other main reasons to have significant AppCache value ?

nicjansma commented 3 years ago

Hi @ThierryMajutec,

That's correct, the time listed as AppCache in the diagram below is bound by fetchStart and domainLookupStart, and should mostly represent time taken by the browser to check the local browser cache (i.e. to decide if it needs to fetch something from the network):

NavTiming diagram

The fetchStart attribute definition mentions this:

Do you confirm that the waiting time in case the browser has already established 6 TCP sessions to the same hostname and waits for a slot to be available ?

I think most of the "blocking time" (when waiting for an already-established connection to be free) will be between connectEnd and requestStart instead.

Are there any other main reasons to have significant AppCache value ?

Not that I'm aware, but each browser is free to do whatever work it thinks is necessary during the fetch timeline. At mPulse (a RUM provider) we have generally assumed time between fetchStart and domainLookupStart was mostly cache lookup time (i.e. time it takes to spin up the disk and check if content exists/is usable or not).

I was curious to see how frequently we see time spent during the AppCache block above. I looked at our mPulse RUM data, and over a few billion page loads, I see:

If we look at just App Cache durations from 0ms to 1,000ms, we see a lognormal distribution of times:

app-cache-zoom

The last bucket at 1,000ms in the first graph represents all data taking at least 1,000ms or higher.

The second chart zooms into the durations from 1,000ms to 60,000ms (i.e. the final bucket in the first picture). There's a an interesting spike at 10,000ms (10s) and another small one at 20,000ms (20s). My guess is some browsers have cache-lookup timeouts at 10s/20s, and go to network instead?

Anyways, I'd be curious if any browser developers know differently, or if there's other common work done between those two timestamps.

By the way, though it's called AppCache in the diagram above, I don't believe this is supposed to be a reference to the AppCache browser feature that is being removed. It's meant to just be the "App Cache" lookup time.

noamr commented 3 years ago

Can this be closed? I think this is clear both in the diagram and in the FETCH spec.

yoavweiss commented 3 years ago

Should we rename "AppCache" in the diagram to simply "Cache"?

noamr commented 3 years ago

Should we rename "AppCache" in the diagram to simply "Cache"?

I believe so. I don't have access to the diagrams though, @nicjansma ?

yoavweiss commented 2 years ago

It's in https://github.com/w3c/navigation-timing/blob/gh-pages/timestamp-diagram.svg

noamr commented 2 years ago

It's in https://github.com/w3c/navigation-timing/blob/gh-pages/timestamp-diagram.svg

Yea that's generated from somewhere and not editable.

yoavweiss commented 2 years ago

It seems like at least one past commit changed it directly. @nicjansma - do you know more about this?

noamr commented 2 years ago

It seems like at least one past commit changed it directly. @nicjansma - do you know more about this?

It was committed directly but probably authored elsewhere and re-exported. It looks like a Google Doc diagram.