-
Notifications
You must be signed in to change notification settings - Fork 324
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
Amortize the startup cost of some components #10451
Conversation
Building Engine, Context, ApplicationConfig and Ydoc was a adding a rather large delay during the initial startup step as all of those were blocking operations. Moving all of those to the resource initialization step hopes to amortize some of that cost since it can be done in parallel. Had to add a `ComponentSupervisor` (open for a different name suggestion) to ensure that such delayed components are properly closed on shutdown.
private var component: AutoCloseable = null | ||
|
||
def registerService(component: AutoCloseable): Unit = { | ||
assert(this.component == null, "can't register component twice") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK it works because the single component initialization is guaranteed by the LockedInitialization
implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is just a precaution in case someone wants to use in a wrong way.
Shouldn't we have a benchmark that would verify you actually speed language server initialization up with these changes? Such a benchmark shall not be too different from this one - just different arguments, right? |
@JaroslavTulach That benchmark measure startup only of the engine distribution. Whereas, @hubertp was profiling the startup of language server. I am afraid we don't have any benchmarks for language server yet. |
Language server is part of the engine distribution. One just has to use |
@JaroslavTulach That is true. However, for it to be useful, one has to also send some requests, at least acquire capability request (?). If you just start language server by simply running something like |
Pull Request Description
Building Engine, Context, ApplicationConfig and Ydoc was a adding a rather large delay during the initial startup step as all of those were blocking operations.
Moving all of those to the resource initialization step hopes to amortize some of that cost since it can be done in parallel. Had to add a
ComponentSupervisor
(open for a different name suggestion) to ensure that such delayed components are properly closed on shutdown.Important Notes
Adding Ydoc has added a visible delay during startup. I'm hoping that we can amortize some of that with this PR:
Now:
and run in parallel:
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.