M3Query improvements
General
- [ ] Remove hand-rolled json writers in favor of using a common library (https://github.com/m3db/m3/issues/1144)
- [x] Remove use of global Zap logger usage in favor of
src/x/instrumentlogger which uses Zap and usesrc/x/test/NewLoggerin tests - [ ] Potentially refactor the physical/execution plan and controller to simplify it and be able to more easily add tracing in a single place (rather than adding it on a per-function level)
- [x] Refactor
executor.Engineto be an interface to allow us to mock it in tests.
Add benchmarker and correctness tester
- [x] Look at Prombench again, if possible make use of its query generation engine to build a tool to generate valid queries and hit them against both Prom and m3q to verify correctness
- [x] Run prombench against m3query to identify areas to improve performance
- [x] Potentially add hooks into our CI process that would run diffs vs prombench to ensure correctness and no perf degradation
Introduce pooling to intermediary blocks
- [ ] Ensure block closing logic will not cause blocks to be double-closed or to hang around for too long
- [ ] Add pools to ColumnBlockBuilder
- [ ] investigate adding a RowBlockBuilder which would be optimized for series-wise traversal vs row-based traversal, possibly with some of the downstream
Series consolidation
- [ ] Improve options for series consolidation after fetches (functionality here may change based on how indexing will look - may have different paths for dealing with a centralized index compared with index per namespace)
Function improvements
- [ ] Translate function arguments to parameters in the parsing step rather than sending
interface{}and making functions - [x] Remove NaNs from output during processing
- [x] Make OffsetBlock into a more generic DeferredBlock (something like: take in a row transform, a column transform, and a time transform) (#1638)
- [x] Refactor remaining lazy functions to use this DeferredBlock
- [ ] Enable multi-target querying (potentially re-use fetch results)
Block splitting logic
- [ ] Enable block splitting logic
- [ ] Ensure that nowhere matches series by order across block boundaries
- [ ] Remove forced padding for block splitting logic
- [ ] Refactor series consolidation at the end of processing to be a separate step (maybe as a function)
Future work
- [ ] Dynamic function optimization (less essential with DeferredBlock)
- [ ] Reuse fetches (potentially do something clever about combining into a single fetch? not sure it's useful though)
- [ ] Optimized remote function execution (e.g. functions like
sumrun on multiple DCs can be run remotely first, then have post-aggregated results sent rather than just performing the fetch remotely) - [ ] Centralized index support
- [ ] Support M3QL
One thing interesting about the JSON writers, the major reason in the past we did that is because the default JSON marshaller allocates a lot, however if we have JSON write methods for bytes/strings/whatever other concrete types we can avoid allocations when returning responses (which is what we have today with the current common library streamjson writer).
Sounds good; was going to add a few benchmarks around the handrolled JSON writer since figured that we were using it on our legacy stack for a reason :p
One thing interesting about the JSON writers, the major reason in the past we did that is because the default JSON marshaller allocates a lot, however if we have JSON write methods for bytes/strings/whatever other concrete types we can avoid allocations when returning responses (which is what we have today with the current common library
streamjsonwriter).
For sure; I think the ideal is to use a codegenned marshaller (or other speedy JSON implementation). https://github.com/m3db/m3/issues/1144 has some suggestions from another contributor.
Do we want to add tracing to more paths?
Also, as an aspirational goal, how about removing time from blocks and just using step size?
@gibbscullen Is this issue tracked in another issue?
Closed as part of effort to clean up stale issues. Re-opening as still interest in tracking issue.