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

storageccl: fix and reenable BenchmarkTimeBoundIterate #96771

Closed

Conversation

RaduBerinde
Copy link
Member

This benchmark creates a mvcc_data directory in the current working dir (i.e. pkg/ccl/storageccl/engineccl) and reuses it if exists. Normally this would not be permitted in CI; but mvcc_data is in .gitignore so it doesn't trip the "assert workspace clean" CI step.

The leftover mvcc_data can be from an older version, which can cause mysterious CI failures.

This fix changes to generating the data in a temporary directory and cleans it up afterwards. The generation only takes a few seconds (significantly less than what it takes to run all benchmarks).

Release note: None
Epic: none

@RaduBerinde RaduBerinde requested a review from a team as a code owner February 8, 2023 04:33
@cockroach-teamcity
Copy link
Member

This change is Reviewable

This benchmark creates a `mvcc_data` directory in the current working
dir (i.e. `pkg/ccl/storageccl/engineccl`) and reuses it if exists.
Normally this would not be permitted in CI; but `mvcc_data` is in
`.gitignore` so it doesn't trip the "assert workspace clean" CI step.

The leftover `mvcc_data` can be from an older version, which can cause
mysterious CI failures.

This fix changes to generating the data in a temporary directory and
cleans it up afterwards. The generation only takes a few seconds
(significantly less than what it takes to run all benchmarks).

Release note: None
Epic: none
Copy link
Collaborator

@jbowens jbowens left a comment

Choose a reason for hiding this comment

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

I think we really need some method of caching artifacts between benchmarks. The generated data isn't deterministic, so it can increase the variance of the benchmark to the point that it's difficult to get reliable measurements. This particular benchmark's data is small, but we have others in pkg/storage that may take minutes to construct the initial state.

I'm a little surprised that this is happening now, because under bazel anything written within the sandbox is lost when the sandbox is torn down. We've been running our pkg/storage benchmarks using make bench despite it being deprecated because of it (#83599).

This change LGTM. I think the same problem applies to pkg/storage's MVCC benchmarks though, and I don't think we want to apply the same treatment there.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @bananabrick)

@RaduBerinde
Copy link
Member Author

under bazel anything written within the sandbox is lost when the sandbox is torn down.

I am not sure but the failures might have been from the non-bazel CI.

I could add an env variable that you can use to point it to a less temporary location, would that help?

@RaduBerinde
Copy link
Member Author

An alternative would be to change the behavior only under CI.. is there a way we can tell from the code? CC @rickystewart

@jbowens
Copy link
Collaborator

jbowens commented Feb 8, 2023

An alternative would be to change the behavior only under CI.

Oh, good idea. I think we could change the behavior if !bazel.BuiltWithBazel()

@RaduBerinde
Copy link
Member Author

I think we could change the behavior if !bazel.BuiltWithBazel()

Isn't BuiltWithBazel true if you use bazel/dev to run the benchmark (which will be the only way going forward)?

@RaduBerinde
Copy link
Member Author

The generated data isn't deterministic

By the way, the data is generated using a hardcoded random seed. Are there other sources of non-determinism that cause the resulting store to be materially different? (eg timing of operations or IOs)?

@jbowens
Copy link
Collaborator

jbowens commented Feb 8, 2023

Isn't BuiltWithBazel true if you use bazel/dev to run the benchmark (which will be the only way going forward)?

Yeah, but we need some kind of tooling support to make it viable for these benchmarks. Bazel tests today can't write anything outside of the sandbox, so there's no way to generate a fixture and have it accessible by the next run. In #83599 we
were hoping it would be possible to add some tooling to pull the fixtures out of the bazel sandbox somehow.

By the way, the data is generated using a hardcoded random seed. Are there other sources of non-determinism that cause the resulting store to be materially different? (eg timing of operations or IOs)?

Yeah, we allow up to 3 concurrent compactions, 1 flush and 1 table stats collector goroutine. The timing of these 5 routines affect the resulting LSM and what physical keys exist.

@RaduBerinde
Copy link
Member Author

Yeah, but we need some kind of tooling support to make it viable for these benchmarks. Bazel tests today can't write anything outside of the sandbox, so there's no way to generate a fixture and have it accessible by the next run. In #83599 we were hoping it would be possible to add some tooling to pull the fixtures out of the bazel sandbox somehow.

Hm, I see. One way would be to check the fixtures into a special repository and pull them in as a dependency to the benchmark.

@RaduBerinde
Copy link
Member Author

Actually, would it be so bad if we checked in mvcc_data? It's only a few megabytes.. Not sure what the policy is for such fixtures in the git repo.

@jbowens
Copy link
Collaborator

jbowens commented Feb 8, 2023

Actually, would it be so bad if we checked in mvcc_data? It's only a few megabytes.. Not sure what the policy is for such fixtures in the git repo.

Seems okay to me, but I bet @rickystewart or others on @cockroach-dev-inf would have an opinion.

@RaduBerinde
Copy link
Member Author

I'm finding more benchmarks that apply the same technique, and which occasionally run into fixtures from previous versions on CI: BenchmarkRefreshRange

@RaduBerinde
Copy link
Member Author

Closing this for now; filed issue #97061 to track.

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