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

Replay Proto-X #32

Merged
merged 102 commits into from
May 30, 2024
Merged

Replay Proto-X #32

merged 102 commits into from
May 30, 2024

Conversation

wangpatrick57
Copy link
Member

@wangpatrick57 wangpatrick57 commented Apr 27, 2024

Summary: Can now replay a full tuning run from Proto-X. This is used to see how each step of tuning would have done without query timeouts and without Boot enabled.

Demo:
The image shows the data of a replayed run of TPC-H SF0.01 without Boot enabled during tuning. For each step of tuning, the replay shows the # of queries executed during the original run (which may be < 22 if the workload timed out), the # of queries that timed out during the original run, and whether the workload timed out. It also shows this same information about the replay. You can see that the replayed times are always >= the original times, which makes sense. Whenever the original run is "22,0,False" (i.e. 22 executed, 0 timed out, workload didn't time out), the replayed time matches closely.
Screenshot 2024-04-27 at 14 49 15

Details:

  • Migrated the pipeline which pickles actions (DBMS configuration changes) while tuning and replays actions during replay to get the DBMS into the correct state.
  • Related to the above, modified the pipeline to store both the best per-query knobs found during execute_variations() as well as all per-query knob variations tried. We can either replay the best variation or all variations. This is especially useful if the workload timed out in the original run, in which case the "best" variation is a misnomer as it is simply an arbitrary variation.
  • Made Proto-X log additional information while tuning about the # of executed queries, # of timed out queries, and whether the workload timed out. During replay, all this information may now be utilized.
  • Fixed a bug where reset() was overwriting the logged replay information for a step, leading to a mismatch between the dumped action.pkl file (which contains the DBMS configuration state) and the run.raw.csv file (which contains the runtime information of the workload during that state).
  • Refactored all symlinks to have the .link extension to fix a subtle bug where a replay would overwrite the output.log file of the original run.
  • Standardized whether the page cache is dumped during tuning and replay (it's now not dumped in either case).
  • Made CLI options for the time to run the RL agent and whether Boot is enabled more fine-grained such that these values can differ between HPO and tune.

@wangpatrick57 wangpatrick57 marked this pull request as ready for review April 27, 2024 18:50
Copy link
Member

@17zhangw 17zhangw left a comment

Choose a reason for hiding this comment

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

Just got a few questions, mostly around dumping the page cache.

tune/protox/agent/hpo.py Outdated Show resolved Hide resolved
tune/protox/env/mqo/mqo_wrapper.py Outdated Show resolved Hide resolved
tune/protox/env/pg_env.py Outdated Show resolved Hide resolved
tune/protox/env/pg_env.py Outdated Show resolved Hide resolved
tune/protox/agent/replay.py Show resolved Hide resolved
Copy link
Member

@17zhangw 17zhangw left a comment

Choose a reason for hiding this comment

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

Just one more change.

if self.logger:
# We only stash the results if we're not doing HPO, or else the results from concurrent HPO would get
# stashed in the same directory and potentially cause a race condition.
if self.logger and not tuning_mode == TuningMode.HPO:
Copy link
Member

Choose a reason for hiding this comment

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

Can we also use the ray_trial_id to stash the results during HPO?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for catching that!

Copy link
Member

@17zhangw 17zhangw left a comment

Choose a reason for hiding this comment

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

LGTM.

@17zhangw 17zhangw merged commit 3aecdd1 into cmu-db:main May 30, 2024
1 check passed
@wangpatrick57 wangpatrick57 deleted the replay-protox branch July 6, 2024 02:44
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.

2 participants