[KEYCLOAK-19847] - Optimizations and refactoring for better/stable startup time#8928
Conversation
3d0e9b7 to
9a57ba7
Compare
There was a problem hiding this comment.
Ideally, I think we should use YAML in our configuration files. But I do not want to bring this discussion now but just make sure we avoid the cost of XML parsing at runtime.
DGuhr
left a comment
There was a problem hiding this comment.
some comments, but nothing which should prevent this from being merged. Nice work! 👍
There was a problem hiding this comment.
Perhaps better call it DefaultCliFactory or e.g. DefaultPicoCliFactory? This sounds a bit too generic for me
There was a problem hiding this comment.
I don't mind. The class is within the cli package though. isn't redundant to change the name as you are proposing?
Whatever works best for you.
There was a problem hiding this comment.
I'd like DefaultCliFactory then, if you dont mind too much, but also not hard on this :) true, redundant, but just a bit more easy qhen searching all classes and makes the intention more clear.
There was a problem hiding this comment.
can we merge this with the surrounding if()?
There was a problem hiding this comment.
again: merge this with the surrounding if()?
There was a problem hiding this comment.
fyi: this is not enough validation. e.g. ./kc.sh start-dev --db-password= doesstill work. But it's a good place to check for it :) I have some changes in my branch which we should merge later on, which also do some sanity checking of the actual value.
There was a problem hiding this comment.
do we really not care here when delete returns false? (so we fail to delete this file?)
There was a problem hiding this comment.
No, we do not. Dealing with that only complicates code, I think.
There was a problem hiding this comment.
can we also call this KC_PERSISTED_PROPERTIES or sth so we don't get confused? bc. we also have keycloak.properties file :)
fb16a10 to
7c97d44
Compare
|
Minor changes, there's 42 files changed ;) Could you please describe what the changes are in the description or JIRA? |
7c97d44 to
045a0a0
Compare
|
In terms of startup time, I expected that we have a more stable startup time around 3.5/3.6s. We should have here an improvement of around ~200-300ms. At least for me, the upstream version varies a lot from 3.6 - 4.s. Note that the time above also takes into account the stop time. The configuration was set as follows: No clustering. With clustering, I also got a better startup time (using default udp stack) mainly when another node is joining. Flame graphs are pretty much the same between upstream and these changes. Except for Picocli related frames when running the fast-path ( |
|
@DGuhr We are really taking milliseconds here. Any idea on how to reduce even more is very appreciated. |
|
@DGuhr I'm wondering if we should introduce a specific It should help to focus on startup time only. A sample result is: A bit better than before and the time stable at: Stop time keeps around 0.025-0.030s. |
045a0a0 to
214707e
Compare
Basically:
buildif you replace the classpath in the distribution, and we can potentially make our defaultconf/keycloak.propertieseven simpler by just having there the production settings.KeycloakProcessorso that we have steps better grouped on a per-area basis. It should also help make it easier to optimize re-augmentation as build steps are run in parallel.startcommand is executed without any option. This is the main usage people should consider for better startup time. We are basically avoiding running unnecessary code related to CLI args parsing and Picocli bootstrapping. It should also simplify the Picocli related code.KeycloakConfigSourceProviderwhen looking up persisted properties before the server is starting (e.g.: still processing CLI commands/options before starting the server). This is mainly important when re-augmenting the server because re-augmentatoin runs in a different classloader.QuarkusKeycloakApplication.