Open
Bug 1361095
Opened 8 years ago
Updated 3 years ago
[meta] Can nsContentPrefService avoid main thread IO before the first window is shown?
Categories
(Firefox :: General, enhancement, P3)
Firefox
General
Tracking
()
NEW
People
(Reporter: florian, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: meta, perf, Whiteboard: [fxperf])
See this profile captured during startup on the quantum reference hardware: https://perfht.ml/2p1EDjb
51ms of startup is waiting for a CreateFileW system call from mozilla::storage::Service::OpenDatabase / ContentPrefService__dbInit.
Comment 1•8 years ago
|
||
Related is bug 886907. Can we just rm -rf this code?
Updated•8 years ago
|
See Also: → killSyncContentPrefs
Comment 3•8 years ago
|
||
(In reply to :Ehsan Akhgari (super long backlog, slow to respond) from comment #1)
> Related is bug 886907. Can we just rm -rf this code?
That bug removes synchronous usage of this db connection, but the connection will stay there to serve asynchronous usage.
What we really want (in addition to bug 886907) is bug 887889, that would make all the I/O async.
And then we should check if it's possible to delay the initialization of the service itself.
Depends on: 887889
Comment 4•8 years ago
|
||
(In reply to :Ehsan Akhgari (super long backlog, slow to respond) from comment #1)
> Related is bug 886907. Can we just rm -rf this code?
Sure.
Flags: needinfo?(adw)
Updated•8 years ago
|
Whiteboard: [qf] → [qf-]
Updated•8 years ago
|
Whiteboard: [qf-] → [qf:meta]
Updated•8 years ago
|
Depends on: killSyncContentPrefs
Reporter | ||
Comment 5•8 years ago
|
||
Here is a first-startup profile where this takes 958ms on the main thread: https://perfht.ml/2sfM8Yt
Comment 6•8 years ago
|
||
I'm not surprised, the service seems to use a transaction to migrate the schema, but not one to create it, see _dbCreate()! And moreover it sets "PRAGMA synchronous = OFF" AFTER doing all these expensive operations...
If we fix bug 886907 then all the APIs are async and should be portable to Sqlite.jsm.
In the meanwhile, a dumb workaround could consist in either setting PRAGMA synchronous = OFF before creating the schema and use the schema version to differentiate an existing file, or just wrap the schema creation in a transaction.
Reporter | ||
Comment 7•8 years ago
|
||
Here is another startup profile where this blocks us for 1617ms: https://perfht.ml/2uCYbfB
Updated•8 years ago
|
Whiteboard: [qf:meta] → [qf:meta] [fxperf]
Reporter | ||
Updated•8 years ago
|
Priority: -- → P3
Comment 8•8 years ago
|
||
(In reply to Marco Bonardo [::mak] from comment #6)
> I'm not surprised, the service seems to use a transaction to migrate the
> schema, but not one to create it, see _dbCreate()! And moreover it sets
> "PRAGMA synchronous = OFF" AFTER doing all these expensive operations...
>
> If we fix bug 886907 then all the APIs are async and should be portable to
> Sqlite.jsm.
Hey look, this bug got fixed! How hard would it be to port the APIs to Sqlite.jsm and fix this bug, Marco?
Florian, how bad is this problem in your recent startup profiles? Did this get fixed elsewhere?
(Waiting with setting a priority based on this...)
Flags: needinfo?(mak77)
Flags: needinfo?(florian)
Comment 9•8 years ago
|
||
This is pretty much waiting for bug 887889, that has some recent activity. Maybe after bug 887889 there's still some small optimizations we can do here.
Flags: needinfo?(mak77)
Reporter | ||
Comment 10•8 years ago
|
||
(In reply to :Gijs from comment #8)
> Florian, how bad is this problem in your recent startup profiles? Did this
> get fixed elsewhere?
Recent startup profiles show this database opened by ContentPrefService2 during FullZoom_init (from browser-fullZoom.js), started during _delayedStartup: https://perfht.ml/2BXYf15
This is after first paint and the current bug summary says "main thread IO before the first window is shown", so I would be OK with closing this bug as WFM.
But it seems Marco has ideas to make this async, which would be much better, so we can morph the bug to that.
Flags: needinfo?(florian)
Updated•4 years ago
|
Performance Impact: --- → ?
Whiteboard: [qf:meta] [fxperf] → [fxperf]
Updated•4 years ago
|
Summary: Can nsContentPrefService avoid main thread IO before the first window is shown? → [meta] Can nsContentPrefService avoid main thread IO before the first window is shown?
Updated•4 years ago
|
Performance Impact: ? → ---
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•