Skip to content

[ENH] Dynamic adjustment of priority for s3 gets + construct reader once + use rw lock #4272

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

Merged
merged 5 commits into from
Apr 17, 2025

Conversation

sanketkedia
Copy link
Contributor

@sanketkedia sanketkedia commented Apr 12, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • If a foreground task comes in and there is a background task waiting for network bandwidth, after this PR the priority of the task will increase so that it can be completed soon.
    • Previously we were constructing the spann reader in all operators. Instead this PR constructs it once in the orchestrator and ships it wherever needed
    • self.loaded_blocks uses a rw lock instead of a mutex
  • New functionality
    • ...

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

None

@sanketkedia sanketkedia marked this pull request as ready for review April 12, 2025 02:49
Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

Copy link
Contributor Author

sanketkedia commented Apr 12, 2025

Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

1 similar comment
Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

5 similar comments
Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

2 similar comments
Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

@sanketkedia sanketkedia changed the title Debug spans Dynamic adjustment of priority for s3 gets + construct reader once + dedup block fetch Apr 16, 2025
Copy link

Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas

@sanketkedia sanketkedia changed the title Dynamic adjustment of priority for s3 gets + construct reader once + dedup block fetch [ENH] Dynamic adjustment of priority for s3 gets + construct reader once + use rw lock Apr 16, 2025
@sanketkedia sanketkedia force-pushed the 04-11-debug_spans branch 3 times, most recently from ca35195 to 7d1b786 Compare April 17, 2025 06:12
This will make the 50052 port and go service go untested, at the benefit
of testing the new service.

To make tests pass, I had to up the fetch_logs_batch_size in testing.
This will not affect staging or prod.

Also bundled:  Tracing changes.
>,
>,
>,
outstanding_read_requests: Arc<tokio::sync::Mutex<HashMap<String, InflightRequest>>>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing to tokio mutex isn't a change that comes without consideration. given the importance of this component is there a way to restructure to avoid this?

let maybe_inflight = requests.get(&key).cloned();
future_to_await = match maybe_inflight {
Some(fut) => {
tracing::trace!("[AdmissionControlledS3] Found inflight request to s3 for key: {:?}. Deduping", key);
fut
fut.update_priority(options.priority).await;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we could restructure this since update priority doesn't need to happen under the lock since we only ever increase priority ?

requests.insert(key.clone(), get_parallel_storage_future.clone());
requests.insert(
key.clone(),
InflightRequest {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer ::new() to manual struct creation

@sanketkedia sanketkedia merged commit a42a429 into main Apr 17, 2025
135 of 137 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants