You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: thread pool for parallel shard I/O + plan caching + connection pool fixes
Three performance optimizations to improve distributed query throughput:
1. Thread pool (thread_pool.h): Pre-spawned worker threads replace std::async
for parallel shard dispatch. ~1-2us dispatch overhead vs ~200us for thread
creation. Shared across all sessions in the stress test.
2. Plan caching (session.h): Repeated identical SQL strings skip the full
parse -> plan -> optimize -> distribute pipeline. Cached plans reuse the
parser's arena for plan tree validity across calls.
3. Connection pool improvements:
- Removed mysql_ping() on checkout (was adding ~200us RTT per checkout)
- Per-backend mutexes instead of global lock (eliminates cross-shard contention)
- Direct mysql_real_query with StringRef (avoids std::string copy)
Results vs Vitess (peak QPS):
- aggregation: 44.5K vs 34.5K (+29%, WIN)
- sort_limit: 51.6K vs 41.5K (+24%, WIN)
- count_star: 10.6K vs 47K (still behind -- bottleneck is MySQL connection overhead)
0 commit comments