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 |
||
|---|---|---|
| .. | ||
| java/vip/fubuki/playersync | ||
| resources | ||
| templates | ||