Closed
Bug 1325325
Opened 9 years ago
Closed 9 years ago
Check HTTP_NET_VS_CACHE_*_REVALIDATED probes for correctness
Categories
(Core :: Networking: Cache, defect)
Core
Networking: Cache
Tracking
()
RESOLVED
FIXED
mozilla53
Tracking | Status | |
---|---|---|
firefox53 | --- | fixed |
People
(Reporter: michal, Assigned: CuveeHsu)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-active])
Attachments
(1 file, 2 obsolete files)
1.77 KB,
patch
|
CuveeHsu
:
review+
|
Details | Diff | Splinter Review |
We are probably doing something wrong when measuring time of revalidated requests because according to telemetry there is not a single report of cache being faster than network.
Reporter | ||
Updated•9 years ago
|
Assignee: nobody → juhsu
Whiteboard: [necko-active]
Assignee | ||
Comment 1•9 years ago
|
||
I'm still digging this.
Most of the time are 304, but cache should still be faster most of the time.
Assignee | ||
Comment 2•9 years ago
|
||
For a 304 revalidate case, nsHttpChannel will receive a onStart/StopReqeust for a 304,
where we should not record the timestamp since it's not a success response.
Therefore, after the 304, we issue a ReadFromCache for the same AsyncOpen,
and another pair of onStart/StopReqeust from cache comes.
Assignee | ||
Comment 3•9 years ago
|
||
Attachment #8826138 -
Flags: review?(michal.novotny)
Reporter | ||
Comment 4•9 years ago
|
||
Comment on attachment 8826138 [details] [diff] [review]
avoid_record_304
Review of attachment 8826138 [details] [diff] [review]:
-----------------------------------------------------------------
::: netwerk/protocol/http/nsHttpChannel.cpp
@@ +6730,2 @@
> if (request == mTransactionPump && mCacheEntry &&
> + !mCachedContentIsValid &&
Shouldn't we use mDidReval instead?
This prevents rewriting stored times in the cache entry, but we still get wrong mOnStartRequestTimestamp. Now we use the time when we started to read the data from the cache, but we should use the earlier when we got the response from the server. I.e. we should prevent rewriting mOnStartRequestTimestamp in second nsHttpChannel::OnStartRequest call.
Attachment #8826138 -
Flags: review?(michal.novotny) → review-
Assignee | ||
Comment 5•9 years ago
|
||
(In reply to Michal Novotny (:michal) from comment #4)
> Comment on attachment 8826138 [details] [diff] [review]
> avoid_record_304
>
> Review of attachment 8826138 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: netwerk/protocol/http/nsHttpChannel.cpp
> @@ +6730,2 @@
> > if (request == mTransactionPump && mCacheEntry &&
> > + !mCachedContentIsValid &&
>
> Shouldn't we use mDidReval instead?
>
I'm worried about the custom conditional request, since it does *not* set mDidReval = true.
But we can deal with it in Bug 1331324 and use mDidReval first.
> This prevents rewriting stored times in the cache entry, but we still get
> wrong mOnStartRequestTimestamp. Now we use the time when we started to read
> the data from the cache, but we should use the earlier when we got the
> response from the server. I.e. we should prevent rewriting
> mOnStartRequestTimestamp in second nsHttpChannel::OnStartRequest call.
I'm wondering why we should prevent rewriting mOnStartRequestTimestamp.
We want to measure the time between AsynOpen and mListener->OnStartRequest,
and we propagate the OnStartRequest to mListener in |nsHttpChannel::CallOnStartRequest|
which is triggered by mCachePump, the second nsHttpChannel.
Flags: needinfo?(michal.novotny)
Reporter | ||
Comment 6•9 years ago
|
||
(In reply to Junior[:junior] from comment #5)
> I'm worried about the custom conditional request, since it does *not* set
> mDidReval = true.
> But we can deal with it in Bug 1331324 and use mDidReval first.
If we revalidated the entry and the revalidation failed, then mDidReval is true, but mCachedContentIsValid = false. And we shouldn't save this network time because it contains also time spent loading the cache entry. In fact, we should never save network time when we hit the disk due to get the cache entry and this solves just one case. But AFAICS it's not easy to handle other cases and they should be rare.
> > This prevents rewriting stored times in the cache entry, but we still get
> > wrong mOnStartRequestTimestamp. Now we use the time when we started to read
> > the data from the cache, but we should use the earlier when we got the
> > response from the server. I.e. we should prevent rewriting
> > mOnStartRequestTimestamp in second nsHttpChannel::OnStartRequest call.
>
> I'm wondering why we should prevent rewriting mOnStartRequestTimestamp.
>
> We want to measure the time between AsynOpen and mListener->OnStartRequest,
> and we propagate the OnStartRequest to mListener in
> |nsHttpChannel::CallOnStartRequest|
> which is triggered by mCachePump, the second nsHttpChannel.
You're right. We should report the delay between AsyncOpen and a point when we have first data for the listener. Sorry for the confusion.
Flags: needinfo?(michal.novotny)
Assignee | ||
Comment 7•9 years ago
|
||
(In reply to Michal Novotny (:michal) from comment #6)
> (In reply to Junior[:junior] from comment #5)
> > I'm worried about the custom conditional request, since it does *not* set
> > mDidReval = true.
> > But we can deal with it in Bug 1331324 and use mDidReval first.
>
> If we revalidated the entry and the revalidation failed, then mDidReval is
> true, but mCachedContentIsValid = false. And we shouldn't save this network
> time because it contains also time spent loading the cache entry. In fact,
> we should never save network time when we hit the disk due to get the cache
> entry and this solves just one case. But AFAICS it's not easy to handle
> other cases and they should be rare.
>
I agree that we should not measure the network time if we need to load to cache entry
because that's not the case when we race cache with network.
When we race cache with network, we won't send a conditional request.
Assignee | ||
Comment 8•9 years ago
|
||
Attachment #8826138 -
Attachment is obsolete: true
Attachment #8827379 -
Flags: review?(michal.novotny)
Reporter | ||
Comment 9•9 years ago
|
||
Comment on attachment 8827379 [details] [diff] [review]
avoid_record_conditional_requests
Review of attachment 8827379 [details] [diff] [review]:
-----------------------------------------------------------------
::: netwerk/protocol/http/nsHttpChannel.cpp
@@ +6725,5 @@
> // If we are using the transaction to serve content, we also save the
> // time since async open in the cache entry so we can compare telemetry
> // between cache and net response.
> + // We ignore the conditional requests since we won't send a conditional
> + // request in racing cache with network.
I think we need a bit better comment. Something like:
Do not store the time in case of conditional request because even if we fetch the data from the server the time includes loading of the old cache entry which would skew the network load time.
Attachment #8827379 -
Flags: review?(michal.novotny) → review+
Assignee | ||
Comment 10•9 years ago
|
||
Rebase and modify comments based on reviewer's hint. Carry r+
Attachment #8827379 -
Attachment is obsolete: true
Attachment #8827788 -
Flags: review+
Assignee | ||
Comment 11•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 12•9 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/aba1bf821277
Do not record the timestamp for conditional requests. r=michal
Keywords: checkin-needed
Comment 13•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in
before you can comment on or make changes to this bug.
Description
•