Closed Bug 1538372 Opened 5 years ago Closed 5 years ago

Heavy disk writes after an update to (profile)/security_state/data.mdb

Categories

(Core :: Security: PSM, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: jimm, Assigned: myk)

Details

Attachments

(1 file)

Myk pointed me to this component. This file is associated with a rust module 'rkv' which we've started using for certificate storage.

STR:

  1. open resource monitor on Windows
  2. open an instance after a nightly update
  3. note access to security_state\data.mdb

I see, on average, about 500mb of writes to this file right at startup. This feels like it's dragging browser startup down quite a bit.

Windows 7, 64-bit, multiple profiles. Each profile exhibits the behavior after an update.

Image PID File Read (B/sec) Write (B/sec) Total (B/sec) I/O Priority Response Time (ms)
firefox.exe 7020 C:\Users\jim\AppData\Roaming\Mozilla\Firefox\Profiles\ravw10ms.mozilla-1546466584255\security_state\data.mdb 0 454,174 454,174 Normal 12

Image PID File Read (B/sec) Write (B/sec) Total (B/sec) I/O Priority Response Time (ms)
firefox.exe 7196 C:\Users\jim\AppData\Roaming\Mozilla\Firefox\Profiles\2ykirmgk.stuff\security_state\data.mdb 0 371,371 371,371 Normal 5

Jim, do you see the same behavior after you restart the browser with a profile that exhibited this on initial startup after Firefox update? I wonder if this is a one-time cost of migrating cert records into the new security_state store. (Even if so, we might be able to improve the efficiency of the migration. I'm only asking in order to understand the scope of the issue better.)

(In reply to Myk Melez [:myk] [@mykmelez] from comment #1)

Jim, do you see the same behavior after you restart the browser with a
profile that exhibited this on initial startup after Firefox update? I
wonder if this is a one-time cost of migrating cert records into the new
security_state store. (Even if so, we might be able to improve the
efficiency of the migration. I'm only asking in order to understand the
scope of the issue better.)

You're guess seem good, it's only after an update, and only on first run after the update. Also profile specific too since each profile has its own copy of this file.

One potential issue is that SecurityState.migrate() calls set_revocation_by_subject_and_pub_key() or set_revocation_by_issuer_and_serial() for each (relevant) line in revocations.txt, and those functions call write_entry(), which creates a transaction, writes the entry, and then commits the transaction.

Depending on the number of lines in the source file, it could be much more efficient for SecurityState.migrate() to create and commit a single transaction containing all the entries to be migrated.

cert_storage migrates revocations.txt via one transaction per entry, which can be expensive. This change uses a single transaction to migrate all entries.

Assignee: nobody → myk
Status: NEW → ASSIGNED
Pushed by myk@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ca2216061827
migrate revocations in single transaction r=keeler
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: