terrymanu commented on issue #34155:
URL:
https://github.com/apache/shardingsphere/issues/34155#issuecomment-3565099871
• Problem Understanding
This is a feature request to add SQLStatementParserCacheHook that exposes
cache-miss SQL to applications for warm-up, reducing first-query parsing
latency. It’s not a defect in existing behavior.
Root Cause
The current parse cache uses an internal Caffeine LoadingCache
(SQLStatementParserEngine, etc.). On a miss it parses and backfills, with no
external event/SPI. Adding a hook would insert callbacks into the hot
parsing path, increasing coupling and overhead.
Analysis
- This is an extension idea, not a bug.
- Hooking the core parsing path conflicts with keeping ShardingSphere
lightweight.
- Warm-up can already be done externally: apps/ORMs/gateways can call
parse or run representative SQLs during startup to fill the cache, and tune
cache sizes to reduce misses.
- If the goal is to collect missed SQLs and warm them, that can be handled
in the application layer without kernel changes.
Conclusion
Do not add a kernel hook for this; keep the core lean. Handle SQL warm-up
in the application/ORM layer (run typical SQLs at startup or record-and-warm
externally) and use appropriate cache settings to mitigate
cold-start costs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]