Slow application startup time due to increased datasource configuration time
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
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](https://app.slack.com/team/UFZC8J0CQ) and [osh Overbeck](https://app.slack.com/team/U01DALZULVD) on Grails Slack._
Contributor guide
Research direction
No repository files, tests, or entry points are named. Reproduce startup with 40+ datasources while comparing Hibernate 5.4.0 with 5.4.18.Final, and inspect the MultiTenantDomain.withSession/doWork path; done means the regression is explained and startup configuration time or the compatibility failure is addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100