Closed Bug 1669872 Opened 5 years ago Closed 5 years ago

GloDa indexing messages smashes the address book

Categories

(MailNews Core :: Database, defect, P1)

Unspecified
All

Tracking

(thunderbird_esr78+ fixed, thunderbird82 fixed)

RESOLVED FIXED
83 Branch
Tracking Status
thunderbird_esr78 + fixed
thunderbird82 --- fixed

People

(Reporter: darktrojan, Assigned: darktrojan)

References

Details

(Keywords: regression)

Attachments

(3 files)

For every message GloDa indexes, and every email address in that message, it asks the address book to find a contact. In the worst case if there is no such contact, every directory must look through its entire database to find nothing.

In this bug I'm going to cache the results of the lookup so that when the same address is looked up a second time the address book is not hit. Given that this cache will collect every address ever seen (whether or not it's in the address book, and whether or not the address will ever be seen again) I'll clear the cache when GloDa stops indexing.

I didn't do a benchmark of try build vs beta, but results seem positive - tested with my luwsm account, 5k message inbox, very responsive, message bodies display quickly, even though activity manager shows indexing is still in progress. (but potentially my results skewed by using phone hotspot - a temporary situation)

Flags: needinfo?(geoff)
Flags: needinfo?(geoff)
Target Milestone: --- → 83 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/6171c903abd1
Try to avoid using the address book database when indexing messages. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED

I just fired up my "production" beta profile with the try build. It is definitely better.

What other locations likely use AB lookup that may see significant performance impact? Filters? Calendar? Any addons?

Oh yuck, I suspect this code is pretty hot too, and it does almost exactly what the GloDa code does. Maybe I should generalise what I've done in this bug and put it somewhere more useful.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

This is more general than the previous version so that other code can call it too. I also realised with the 60s time out, waiting for Gloda to idle was unnecessary.

Severity: -- → S2
OS: Unspecified → All
Priority: -- → P1
Version: unspecified → 78
Blocks: 1631631

Big improvement to open it up to other callers but why not make this cache permanent? Maintenance on a card change is very simple; just add those listeners and replace/add/delete the cache entry. That is the most performant and best practices way to do it. Doubt memory is an issue (but it could be modeled).

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/2efdb12bede3
Create a cached function which calls cardForEmailAddress on all directories. r=mkmelin

Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED

Comment on attachment 9180659 [details]
Bug 1669872 - Create a cached function which calls cardForEmailAddress on all directories. r?mkmelin

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined: Lots of slow things
Testing completed (on c-c, etc.): On c-c since last week
Risk to taking this patch (and alternatives if risky): Not much, this is just a cache, and it's only used in places where 100% accuracy isn't critical.

The other patch in this bug will need to land first, but it's almost entirely wiped out by this patch, so it'd probably be tidier if they were rolled together.

Attachment #9180659 - Flags: approval-comm-esr78?
Attachment #9180659 - Flags: approval-comm-beta?

Comment on attachment 9180659 [details]
Bug 1669872 - Create a cached function which calls cardForEmailAddress on all directories. r?mkmelin

[Triage Comment]
Approved for beta

Attachment #9180659 - Flags: approval-comm-beta? → approval-comm-beta+

As suggested, this is the combined version of the two patches that landed on comm-central, intended for uplift.

[Triage Comment]
Previous un-combined version approved by wsmwk.

Attachment #9181038 - Flags: approval-comm-beta+

Comment on attachment 9181038 [details] [diff] [review]
1669872-gloda_cache_functions_COMBINED.patch

[Triage Comment]
Approved for esr78 (I assume combined is also what is wanted for esr)

Attachment #9181038 - Flags: approval-comm-esr78+

Comment on attachment 9180659 [details]
Bug 1669872 - Create a cached function which calls cardForEmailAddress on all directories. r?mkmelin

[Triage Comment]
for 78 we used attachment 9181038 [details] [diff] [review] 1669872-gloda_cache_functions_COMBINED.patch

Attachment #9180659 - Flags: approval-comm-esr78? → approval-comm-esr78-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: