Prefetch Benchmark: Add simple random read#1747
Prefetch Benchmark: Add simple random read#1747yerzhan7 wants to merge 6 commits intoawslabs:mainfrom
Conversation
Signed-off-by: Yerzhan Mazhkenov <[email protected]>
Signed-off-by: Yerzhan Mazhkenov <[email protected]>
Signed-off-by: Yerzhan Mazhkenov <[email protected]>
Signed-off-by: Yerzhan Mazhkenov <[email protected]>
| default_value_t = 1, | ||
| value_name = "SEED" | ||
| )] | ||
| randseed: u64, |
There was a problem hiding this comment.
We should define the random behavior in more details:
- Do we apply the same random access sequence to all objects and all iterations? (I'd say no)
- Should the sequence(s) be reproducible across platforms?
- What's the behavior when no seed is specified?
There was a problem hiding this comment.
Do we apply the same random access sequence to all objects and all iterations? (I'd say no)
Good point. Will add object ID and iteration number to the seed.
Should the sequence(s) be reproducible across platforms?
Will switch to PCG64 which should be portable and deterministic.
What's the behavior when no seed is specified?
Currently, the default value for seed is 1. I.e. still deterministic.
| AccessPattern::Random => { | ||
| let mut rng = StdRng::seed_from_u64(randseed); | ||
| let mut total_bytes_read = 0; | ||
| let max_offset = size.saturating_sub(read_size); |
There was a problem hiding this comment.
Why restrict the offset? vs allowing smaller reads at the end of the file?
| let mut total_bytes_read = 0; | ||
| let max_offset = size.saturating_sub(read_size); | ||
|
|
||
| while Instant::now() < timeout { |
There was a problem hiding this comment.
We are making the random read mode time-based, but using the timeout value. That's not the original intent of the timeout parameter and does not work well with the iterations parameter. We need to either define a separate parameter, or consider a different approach (e.g. no. of reads or total size).
There was a problem hiding this comment.
I've added total_bytes_read < size in addition to timeout.
| Ok(total_bytes_read) | ||
| } | ||
| AccessPattern::Random => { | ||
| let mut rng = StdRng::seed_from_u64(randseed); |
There was a problem hiding this comment.
StdRng is not portable, I think. We probably want to use a different RNG: https://rust-random.github.io/book/guide-rngs.html. See also other comment about the random seed.
There was a problem hiding this comment.
Will switch to PCG64, thanks!
Signed-off-by: Yerzhan Mazhkenov <[email protected]>
Signed-off-by: Yerzhan Mazhkenov <[email protected]>
What changed and why?
Need to extend prefetcher benchmark to test random read access pattern in addition to existing sequential read.
Manual Testing
Successfully run benchmark:
uv run benchmark.py -- benchmark_type=prefetchDoes this change impact existing behavior?
No. Changing Benchmark scripts only.
Does this change need a changelog entry? Does it require a version change?
No. Changing Benchmark scripts only.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).