I have a quite heavy java webapp that serves thousands of requests/sec and it uses a master Postgresql db which replicates itself to one secondary (read-only) database using streaming (asynchronous) replication.
So, I separate the request from primary to secondary(read-only) using URLs to avoid read-only calls to bug primary database considering replication time is minimal.
NOTE: I use one sessionFactory with a RoutingDataSource provided by spring that looks up db to use based on a key. I am interested in multitenancy as I am using hibernate 4.3.4 that supports it.
I have two questions:
- I dont think splitting on the basis of URLs is efficient as I can only move 10% of traffic around means there are not many read-only URLs. What approach should I consider?
- May be,somehow, on the basis of URLs I achieve some level of distribution among both nodes but what would I do with my quartz jobs(that even have separate JVM)? What pragmatic approach should I take?
I know I might not get a perfect answer here as this really is broad but I just want your opinion for the context.
Dudes I have in my team:
- Spring4
- Hibernate4
- Quartz2.2
- Java7 / Tomcat7
Please take interest. Thanks in advance.