I have a Java web application using JSF running on Tomcat 8.5. Each tenant has multiple users and is given their own URL, e.g:
example.com/tenant1 example.com/tenant2 ... example.com/tenant100
This is currently implemented by deploying the same WAR file once for each tenant, so we have
tenant1.war, tenant2.war, ... tenant100.war
Each tenant has their own schema on the same database with their own database login that the app uses via JNDI in Tomcat 8.5. It also uses container managed security to handle user login.
So far this works ok, but startup time is beginning to lag as more tenants (realms) are added - about 3 seconds per WAR file to be deployed. Is there a more efficient way to go about this so that we only use one WAR file, but still have separate databases (or schemas) and security to isolate tenants?
I see that Spring has an approach here and Hibernate multitenancy, but I'm not using JPA/Hibernate or Spring.
Currently running on Tomcat, but I can switch to Wildfly and use some other JEE solution if it exists.
Any more general architectural approaches are also appreciated.