Skip to content
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

refactor: optimize service extensions boot process #4590

Merged

Conversation

ndr-brt
Copy link
Member

@ndr-brt ndr-brt commented Oct 29, 2024

What this PR changes/adds

Another optimization PR. Main focuses:

  • scan @Provider annotation only once in the DependencyGraph, then:
    • keep the default providers in the injection point
    • keep the non-default providers in the injection containers
  • simplify all the life cycle logic, removing all the Phase class hierarchy overhead, so now the lifecycle is easily readable in the ExtensionLifecycleManager, plus, less objects are instantiated at startup (before it was 4 for every extension)
  • remove the injection container validation, no point in doing that because it's already done by the DependencyGraph

The improvements registered by starting an EDC runtime with 78 extensions approx the 15% (mean values out of 10 runs):

  • without the refactor it takes approx 2700 millis to startup
  • with the refactor it takes approx 2240 millis to startup

Why it does that

startup optimization

Further notes

List other areas of code that have changed but are not necessarily linked to the main feature. This could be method
signature changes, package declarations, bugs that were encountered and were fixed inline, etc.

Linked Issue(s)

Closes # <-- insert Issue number if one exists

Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.

@ndr-brt ndr-brt added enhancement New feature or request refactoring Cleaning up code and dependencies labels Oct 29, 2024
@ndr-brt ndr-brt requested a review from wolf4ood October 29, 2024 15:37
@ndr-brt ndr-brt force-pushed the refactor-extension-lifecycle branch from 70463dd to 4e3edcd Compare October 29, 2024 15:44
@ndr-brt ndr-brt marked this pull request as ready for review October 29, 2024 15:56
@ndr-brt ndr-brt force-pushed the refactor-extension-lifecycle branch from 4e3edcd to ae1f68c Compare October 29, 2024 16:01
@jimmarino
Copy link
Contributor

One note let's not make the bootstrap process multithreaded (it is single-threaded by design). I've seen this with other runtimes and it has generally resulted in a highly complex process where all operations must be thread-safe for very little (and possibly) slower performance gains.

@ndr-brt ndr-brt merged commit ecb2d09 into eclipse-edc:main Oct 30, 2024
27 checks passed
@ndr-brt ndr-brt deleted the refactor-extension-lifecycle branch October 30, 2024 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring Cleaning up code and dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants