PERF: Avoid duplicate HEAD requests for file size with S3 endpoint - #974
Merged
rapids-bot[bot] merged 2 commits intoJun 2, 2026
Merged
Conversation
Our S3 implementaiton made two HEAD requests on S3 urls in "AUTO" mode (the only mode that's exposed to libcudf users). 1. A first HEAD request to test S3 credentials 2. A second HEAD request to get the file size We can avoid the second HEAD request by reusing the response to the first HEAD request when we go to actually open the file.
TomAugspurger
marked this pull request as draft
June 1, 2026 13:50
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
TomAugspurger
marked this pull request as ready for review
June 1, 2026 14:12
Contributor
Author
|
I'm looking into the final HTTP head request. This comes from the |
This was referenced Jun 1, 2026
Contributor
Author
|
/merge |
rapids-bot Bot
pushed a commit
to NVIDIA/cudf
that referenced
this pull request
Jun 28, 2026
…ints (#22739) Currently, reading, say, parquet metadata or data from a remote source with kvikio requires several HTTP requests. See #22667 (comment) and rapidsai/kvikio#974 for more, but a couple of these HTTP requests are `HEAD` requests used to get the size of the file. This updates libcudf to provide a way to bypass those `HEAD` requests when the file size is known in advance (#22734 is an example case where we already know the file sizes thanks to a `list` operation). To do this, we expand `SourceInfo` to accept a (list of) simple `plc.io.types.FilepathSource(url, size=content_length)` objects. For example, `read_parquet_metadata` both without and with file sizes: <img width="942" height="438" alt="image" src="https://github.com/user-attachments/assets/1f14237c-66b4-4c29-a03d-c5d57c735ba7" /> and `read_parquet`: <img width="1592" height="441" alt="image" src="https://github.com/user-attachments/assets/06dfcde0-8c3c-4cb7-a37e-d0c9d66efc46" /> Note the lack of `kvikio::RemoteHandle::open` calls in the kvikio domain under the `with-size` annotations. These came from the following script: <details> ```python import boto3 import nvtx import pylibcudf as plc bucket = "rapids-tpch" key = "scale-10/nation/part.0.parquet" url = f"s3://{bucket}/{key}" with nvtx.annotate("boto3-head_object"): response = boto3.client("s3").head_object(Bucket=bucket, Key=key) content_length = response["ContentLength"] sources = plc.io.types.SourceInfo([url]) sources_with_size = plc.io.types.SourceInfo( [plc.io.types.FilepathSource(url, size=content_length)] ) with nvtx.annotate("warmup"): plc.io.parquet_metadata.read_parquet_metadata(sources) with nvtx.annotate("read_parquet_metadata"): with nvtx.annotate("no-size"): _ = plc.io.parquet_metadata.read_parquet_metadata(sources) with nvtx.annotate("with-size"): _ = plc.io.parquet_metadata.read_parquet_metadata(sources_with_size) with nvtx.annotate("read_parquet_footers"): with nvtx.annotate("no-size"): footers = plc.io.parquet_metadata.read_parquet_footers(sources) with nvtx.annotate("with-size"): footers_with_size = plc.io.parquet_metadata.read_parquet_footers(sources_with_size) options = plc.io.parquet.ParquetReaderOptions.builder(sources).build() options_with_size = plc.io.parquet.ParquetReaderOptions.builder( sources_with_size ).build() with nvtx.annotate("read_parquet"): with nvtx.annotate("no-size"): table = plc.io.parquet.read_parquet(options) with nvtx.annotate("with-size"): table = plc.io.parquet.read_parquet(options_with_size) with nvtx.annotate("read_parquet-with-footers"): with nvtx.annotate("no-size"): table = plc.io.parquet.read_parquet(options, parquet_metadatas=footers) with nvtx.annotate("with-size"): table = plc.io.parquet.read_parquet( options_with_size, parquet_metadatas=footers_with_size ) print("done") </details> ``` This is a necessary precursor to #22734. Closes #22740 Authors: - Tom Augspurger (https://github.com/TomAugspurger) Approvers: - Bradley Dice (https://github.com/bdice) - Tianyu Liu (https://github.com/kingcrimsontianyu) URL: #22739
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our S3 implementaiton made two HEAD requests on S3 urls in "AUTO" mode (the only mode that's exposed to libcudf users).
We can avoid the second HEAD request by reusing the response to the first HEAD request when we go to actually open the file.
Closes #973
Here's an screenshot of an nsys profile showing the single
get_file_size()/HEADrequest on this script: