Closed Bug 1538250 Opened 6 years ago Closed 6 years ago

see if we can avoid initializing nsiCertStorage on the main thread (or open the backing db off the main thread)

Categories

(Core :: Security: PSM, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Performance Impact medium
Tracking Status
firefox-esr60 --- wontfix
firefox66 --- wontfix
firefox67 --- wontfix
firefox68 --- fixed

People

(Reporter: keeler, Assigned: keeler)

References

Details

(Keywords: perf:responsiveness, Whiteboard: [psm-assigned])

Attachments

(2 files)

(In reply to Florian Quèze [:florian] from bug 1429796 comment #18)

(In reply to Dana Keeler (she/her) (use needinfo) (:keeler for reviews) from comment #15)

Looks like we need to whitelist the DB file backing cert_storage.

It looks like the <profile>/security_state/data.mdb file is being accessed from the main thread. Is this intentional? If so, what makes the I/O to this file impossible to do off main thread?

Summary: see if we can avoid nsiCertStorage on the main thread (or open the backing db off the main thread) → see if we can avoid initializing nsiCertStorage on the main thread (or open the backing db off the main thread)

This is visible in profiles: http://bit.ly/2V3H6te

In this case, it's a startup profile, and is showing up right after first paint, when we do a nsIOService::SpeculativeConnect call. It's unfortunate that this speculativeConnect perf optimization causes us to fsync on the main thread.

Whiteboard: [psm-backlog] → [psm-backlog][qf]
Whiteboard: [psm-backlog][qf] → [psm-backlog][qf:p2:responsiveness]
Assignee: nobody → dkeeler
Priority: P3 → P1
Whiteboard: [psm-backlog][qf:p2:responsiveness] → [psm-assigned][qf:p2:responsiveness]

After initialization (which happens on the main thread because we need to access
preferences), cert_storage will first be used on a certificate verification
thread. We can use this to avoid main-thread I/O by lazily opening the DB when
it first gets used rather than at initialization.

Pushed by dkeeler@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3d4f7e72dadb lazily open DB in cert_storage to avoid main-thread I/O r=jcj

Thanks for working on this, Dana! Does this mean that we can remove this xperf whitelist entry?: https://searchfox.org/mozilla-central/rev/3d469329a42644b41e66944d8da22d78d8c0f5ec/testing/talos/talos/xtalos/xperf_whitelist.json#527-532

Flags: needinfo?(dkeeler)
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Pushed by dkeeler@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/44f7c1b809ee follow-up to remove xperf_whitelist.json entry r=jcj

Setting 67=wontfix because I assume we don't need to uplift this fix to 67 Beta.

== Change summary for alert #20155 (as of Thu, 28 Mar 2019 00:26:15 GMT) ==

Improvements:

5% Heap Unclassified osx-10-10-shippable opt stylo 79,391,981.91 -> 75,423,169.70

For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=20155

Performance Impact: --- → P2
Whiteboard: [psm-assigned][qf:p2:responsiveness] → [psm-assigned]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: