[MAGNOLIA-8213] Parallelization of startup Created: 22/Oct/21  Updated: 11/Sep/23

Status: Open
Project: Magnolia
Component/s: core
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Marc Johnen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2021-10-22-17-27-24-769.png    
Issue Links:
Relates
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

I made some changes to the core to parallelize the starup. On my system this accelerates the startup by approx. 25%. It is a proof of concept to show what is possible, but still seems solid to me and might even be good enough for production.

Mainly the startup of modules in ModuleManagerImpl is parallelized. It relies on CompletableFuture and has a simple, but working logic that leaves room for improvement. Now as many threads as modules are started at the same time and each of them checks if the modules that it depends on have started before starting itself. A more elegant solution would be to create threads for starting a module that start when the threads of the modules it depends on have finished, but this needs a more complicated logic of breaking down the module hierarchy. Not too complicated, but may need some time to implement.
On top I made some other methods run async like info.magnolia.config.source.yaml.YamlConfigurationSource.loadAndRegister. 
We might be able to also squeeze some seconds out of info.magnolia.cms.beans.config.ConfigLoader.getMainComponents() and the GuiceComponentProviderBuilder, but so far I haven't managed.



 Comments   
Comment by Marc Johnen [ 22/Oct/21 ]

I made some changes to the core to parallelize the starup. On my system this accelerates the startup by approx. 25%.
As suggested on  https://wiki.magnolia-cms.com/display/WIKI/Contribution+Guidelines I created this ticket and wanted to create a branch.

The only branch I can branch of is the rest-client-ui, I would like to branch the core of
https://git.magnolia-cms.com/projects/PLATFORM/repos/main/browse

Thanks

Marc

 

Comment by Jan Haderka [ 25/Oct/21 ]

Hi Mark,

you first need to fork the core and then select your fork in the "repository". Only then you can select master branch as one you want to branch from. In your screenshot you have not selected repository yet.

Comment by Mercedes Iruela [ 25/Oct/21 ]

Hello Marc,

Have you created a fork before? In addition, from the screenshot it seems that Repository has not been selected, remember that you need to choose one, have you found any issue selecting it?

Regards,
Mercedes

Comment by Marc Johnen [ 25/Oct/21 ]

Thank you Jan and Mercedes, I had to fork the repo first and pushed my changes to https://git.magnolia-cms.com/users/marc.johnen/repos/main/commits?until=refs%2Fheads%2Fconcurrency-6.2.12  

Comment by Mercedes Iruela [ 25/Oct/21 ]

Hello Marc,

it seems that the code is not public. You should be able to create a PR (step 4 in the Contributions guidelines) or make it public from git repository settings.

Regards,
Mercedes

Comment by Marc Johnen [ 25/Oct/21 ]

Hi Mercedes, I did both now, thanks.

Generated at Mon Feb 12 04:30:39 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.