Closed Bug 503713 Opened 15 years ago Closed 15 years ago

safe browsing requests shouldn't be placed in disk cache

Categories

(Toolkit :: Safe Browsing, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 3.7a1
Tracking Status
status1.9.2 --- beta5-fixed
status1.9.1 --- wanted

People

(Reporter: Dolske, Assigned: Unfocused)

Details

(Keywords: perf)

Attachments

(1 file)

Open up about:cache, and look through the disk cache entries. You'll see multiple entries from requests to the google safebrowsing server.

I see entries like

Key: http://safebrowsing-cache.google.com/safebrowsing/rd/goog-phish-shavar_a_#######

and

Key: id=4a57da87&uri=http://safebrowsing.clients.google.com/safebrowsing/downloads/......

AFAIK all this data just ends up in urlclassifier3.sqlite, so it's just wasting space sitting in the disk cache, and crowding out other things that could be using the cache.

Biesi suggests that maybe it "should set the INHIBIT_CACHING flag".
Flags: wanted1.9.1.x?
Flags: blocking-firefox3.6?
I wonder if this also contributes to disk thrashing, since we're writing to two files (disk cache, SQL DB) for each entry.
Flags: wanted1.9.1.x?
We're sure it doesn't use the cache version? If so, this sounds like a good idea. Our cache isn't known to be the fastest thing in the world, I wonder if this would give us a significant perf boost.

If we can get an idea of perf gains, feel free to renominate.
Flags: wanted-firefox3.6+
Flags: blocking-firefox3.6?
Flags: blocking-firefox3.6-
If url-classifier were using cached http requests, how would it look them up in the cache? I just want to rule that out before looking into "INHIBIT_CACHING". I assume we are not using any cache data in safebrowsing.
It would be a little silly for it to go out of its way to use the HTTP cache, considering the data must be available in the on-disk SQL DB.
(In reply to comment #3)
> If url-classifier were using cached http requests, how would it look them up in
> the cache? I just want to rule that out before looking into "INHIBIT_CACHING".
> I assume we are not using any cache data in safebrowsing.

Had a look into this... from what I understand:

* The stream updater will only ever send unique requests (each partial update is unique), so no chance of a cache hit.
* The hash completer uses batch requests, which would (almost) always result in a cache miss. Also, I *think* it will only send requests with a partial hashes (to get the complete hash), then store the complete hash, so not have to request the same partial hash more than once.
Assignee: nobody → bmcbride
Status: NEW → ASSIGNED
Attached patch Patch v1Splinter Review
This patch adds INHIBIT_CACHING to the stream updater and the hash completer requests. I've also added LOAD_BYPASS_CACHE to avoid any cache lookup, since that will be guaranteed to always result in a miss anyway.
Attachment #405820 - Flags: review?
Attachment #405820 - Flags: review? → review?(dcamp)
Blair: I am not sure if dcamp is reading bugmail or reviewing safebrowsing bugs. Did you write a test case for this change?
He'll likely review if you email him personally, but Tony Chang also does reviews, I believe.
(In reply to comment #7)
> Did you write a test case for this change?

No, I didn't think it was necessary, since I'm only adding flags that don't actually affect how any of this code works. If tests are warranted, I'll need help from someone - I haven't the faintest idea on how to automatically test this.

(In reply to comment #8)
> but Tony Chang also does reviews, I believe.

Ok.
Attachment #405820 - Flags: review?(dcamp) → review?(tony)
Attachment #405820 - Flags: review?(tony) → review+
Comment on attachment 405820 [details] [diff] [review]
Patch v1

Looks good.
http://hg.mozilla.org/mozilla-central/rev/14f4a91d2ffa
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 3.7a1
Please be sure to nominate this for a+ assuming it passes all tests on mozilla-central
Attachment #405820 - Flags: approval1.9.2?
Comment on attachment 405820 [details] [diff] [review]
Patch v1

approval1.9.2 requests aren't currently being monitored, since we're nearing RC freeze and there are too many outstanding requests, so I'm clearing this request. Feel free to re-request approval if you are confident that it's worth drivers' time to consider whether this non-blocker needs to land for 1.9.2 at this stage.
Attachment #405820 - Flags: approval1.9.2?
Ah snap - I thought this had landed on 1.9.2 already :( Anyway, doesn't look like this gave any significant pref boost on trunk after all.
Comment on attachment 405820 [details] [diff] [review]
Patch v1

If it means less churning on the disk i/o side, I think it's worth it. You wouldn't believe the number of complaints I hear about safe browsing causing high disk i/o.
Attachment #405820 - Flags: approval1.9.2?
(In reply to comment #15)
> (From update of attachment 405820 [details] [diff] [review])
> If it means less churning on the disk i/o side, I think it's worth it. You
> wouldn't believe the number of complaints I hear about safe browsing causing
> high disk i/o.

Fair enough - theoretically it should help there. Pity disk IO isn't measured & graphed (or is it?) so this could be quantified.
Comment on attachment 405820 [details] [diff] [review]
Patch v1

a192=beltzner, seems very safe to me and less disk churn helps save battery, amongst other things
Attachment #405820 - Flags: approval1.9.2? → approval1.9.2+
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: