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

Add fuzzer for async data cache #10244

Closed
wants to merge 1 commit into from

Conversation

zacw7
Copy link
Contributor

@zacw7 zacw7 commented Jun 18, 2024

Introduce a basic fuzzer for the async data cache. Each iteration involves:

  1. Creating a set of data files of varying sizes.
  2. Setting up the async data cache with an SSD using a specified configuration.
  3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

@zacw7 zacw7 requested a review from kewang1024 June 18, 2024 06:38
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 18, 2024
Copy link

netlify bot commented Jun 18, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit edb7c76
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/667cc5d84ecd530008b13dbd

@zacw7 zacw7 requested review from amitkdutta and xiaoxmeng June 18, 2024 06:38
@zacw7 zacw7 marked this pull request as ready for review June 18, 2024 06:38
@facebook-github-bot
Copy link
Contributor

@zacw7 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

zacw7 added a commit to zacw7/velox that referenced this pull request Jun 18, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Differential Revision: D58715904

Pulled By: zacw7
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

zacw7 added a commit to zacw7/velox that referenced this pull request Jun 18, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Differential Revision: D58715904

Pulled By: zacw7
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

zacw7 added a commit to zacw7/velox that referenced this pull request Jun 18, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Differential Revision: D58715904

Pulled By: zacw7
Copy link
Contributor

@kewang1024 kewang1024 left a comment

Choose a reason for hiding this comment

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

Can you add doc for running asyc data cache fuzzer, an example to follow:

return executor_.get();
}

void initializeDataFiles();
Copy link
Contributor

@kewang1024 kewang1024 Jun 18, 2024

Choose a reason for hiding this comment

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

Can you add comments for those functions to explain what is done in the different initializations? Same for the rest of init functions.

I would prefer the function name to be as succinct as possible, so how about initDataFiles

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems to be the naming convention of all cache related testing. Examples:

Comment on lines 40 to 74
DEFINE_int32(
max_num_reads,
100,
"Max number of reads to be performed per thread.");

DEFINE_int32(num_threads, 16, "Number of threads to read.");

DEFINE_int32(num_files, 8, "Number of data files to be created.");

DEFINE_uint64(
offset_interval_bytes,
8 << 20,
"The offset bytes to be aligned at for cache reads.");

DEFINE_uint64(
min_file_bytes,
32 << 20,
"Minimum file size in bytes of the data files to be created.");

DEFINE_uint64(
max_file_bytes,
64 << 20,
"Maximum file size in bytes of the data files to be created.");

DEFINE_int32(num_files_in_group, 3, "Number of files to be grouped together.");

DEFINE_int64(memory_cache_bytes, 16 << 20, "Memory cache size in bytes.");

DEFINE_uint64(ssd_cache_bytes, 128 << 20, "Ssd cache size in bytes.");

DEFINE_int32(num_shards, 4, "Number of shards of SSD cache.");

DEFINE_uint64(
ssd_checkpoint_interval_bytes,
64 << 20,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should expose those as parameter of fuzzer. They should be able to be randomized, for now if we want to keep it simple, we can make them constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. I've discussed with @xiaoxmeng and we'll decide later which parameters should be 1) randomized by fuzzer; 2) kept as configurable parameters; 3) fixed as constants.

So I don't have a strong preference on how we should define them for now in this initial PR. Let's see if @xiaoxmeng has some different opinion.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can randomize this later if it is zero.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

zacw7 added a commit to zacw7/velox that referenced this pull request Jun 19, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Differential Revision: D58715904

Pulled By: zacw7
@zacw7 zacw7 requested a review from kewang1024 June 20, 2024 06:19
Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@zacw7 thanks for adding the cache fuzzer % comments.

velox/docs/develop/testing/async-data-cache-fuzzer.rst Outdated Show resolved Hide resolved
velox/docs/develop/testing/async-data-cache-fuzzer.rst Outdated Show resolved Hide resolved
velox/docs/develop/testing/async-data-cache-fuzzer.rst Outdated Show resolved Hide resolved
velox/exec/fuzzer/AsyncDataCacheFuzzer.h Outdated Show resolved Hide resolved
velox/exec/fuzzer/AsyncDataCacheFuzzer.cpp Outdated Show resolved Hide resolved
velox/exec/fuzzer/AsyncDataCacheFuzzer.cpp Outdated Show resolved Hide resolved
velox/exec/fuzzer/AsyncDataCacheFuzzer.cpp Outdated Show resolved Hide resolved
cache_ = AsyncDataCache::create(allocator_, std::move(ssdCache), {});
}

void AsyncDataCacheFuzzer::initializeInputs() {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about each read thread

Loop:
1. pickup a file;
2. create a cache buffer input 
3. enqueue a randomly selected read offsets
4. call load on the cache buffer input
5. randomly to read from a subset or all the enqueued streams in step3?
6. for each selected enqueue stream, read from start to the end and verify the read bytes? Thanks!

velox/exec/fuzzer/AsyncDataCacheFuzzer.cpp Outdated Show resolved Hide resolved
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

zacw7 added a commit to zacw7/velox that referenced this pull request Jun 25, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Differential Revision: D58715904

Pulled By: zacw7
@zacw7 zacw7 requested a review from xiaoxmeng June 25, 2024 00:28
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

zacw7 added a commit to zacw7/velox that referenced this pull request Jun 25, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Differential Revision: D58715904

Pulled By: zacw7
Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@zacw7 thanks for the update % minors!

velox/exec/fuzzer/CacheFuzzer.cpp Show resolved Hide resolved
velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
void CacheFuzzer::initializeCache() {
// We have up to 20 threads and 16 threads are used for reading so
// there are some threads left over for SSD background write.
executor_ = std::make_unique<folly::IOThreadPoolExecutor>(20);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we shall separate them?

readerExecutor_ -> cpu executor: 64 
prefetchExecutor_ -> io executor which passed to buffered input: 4
ssdExecutor_ -> io executor which passed to SSD cache for SSD staging write: 4?

velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
zacw7 added a commit to zacw7/velox that referenced this pull request Jun 25, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Differential Revision: D58715904

Pulled By: zacw7
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

zacw7 added a commit to zacw7/velox that referenced this pull request Jun 25, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Differential Revision: D58715904

Pulled By: zacw7
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

zacw7 added a commit to zacw7/velox that referenced this pull request Jun 25, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Differential Revision: D58715904

Pulled By: zacw7
Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@zacw7 few more comments.

velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
for (auto i = 0; i < FLAGS_num_source_files; ++i) {
// Initialize buffered input.
auto readFile = fs_->openFileForRead(fileNames_[i]);
groupIds_.emplace_back(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need the file group support? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not. Let me remove it.

velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

zacw7 added a commit to zacw7/velox that referenced this pull request Jun 26, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Differential Revision: D58715904

Pulled By: zacw7
Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@zacw7 LGTM. Thanks % minors!

velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
velox/exec/fuzzer/CacheFuzzer.cpp Outdated Show resolved Hide resolved
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

zacw7 added a commit to zacw7/velox that referenced this pull request Jun 26, 2024
Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Reviewed By: xiaoxmeng

Differential Revision: D58715904

Pulled By: zacw7
Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@zacw7 thanks for the update!

Summary:
Introduce a basic fuzzer for the async data cache. Each iteration involves:
1. Creating a set of data files of varying sizes.
2. Setting up the async data cache with an SSD using a specified configuration.
3. Performing parallel random reads from these data files.

In the initial setup, most of the parameters are defined as gflags and we'll decide later which parameters should be fuzzed during the tests.

Pull Request resolved: facebookincubator#10244

Reviewed By: xiaoxmeng

Differential Revision: D58715904

Pulled By: zacw7
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D58715904

@facebook-github-bot
Copy link
Contributor

@zacw7 merged this pull request in d26cb1d.

@zacw7 zacw7 deleted the cache-fuzzer branch June 27, 2024 06:01
Copy link

Conbench analyzed the 1 benchmark run on commit d26cb1df.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants