Closed Bug 2022531 Opened 8 months ago Closed 8 months ago

Implement the negative cache mechanism for the Real-Time request simulation

Categories

(Toolkit :: Safe Browsing, task)

task

Tracking

()

RESOLVED FIXED
150 Branch
Tracking Status
firefox150 --- fixed

People

(Reporter: timhuang, Assigned: timhuang)

References

(Blocks 1 open bug)

Details

Attachments

(4 external files)

The SafeBrowsing V5 Real-Time mode doesn't have the concept of negative caching. This makes sense because any domains classified as benign could become malicious in the next second. So, a negative cache can reduce the protection that Real-Time mode provides.

However, we believe that a negative cache can effectively reduce Real-Time traffic, based on the hypothesis that users often navigate to the same site within a short time frame. To experiment with it, we need to implement a negative cache mechanism for the RealTime request simulator.

Assignee: nobody → tihuang
Status: NEW → ASSIGNED

This patch implements a negative cache mechanism in RealTimeRequestSimulator
that caches prefixes with no simulated real-time hits, allowing subsequent
lookups to skip sending a request.

This patch fixes the positive cache lookup to check the per-full-hash expiry
from CachedFullHashResponse::fullHashes instead of using
negativeCacheExpirySec as a prefix-level proxy. Expired full hash entries
are now removed individually, and the prefix entry is cleaned up when no full
hashes remain.

This patch adds ExpireCache() that sets all cache expiry times to 0, and used
in the browser tests to replace the flaky 2-second setTimeout waits.

Pushed by tihuang@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b28b5a4649da https://hg.mozilla.org/integration/autoland/rev/21b276e62cba Part 1: Add the negative cache behind a pref for the RealTimeRequestSimulator. r=dimi https://github.com/mozilla-firefox/firefox/commit/e2d3b1bfbd53 https://hg.mozilla.org/integration/autoland/rev/91695eebf19c Part 2: Add Nimbus features to contorl RealTime Simulator negative cache. r=dimi https://github.com/mozilla-firefox/firefox/commit/b231e86bd41d https://hg.mozilla.org/integration/autoland/rev/255c84a43ab5 Part 3: Fix positive cache expiry check in RealTimeRequestSimulator. r=dimi https://github.com/mozilla-firefox/firefox/commit/a2e8524ce1ad https://hg.mozilla.org/integration/autoland/rev/38145814501e Part 4: Avoid arbitrary timeouts in the test browser_realtime_simulation.js. r=dimi
QA Whiteboard: [qa-triage-done-c151/b150]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: