[16.0][IMP] make odoo start up (much) faster#1339
Conversation
|
odoo#254660 seems to solve part of the problem. the problem was much worse before that. |
|
I'd like to give my 2 cents on this, but please note that this is my personal opinion and I don't speak on behalf of Odoo. In my opinion, I do believe this approach is better instead of attempting a preload of the entire cache of Also, I don't think removing the default argument value of Unfortunately though, such PR is very unlikely to be accepted in stable version since we try to minimize changes on that level unless it's absolutely necessary and we can find exact examples where this change would make a significant difference. |
|
what you guys should do is try to get such things merged in more recent Odoo version (the supported ones 17, 18 or 19) and then we could eventually backport it. Also to get such a thing merged into odoo/odoo, you better target 19 or master but don't fool yourself, the likehood to get somebody at Odoo look at a community PR is extremely low anyway, sadly. But I mean if there is a way this is the way... |
* to find out static file paths, instead of loading the manifest of all
modules found on the addons_path, load them only as they are needed.
this solves 3 problems:
1. it makes odoo start up much faster, as only the manifest of the
modules of which static files are accessed are loaded instead of
traversing the whole addons_path, searching for modules and loading
all the manifest files.
2. it avoids a race condition at startup in threaded mode, where
multiple threads access Application.statics while it has not been
computed yet, resulting in each thread computing it, further
slowing down the startup.
3. if the same module is available multiple times on the addons_path,
the first one found will be used for static files instead of the
last one found, what does not match the loading of the other files.
* remove the default argument value of _get_manifest_cache() and fix
calls to include the value, to be able to re-use the cached values
instead of re-computing them without the argument.
90eda35 to
ef26f60
Compare
|
@MohamedKasem99 @rvalyi thank you for your answers and taking the time to look into this. about the thread lock, i was hesitant, as i read somewhere that not all operations on about with your example function: the problem here comes from the fact that because of this, we end up with 2 cached values for each module in |
1195afa to
3eef414
Compare
|
I can't really speak for the reasons behind the delays on merging community PRs. I try to look at the ones I get a chance to but I'm not sure about other teams priorities at the moment. The changes made in my original PR have been forward ported to more recent Odoo versions so that part at least is already fixed in the current stable versions. @huguesdk Yes you're right actually I must've gotten the implementation wrong of the |
as per this doc, odoo doesn’t accept contributions on 16.0 anymore, so i’m submitting it here.
description of the issue/feature this pr addresses:
addons_path, load them only as they are needed. this solves 3 problems:addons_path, searching for modules and loading all the manifest files.Application.staticswhile it has not been computed yet, resulting in each thread computing it, further slowing down the startup.addons_path, the first one found will be used for static files instead of the last one found, what does not match the loading of the other files._get_manifest_cache()and fix calls to include the value, to be able to re-use the cached values instead of re-computing them without the argument.current behavior before pr:
odoo takes a long time to start up, especially when there are many modules on the
addons_path.desired behavior after pr is merged:
odoo starts up in a matter of seconds.
i confirm i have signed the cla and read the pr guidelines at www.odoo.com/submit-pr