Closed Bug 1575214 Opened 5 years ago Closed 5 years ago

Gloda is getting in the way of typing messages, slow because of jank from synchronous GC

Categories

(MailNews Core :: Database, defect)

Unspecified
All
defect
Not set
normal

Tracking

(thunderbird_esr68 affected, thunderbird75 wontfix)

RESOLVED FIXED
Thunderbird 76.0
Tracking Status
thunderbird_esr68 --- affected
thunderbird75 --- wontfix

People

(Reporter: florian, Assigned: mkmelin)

References

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

Here is a profile I just captured: https://perfht.ml/30l4oxv

I was attempting to type IRC messages and the characters weren't appearing at the rate at which I was typing them.

The profile shows at least:

I've also noticed this - can be nasty at times. And your profile shows a total of almost 1 second of jank.

Is Bug 1535133 nearing completion?

Keywords: perf

(In reply to Florian Quèze [:florian] (PTO until September 2nd) from comment #0)

I saw this again, but this time I wouldn't say it's just jank, gloda's forced GC caused a 27.7s hang, followed by 9.2s of cycle collection: https://perfht.ml/30SRh6W And this was followed by another slow GC just a few seconds later: https://perfht.ml/30RTRdt

My Thunderbird instance isn't using a crazy large amount of memory (about 2GB). It's larger than I would like, but smaller than other Firefox processes that remain responsive while GC'ing.

I saw this again, but this time I wouldn't say it's just jank, gloda's forced GC caused a 27.7s hang, followed by 9.2s of cycle collection: https://perfht.ml/30SRh6W And this was followed by another slow GC just a few seconds later: https://perfht.ml/30RTRdt

That's pretty bad. Any indicatation this behavior new to version 68? What is next step?

Flags: needinfo?(florian)

Maybe we should follow up with a Cu.forceCC(); too after Cu.forceGC(); Perhaps Cu.forceShrinkingGC(); too?
Seems like the usual pattern is to call Cu.forceGC(); Cu.forceCC(); (and sometimes Cu.forceShrinkingGC();)

https://searchfox.org/comm-central/rev/d55fb7f2405fd4e07cb267851340626a63a8c270/mailnews/db/gloda/modules/utils.js#144

Except when doing automated tests related to memory use or that may fail if there's a leak, we should never force a GC. The current behavior blocks the UI for long periods of time; not forcing the GC would let the GC do its work in smaller chunks and shouldn't block the UI much (if at all) unless we have a significant memory leak.

FWIW, GC code is constantly improving, if slowly - https://mzl.la/2DQpaeR

OS: Unspecified → All
Summary: Gloda is getting in the way of typing messages → Gloda is getting in the way of typing messages, slow because of jank from synchronous GC
Version: unspecified → Trunk

(In reply to Wayne Mery (:wsmwk) from comment #6)

FWIW, GC code is constantly improving, if slowly - https://mzl.la/2DQpaeR

This sounds like you agree that a hack introduced in 2009 to workaround a GC bug is probably no longer needed, right?

(In reply to Wayne Mery (:wsmwk) from comment #3)

Any indicatation this behavior new to version 68?

It's not a recent regression, no.

What is next step?

Someone deciding if it's fine to entirely remove the forced garbage collections in Gloda, or if we need to invest time into making the hack not suck so much for chat messages. The hack is meant to force a GC every 4096 indexed emails, but is also forcing a GC whenever indexing finishes. When using chat, each new chat message triggers a need for re-indexing the current conversation, which happens quickly, and finishes, causing the forced GC to potentially happen (in the worse case) for every chat message exchanged.

Flags: needinfo?(florian)

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

(In reply to Wayne Mery (:wsmwk) from comment #6)

FWIW, GC code is constantly improving, if slowly - https://mzl.la/2DQpaeR

This sounds like you agree that a hack introduced in 2009 to workaround a GC bug is probably no longer needed, right?

Note, the kludge is discussed in bug 465618 comment 23, and implemented in that bug. And 2 months prior a performance patch landed in Bug 465353 - general sluggish, lack of responsiveness during indexing of gloda.

"Probably" may be too strong a word because skepticism is warranted - Core folks don't explicitly benchmark our usecase. I'd use the word hope, because GC is surely better on average today than it was 12 years ago. The theory of whether it is "better enough" can only be tested by removing the code and running some benchmarks (do we still have them?) and having some users test.

Magnus, which do you want to go for first - your comment 4, removing the kludge done in bug 465618, or bug 1535133?

Flags: needinfo?(mkmelin+mozilla)
See Also: → 465618
Attached patch bug1575214_rm_gloda_gc.patch (obsolete) — Splinter Review

Let's remove the manual gc calls and hope other work has made the calls unnecessary.
Florian, do you want to review?

Assignee: nobody → mkmelin+mozilla
Status: NEW → ASSIGNED
Flags: needinfo?(mkmelin+mozilla)
Attachment #9131872 - Flags: review?(florian)
Comment on attachment 9131872 [details] [diff] [review] bug1575214_rm_gloda_gc.patch Review of attachment 9131872 [details] [diff] [review]: ----------------------------------------------------------------- forceGarbageCollection is also called from https://searchfox.org/comm-central/rev/d2a1df50fe2bf321306011a70371f2281f4d8f36/mailnews/db/gloda/modules/GlodaIndexer.jsm#1286
Attachment #9131872 - Flags: review?(florian) → review-

Thanks, removed the last caller.

Attachment #9131872 - Attachment is obsolete: true
Attachment #9132053 - Flags: review?(florian)
Comment on attachment 9132053 [details] [diff] [review] bug1575214_rm_gloda_gc.patch Review of attachment 9132053 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me. Sorry for the delay, I was away last week.
Attachment #9132053 - Flags: review?(florian) → review+

Great progress. This is a major backend change, so we should not uplift to beta but rather let it ride the train for longer testing with fewer users.

Perhaps have some chat and regular mail user specifically test a nightly, both with existing and new profile (to download and index lots of mail), to see to what extent it helps/hurts bug 1535133 and "normal usage".

Component: Instant Messaging → Database
No longer depends on: 1535133
Product: Thunderbird → MailNews Core
See Also: → 1535133

Pushed by thunderbird@calypsoblue.org:
https://hg.mozilla.org/comm-central/rev/58f8cf2d8089
remove gloda manual calls to garbage collection, which were causing lockup a times. r=florian

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 76.0
Pushed by geoff@darktrojan.net: https://hg.mozilla.org/comm-central/rev/47ff041ec696 follow-up - Linting fix. rs=linting DONTBUILD
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: