-
Notifications
You must be signed in to change notification settings - Fork 23.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[POC][IMP] mail, *: post creation messages in batch. #61237
base: master
Are you sure you want to change the base?
Conversation
Promising change for performance, let me know when it's getting ready for review. |
I still wonder if it would not be better to first clean some low level methods in mail thread and re-order the way we post and notify before trying to post in batch ... especially that as import does not go through any thread code your performance improvements are mainly useful for populate which is not a production tool. |
IMO it's ready (the error in the enterprise build is strange, I launched a rebuild), but we will have to convince tde ^^.
IMO, any gain is good to take... populate may be a side tool, but I hope it's gonna be used more in the future (I use it a lot already to test some ORM stuff on large recordsets). |
Heeee, why closing ? |
Why not? |
Snif. |
d281620
to
a5ed8a4
Compare
for identical messages posted in multiple threads.
Performance gain of up to 25% of the time in the case of models with specific mail subtypes (e.g. project task or any model specifying _creation_subtype() method).
When creating projects tasks, _creation_subtype is called once by record created. As ref always trigger a database query to verify the record still exists, by using the cached value instead, we avoid n-1 queries (gaining between 1 & 2 % of the creation time).
a5ed8a4
to
8489a59
Compare
Even if a creation subtype is specified on the model.
project.task
records population is unexpectedly slow.Performance analysis has shown a major bottleneck in mail, in the
mail.thread
create override.mail_followers._insert_followers
(8%` of the population time)message_post
calls (45% of the population time)When a specific mail subtype is given for creation on the model (
_creation_subtype
method), the messages are not loggedin batch but posted one by one through
message_post
.This PR aims to improve the project population performance, mainly by targeting mail related performance problems.
message_post
to allow posting identical messages in batch, on multiple threads (and its overrides).And use it in
mail.thread.create
to post messages in batches, even when specific mail creation subtype are specified, postingone batch by mail subtype specified (as some models may use different subtypes for different records of same model).
message_post
related methods (message_post_after_hook
, ...) and their overrides:Perf gains:
Population Time:
~100s --> ~60s
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr