TheTransitClock / transitime

TheTransitClock real-time transit information system
GNU General Public License v3.0
78 stars 29 forks source link

Replace DbConfig's globalSession with connection pool #231

Open sheldonabrown opened 3 years ago

sheldonabrown commented 3 years ago

Is your enhancement request to replace an existing functionality within TheTransitClock? Replace error-prone checks to determine if existing Hibernate session is valid.

Is your enhancement request related to a problem? Please describe. TTC self manages its Hibernate sessions leading to durability and resiliency issues should a database connection drop (such as during a database restart). TTC has been shown to not recover properly after a database restart, its performance will continue to degrade until it eventually fails completely.

Describe the solution you'd like TTC's Hibernate session management should be replaced with a connection pool that allows for validation of connections. Specifically DbConfig.getGlobalSession should return a valid connection from a connection pool instead of caching a single connection.

Additional context The test case I'm most concerned with is demonstrating TTC can survive a database restart. New Trips should continue to load before and after a database restart, as an example.