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

Slow application startup time due to increased datasource configuration time #609

Open
puneetbehl opened this issue Aug 31, 2022 · 2 comments

Comments

@puneetbehl
Copy link
Contributor

puneetbehl commented Aug 31, 2022

When using the old version 7.3.0, the application starts up in ~4 minutes. But when using the newer version that the Grails cli defaults to for a Grails 4.1.1 application (which is hibernate-core:5.4.18.Final), it takes the application >15 minutes to start.

The application is using Multi-Tenancy with over 40 datasources. In 4.0.3/GORM 7.0.4/Hibernate 5.4.0, it takes ~6--7 seconds to configure each datasource. We are trying to move the app to 4.1.1/GORM 7.0.9/Hibernate 5.4.18. With that configuration, each datasource is now taking ~20-25 seconds to configure.

We've noticed that if we go back to Hibernate 5.4.0 we get the old faster startup time, however there are places in the code where we do the following:

MultiTenantDomain.withSession { Session session->
    session.doWork(...
}

Which now appears to throw an exception of

Caused by: java.lang.NoSuchMethodError: 'void org.hibernate.SharedSessionContract.doWork(org.hibernate.jdbc.Work)'

Originally report by billgonemad and osh Overbeck on Grails Slack.

@puneetbehl
Copy link
Contributor Author

Hibernate 5.4.11 is the first version of hibernate where the start-up slows down considerably. unfortunately, we are still getting the exception with 5.4.10

@billgonemad
Copy link
Contributor

@puneetbehl We were able to get Hibernate 5.4.0 to work. The method throwing the exception was annotated with @GrailsCompileStatic and removing that seems to fix the issue with using the older hibernate version.

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

No branches or pull requests

2 participants