I would like to understand how to efficiently define connection pooling for multiple data sources ( in runtime) for 1000 tenants with single database per tenant, in spring boot.
- Datasources are static in nature and are stored in a map with tenant id as key and data source as the value. This does not seem scalable as we are having 1000+ tenants and they can be added/removed at runtime. Referred the following links for the same:
- https://spring.io/blog/2022/07/31/how-to-integrate-hibernates-multitenant-feature-with-spring-data-jpa-in-a-spring-boot-application
- https://www.baeldung.com/multitenancy-with-spring-data-jpa