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

feat: speedup startup time by excluding jars #19395

Merged
merged 8 commits into from
May 27, 2024

Conversation

tltv
Copy link
Member

@tltv tltv commented May 16, 2024

Optimize class scanning of VaadinServletContextInitializer by excluding some commonly used jars and add support for vaadin.blocked-jar boolean property in META-INF/VAADIN/package.properties to exclude whole jar content from the class scanner.

Fixes: #19112

Optimize class scanning of VaadinServletContextInitializer by excluding some commonly used jars and add support for vaadin.blocked-jar boolean property in META-INF/VAADIN/package.properties to exclude whole jar content from the class scanner.

Fixes: #19112
Copy link

github-actions bot commented May 16, 2024

Test Results

1 102 files  + 2  1 102 suites  +2   1h 19m 7s ⏱️ +12s
7 042 tests + 4  6 993 ✅ + 4  49 💤 ±0  0 ❌ ±0 
7 377 runs  +16  7 318 ✅ +16  59 💤 ±0  0 ❌ ±0 

Results for commit 95e0a66. ± Comparison against base commit 350ca83.

♻️ This comment has been updated with latest results.

@mcollovati mcollovati self-requested a review May 20, 2024 11:37
Comment on lines 77 to 92
private static final List<String> DEFAULT_SCAN_NEVER_JAR = Stream.of(
"antlr", "logback-classic", "logback-classic-core",
"commons-codec-", "commons-fileupload", "commons-io",
"commons-logging", "commons-exec", "commons-lang", "jackson-",
"atmosphere-runtime", "byte-buddy", "commons-compress",
"aspectjweaver", "hibernate-core", "hibernate-commons",
"hibernate-validator", "jboss-logging", "/selenium-", "slf4j",
"/spring-", "org/webjars/bowergithub", "snakeyaml",

"javax.", "jakarta.", "kotlin-",

"gwt-elemental", "javassist", "javaparser-core",
"javaparser-symbol", "oshi-core", "micrometer-", "nimbus-jose-jwt",

"/hilla-engine-core-", "/hilla-engine-runtime-",
"/hilla-parser-jvm-", "/hilla-runtime-plugin-").toList();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity: why some of the patterns start with / and others not?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably add jooq and jooq- to the list, since JOOQ is a quite popular library.
And also some additional Vaadin transitive dependency, such as directory-watcher, classgraph, jsoup, throw-if-servlet3, ph-css, ph-commons, gentyref

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pattern is checked with contains function. Concern with these patterns is that someone may add custom-hilla-engine-core.jar, which may or may not have Vaadin classes. Starting with slash ensures that we don't accidentally exclude too much. Some of the names are less risky than others. Your suggestions seems safe except jsoup, which could be /jsoup.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matching to jar file name only will simplify this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to take that back. We still need the slash in the beginning e.g. for vaadin-spring-*.jar which caused issues as it was blocked.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see

Fixed null jar path. Checking jar name only instead of full paths. Added more default excluded jar name patterns. Added IT for a jar excluded by default.
@vaadin-bot vaadin-bot added +1.0.0 and removed +0.0.1 labels May 22, 2024
tltv added 2 commits May 23, 2024 09:57
Added more default blocked patterns.
Added support for /META-INF/VAADIN/blocked-jars.list to override default blocked jar list.
Copy link
Collaborator

@mcollovati mcollovati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Great job @tltv

@vaadin-bot vaadin-bot added +0.0.1 and removed +1.0.0 labels May 24, 2024
Copy link

sonarcloud bot commented May 24, 2024

Quality Gate Passed Quality Gate passed

Issues
48 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@mcollovati mcollovati merged commit 6105952 into main May 27, 2024
26 checks passed
@mcollovati mcollovati deleted the feat/19112-speedup-startup branch May 27, 2024 06:41
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.5.0.alpha1 and is also targeting the upcoming stable 24.5.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Speedup startup and reload time of 24.4
3 participants