I'm trying to turn an old monolithic application into microservices. The old system is a multitenant system with shared database and shared tables, only the tenant_id column identifies the tenant. According to the new specifications, each tenant will have access to its database.
I know that in java opening a connection to a database is very expensive in terms of resources and time, in fact the use of connection pooling is highly recommended, but in a real situation I will have 50/60 microservices and about 400 tenants.
Searching online I found many solutions to manage the connection pool in an optimized way but none suitable for a multitenant situation. What could be a performing architectural solution?