Open Bug 1999691 Opened 27 days ago Updated 14 hours ago

Improve DNS cache eviction strategy

Categories

(Core :: Networking, enhancement, P2)

enhancement

Tracking

()

REOPENED

People

(Reporter: valentin, Assigned: kershaw)

References

(Regressed 1 open bug)

Details

(Whiteboard: [necko-triaged][necko-priority-review])

Attachments

(1 file)

mozilla::net::HostRecordQueue::AddToEvictionQ adds entries to the evictionQ, and those entries get evicted when the queue is full.
We may remove it from the queue when mozilla::net::HostRecordQueue::MaybeRenewHostRecord gets called, which would cause it to be added back, but otherwise it's a FIFO eviction strategy.
Potential improvements:

  • When a DNS cache entry is used, take it out and readd it to the eviction queue (ie switch to a least-recently-used eviction strategy)
  • When an eviction happens, evict expired resources first considering their TTL.

If I understand correctly, we currently set a limit of 800 entries. Under the assumption, that each entry is < 1_000 bytes, this limit seems small.

@Valentin, would a third "potential improvement", namely increasing this limit be worth exploring as well?

Flags: needinfo?(valentin.gosu)

FYI the current limit of 800 was already doubled from 400 as part of the dns caching experiments in Bug 1950852. We didn't see any side effects there, but also no benefits (at least not through the telemetry noise).

Also for reference there is the old Bug 1463374 which was basically addressing the same thing and if I remember correctly from looking at it last year the suggested changes were also a combination of Valentin's recommendation, i.e. least-recently-used + evict expired first.

Increasing the limit even higher probably wouldn't hurt, but the switch to LRU is much more impactful.

Flags: needinfo?(valentin.gosu)
See Also: → 2003999
Assignee: nobody → kershaw
Status: NEW → ASSIGNED
Pushed by kjang@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/ffb7bd5a1778 https://hg.mozilla.org/integration/autoland/rev/9ee64609489d When a DNS cache entry is used, take it out and readd it to the eviction queue, r=necko-reviewers,valentin
Status: ASSIGNED → RESOLVED
Closed: 22 hours ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch
Regressions: 2004939
Pushed by csabou@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/7496c8515212 https://hg.mozilla.org/mozilla-central/rev/7c6e6dc03dc0 Revert "Bug 1999691 - When a DNS cache entry is used, take it out and readd it to the eviction queue, r=necko-reviewers,valentin" for causing a top crash tracked under Bug 2004939.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: 148 Branch → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: