Open Bug 1807354 Opened 3 years ago Updated 2 years ago

PlacesKt.placesApiNew blocks 3 DefaultDispatcher threads on start up (66ms during profiling, A51)

Categories

(Firefox for Android :: Performance, defect)

All
Android
defect

Tracking

()

Performance Impact none

People

(Reporter: cpeterson, Unassigned)

Details

From github: https://github.com/mozilla-mobile/fenix/issues/27831.

I took a start up trace using perfetto (which you can view by downloading it and "Open trace file" on https://ui.perfetto.dev): startup.trace.zip

In it, I found 3 DefaultDispatcher threads are blocked near activityResume: "monitor contention with owner" and "lock content on a monitor lock":

The description for each is:

monitor contention with owner DefaultDispatcher-worker-1 (31) at 
mozilla.appservices.places.uniffi.PlacesApi
mozilla.appservices.places.uniffi.PlacesKt.placesApiNew(java.lang.String)(places.kt:1) 
waiters=2 blocking from java.lang.Object kotlin.SynchronizedLazyImpl.getValue()(LazyJVM.kt:10)

Putting long running work on the DefaultDispatcher is a potential problem because we have a limited number of DefaultDispatcher threads and, if they are all blocked, any other queued work cannot execute immediately. Devices generally have 1 defaultDispatcher thread per core so on devices with low core counts (e.g. 2, maybe 4), we may be blocking all the threads already.

I'm most concerned about low-end devices with lower specs than the A51. In particular, if there are fewer cores, we're more likely to be blocked. And if the device is slower, it'll take longer than 66ms.

┆Issue is synchronized with this Jira Task

Change performed by the Move to Bugzilla add-on.

The severity field is not set for this bug.
:cpeterson, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(cpeterson)
Flags: needinfo?(cpeterson)

Considering it's ~5% of our start up, it doesn't cause any jank.

The Performance Impact Calculator has determined this bug's performance impact to be none. If you'd like to request re-triage, you can reset the Performance Impact flag to "?" or needinfo the triage sheriff.

Platforms: Android

Performance Impact: --- → none
Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.