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

[PERF] Trace block read size #2505

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rust/worker/src/blockstore/arrow/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ impl BlockManager {
let res = bytes.read_to_end(&mut buf).instrument(
tracing::trace_span!(parent: Span::current(), "BlockManager read bytes to end"),
).await;
tracing::info!("Read {:?} bytes from s3", buf.len());
match res {
Ok(_) => {}
Err(e) => {
Expand Down
17 changes: 5 additions & 12 deletions rust/worker/src/index/hnsw_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,11 @@ impl HnswIndexProvider {
// Fetch the files from storage and put them in the index storage path
for file in FILES.iter() {
let key = self.format_key(source_id, file);
println!("Loading hnsw index file: {}", key);
let res = self.storage.get(&key).await;
let mut reader = match res {
Ok(reader) => reader,
Err(e) => {
println!("Failed to load hnsw index file from storage: {}", e);
tracing::error!("Failed to load hnsw index file from storage: {}", e);
return Err(Box::new(HnswIndexProviderFileError::StorageGetError(e)));
}
};
Expand All @@ -146,28 +145,22 @@ impl HnswIndexProvider {
let mut file_handle = match file_handle {
Ok(file) => file,
Err(e) => {
println!("Failed to create file: {}", e);
tracing::error!("Failed to create file: {}", e);
return Err(Box::new(HnswIndexProviderFileError::IOError(e)));
}
};
let copy_res = tokio::io::copy(&mut reader, &mut file_handle)
.instrument(tracing::info_span!(parent: Span::current(), "hnsw provider file read", file = file))
.await;
match copy_res {
Ok(_) => {
println!(
"Copied storage key: {} to file: {}",
key,
file_path.to_str().unwrap()
);
Ok(bytes_read) => {
tracing::info!("Copied {} bytes to file {:?}", bytes_read, file_path);
}
Err(e) => {
println!("Failed to copy file: {}", e);
tracing::error!("Failed to copy file: {}", e);
return Err(Box::new(HnswIndexProviderFileError::IOError(e)));
}
}
// bytes is an AsyncBufRead, so we fil and consume it to a file
println!("Loaded hnsw index file: {}", file);
}
Ok(())
}
Expand Down
Loading