Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud_storage: more efficient timequery #11801

Closed
jcsp opened this issue Jun 30, 2023 · 2 comments · Fixed by #13011
Closed

cloud_storage: more efficient timequery #11801

jcsp opened this issue Jun 30, 2023 · 2 comments · Fixed by #13011
Labels
area/cloud-storage Shadow indexing subsystem kind/enhance New feature or request

Comments

@jcsp
Copy link
Contributor

jcsp commented Jun 30, 2023

Time queries currently scan from the start of a segment, even when doing chunked reads. This makes them an order of magnitude more expensive in some cases, compared with if they just read a single chunk.

This can be fixed by using the timestamps in the remote index that were added for 23.2.

However, the cost of doing a timequery will still be one chunk promotion per partition, which is very expensive if you've got e.g. 1000 partitions in a topic: 16GiB of downloads + disk writes to serve one ListOffsets.

It may also make sense to override the chunk size to something smaller when the reader is created for a time query, and/or to implement a "fuzzy mode" for time queries to tiered storage, and just give the caller the nearest indexed offset rather than a precise answer: many applications will not care if they see a few messages before the timestamp they requested, as long as they see all the timestamps after it. This is already the behavior for compressed batches, where we return the offset of the start of the batch rather than the exact record result.

@jcsp jcsp added kind/enhance New feature or request area/cloud-storage Shadow indexing subsystem labels Jun 30, 2023
jcsp added a commit to jcsp/redpanda that referenced this issue Jun 30, 2023
This is a prerequisite to make timequeries seek
to the proper chunk, instead of reading from the
start of segments.

The timestamp we care about is the batch max timestamp,
because timequeries will want to find a batch that is
definitely before the target timestamp, to start their
scan from there.

Related: redpanda-data#11801
jcsp added a commit to jcsp/redpanda that referenced this issue Jun 30, 2023
This is a prerequisite to make timequeries seek
to the proper chunk, instead of reading from the
start of segments.

The timestamp we care about is the batch max timestamp,
because timequeries will want to find a batch that is
definitely before the target timestamp, to start their
scan from there.

Related: redpanda-data#11801
jcsp added a commit to jcsp/redpanda that referenced this issue Jul 3, 2023
This is a prerequisite to make timequeries seek
to the proper chunk, instead of reading from the
start of segments.

The timestamp we care about is the batch max timestamp,
because timequeries will want to find a batch that is
definitely before the target timestamp, to start their
scan from there.

Related: redpanda-data#11801
jcsp added a commit to jcsp/redpanda that referenced this issue Jul 3, 2023
This is a prerequisite to make timequeries seek
to the proper chunk, instead of reading from the
start of segments.

The timestamp we care about is the batch max timestamp,
because timequeries will want to find a batch that is
definitely before the target timestamp, to start their
scan from there.

Related: redpanda-data#11801
jcsp added a commit to jcsp/redpanda that referenced this issue Jul 4, 2023
This is a prerequisite to make timequeries seek
to the proper chunk, instead of reading from the
start of segments.

The timestamp we care about is the batch max timestamp,
because timequeries will want to find a batch that is
definitely before the target timestamp, to start their
scan from there.

Related: redpanda-data#11801
jcsp added a commit to jcsp/redpanda that referenced this issue Jul 10, 2023
This is a prerequisite to make timequeries seek
to the proper chunk, instead of reading from the
start of segments.

The timestamp we care about is the batch max timestamp,
because timequeries will want to find a batch that is
definitely before the target timestamp, to start their
scan from there.

Related: redpanda-data#11801
jcsp added a commit to jcsp/redpanda that referenced this issue Jul 11, 2023
This is a prerequisite to make timequeries seek
to the proper chunk, instead of reading from the
start of segments.

The timestamp we care about is the batch max timestamp,
because timequeries will want to find a batch that is
definitely before the target timestamp, to start their
scan from there.

Related: redpanda-data#11801
@dotnwat
Copy link
Member

dotnwat commented Oct 2, 2023

@VladLazar @Lazin is this different than #13125? In that issue one of the observed behaviors is "Observe high delays or missing timestamps" which sounds pretty similar to "more efficient timequery".

@VladLazar
Copy link
Contributor

@VladLazar @Lazin is this different than #13125? In that issue one of the observed behaviors is "Observe high delays or missing timestamps" which sounds pretty similar to "more efficient timequery".

This issues (11801) was more generic than the one Evgeny created. The goal here was to hydrate less data in the general case. 13125 is more about what happens when the timestamps are bad (either due to config batches or user provided ts skew), so it's a more specific case. We had the exact same issues when improving the local storage timequery a while back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cloud-storage Shadow indexing subsystem kind/enhance New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants