apache / apache/pinot

Rework `PinotByteBuffer` to allow batch operations

Open
#7,747 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.5k
Avg merge
2d 3h
Merged PRs (30d)
195

Description

Aggregation performance appears to be bottlenecked on `DirectByteBuffer` bounds checks, as can be seen in this profile taken from a pinot server in a live system executing group by queries (among other things) - nearly 30% of samples were in `Buffer.checkIndex`.

Screenshot 2021-11-11 at 11 16 33

Screenshot 2021-11-11 at 11 15 05

These checks can usually be eliminated when the accesses are sequential, e.g. within a counted loop with a known bound. #7708 produced a ~5x speedup be reducing the number of accesses to `PinotDataBuffer` by a factor of 8, but a more general technique applicable to aggregations would be to pass a primitive array to be filled in a for loop, rather than assume `PinotDataBuffer.getX` calls behave like array accesses. This would have to support the Cartesian product of numeric types to support some of the conversions we need (e.g. `int` to `double`)

Contributor guide

Open the contributing guide

Research direction

Start by tracing PinotByteBuffer and PinotDataBuffer accesses in aggregation code, then review the bounds-check profile and the approach from #7708. Determine the batch API and numeric-type conversions needed for sequential reads. Done means aggregations can use batch operations without the current per-access bounds-check bottleneck.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.