-
Notifications
You must be signed in to change notification settings - Fork 91
perf(vindex): parallelize Parquet reads and multipart index uploads #736
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
Open
jerry-024
wants to merge
19
commits into
apache:main
Choose a base branch
from
jerry-024:perf/ivfpq-build-performance
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
4b16464
perf(vindex): add detailed build timing logs
jerry-024 ed768cb
fix(vindex): gate training_rows_retained diagnostics on timing flag
jerry-024 ef692e2
build(vindex): use core 0.4.0
jerry-024 1b31280
perf(vindex): enlarge index add batches
jerry-024 0cff10a
feat: diagnose parquet row group reads
jerry-024 85b906a
perf(vindex): diagnose per-file read waits
jerry-024 b445750
perf(vindex): finalize read-path optimization
jerry-024 d6ec9f7
perf(vindex): upload index parts concurrently
jerry-024 3a5eceb
Merge branch 'main' into perf/ivfpq-build-performance
jerry-024 d553633
fix
jerry-024 bad3f34
fix
jerry-024 c07b87f
perf: cap single row-group budget accounting to a fair share
jerry-024 2491580
bench(vindex): add IVF-PQ build benchmark
jerry-024 ccc3b8d
fix(parquet): preserve strict read budget accounting
jerry-024 267b6d8
perf(vindex): enable approximate IVF-PQ assignment
jerry-024 bbf6399
fix(vindex): keep options compatible with core 0.3
jerry-024 46d22b7
Warn when Parquet row groups exceed read budget
jerry-024 08afe2c
Fix Parquet read budget warning threshold
jerry-024 23e352d
fix: bound vector index upload buffering
jerry-024 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| //! Build an IVF-PQ index through the production Paimon path. | ||
| //! | ||
| //! ```text | ||
| //! PAIMON_CATALOG_OPTIONS='{"metastore":"filesystem","warehouse":"/tmp/warehouse"}' \ | ||
| //! PAIMON_LOG_VECTOR_INDEX_BUILD_TIMING=1 \ | ||
| //! cargo run --release -p paimon --example ivfpq_build_benchmark -- \ | ||
| //! <database> <table> <vector-column> [--drop-existing] | ||
| //! ``` | ||
|
|
||
| use std::collections::HashMap; | ||
| use std::error::Error; | ||
| use std::time::Instant; | ||
|
|
||
| use paimon::catalog::Identifier; | ||
| use paimon::{CatalogFactory, Options}; | ||
|
|
||
| #[tokio::main] | ||
| async fn main() -> Result<(), Box<dyn Error>> { | ||
| let mut args = std::env::args().skip(1); | ||
| let database = required_arg(&mut args, "database")?; | ||
| let table_name = required_arg(&mut args, "table")?; | ||
| let column = required_arg(&mut args, "vector-column")?; | ||
| let drop_existing = args.any(|arg| arg == "--drop-existing"); | ||
|
|
||
| let catalog_options = std::env::var("PAIMON_CATALOG_OPTIONS")?; | ||
| let catalog = | ||
| CatalogFactory::create(Options::from_map(serde_json::from_str(&catalog_options)?)).await?; | ||
| let table = catalog | ||
| .get_table(&Identifier::new(&database, &table_name)) | ||
| .await?; | ||
|
|
||
| let dropped_index_files = if drop_existing { | ||
| let mut builder = table.new_global_index_drop_builder(); | ||
| builder.with_index_column(&column).with_index_type("ivf-pq"); | ||
| builder.execute().await? | ||
| } else { | ||
| 0 | ||
| }; | ||
|
|
||
| let options = HashMap::from([ | ||
| ("dimension".to_string(), "768".to_string()), | ||
| ("metric".to_string(), "cosine".to_string()), | ||
| ("nlist".to_string(), "4096".to_string()), | ||
| ("pq.m".to_string(), "192".to_string()), | ||
| ]); | ||
| let started = Instant::now(); | ||
| let built_shards = table | ||
| .new_vindex_index_build_builder("ivf-pq") | ||
| .with_index_column(&column) | ||
| .with_options(options.clone()) | ||
| .execute() | ||
| .await?; | ||
|
|
||
| println!( | ||
| "{}", | ||
| serde_json::to_string_pretty(&serde_json::json!({ | ||
| "database": database, | ||
| "table": table_name, | ||
| "column": column, | ||
| "index_type": "ivf-pq", | ||
| "build_options": options, | ||
| "dropped_index_files": dropped_index_files, | ||
| "built_shards": built_shards, | ||
| "duration_seconds": started.elapsed().as_secs_f64(), | ||
| }))? | ||
| ); | ||
| Ok(()) | ||
| } | ||
|
|
||
| fn required_arg( | ||
| args: &mut impl Iterator<Item = String>, | ||
| name: &str, | ||
| ) -> Result<String, Box<dyn Error>> { | ||
| args.next() | ||
| .ok_or_else(|| format!("missing <{name}> argument").into()) | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
read_budgethas already been filtered byrow_selection.is_none(), any partial-row-range read reaches this block withread_budget == None. Vector-index shard boundaries can cut through a file, so these reads still perform Parquet I/O while reportingparquet_row_group_countand all projected-byte diagnostics as zero. Please compute and record the diagnostic sizes fromself.read_budgetindependently of parallel-path eligibility, or rename these fields to make their parallel-path-only scope explicit.