PlayerSync/src/main
laforetbrut d60b8eb01e Add connection pool - fix 10% server thread usage from MySQL connects
Spark showed PlayerSync consuming 10.16% of the server thread, almost
entirely from DriverManager.getConnection() (TCP handshake + MySQL auth
+ USE db) called for EVERY single query. With auto-save every 60s,
each player generated ~6 new connections per save cycle on main thread.

FIX: Simple connection pool (LinkedBlockingQueue, 5 connections).
- Connections are reused instead of opened/closed per query
- isValid(2) check before reuse to detect dead connections
- returnConnection() puts connections back in pool instead of closing
- QueryResult.close() also returns to pool
- autoReconnect=true in JDBC URL for resilience
- shutdownPool() for clean server stop
- Non-database connections (startup DDL) bypass the pool

Expected improvement: ~90% reduction in MySQL overhead on server thread.

Vyrriox
2026-03-26 21:13:17 +01:00
..
java/vip/fubuki/playersync Add connection pool - fix 10% server thread usage from MySQL connects 2026-03-26 21:13:17 +01:00
resources add cobblemon support(in test) 2025-12-15 22:47:47 +08:00
templates add cobblemon support(in test) 2025-12-15 22:47:47 +08:00