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 support for configuring Restate in benchmarks via env variables #597

Merged
merged 2 commits into from
Jul 13, 2023
Merged

Add support for configuring Restate in benchmarks via env variables #597

merged 2 commits into from
Jul 13, 2023

Conversation

tillrohrmann
Copy link
Contributor

This fixes #596.

Comment on lines 107 to 119
let default_config = ConfigurationBuilder::default()
.worker(worker_options)
.meta(meta_options)
.build()
.expect("building the configuration should work");

config
let temp_dir = tempfile::tempdir().expect("temp directory needs to be available");
let configuration_path = temp_dir.path().join("restate.yml");
let configuration_file = std::fs::File::create(configuration_path.as_path())
.expect("creating the configuration file should work");

serde_yaml::to_writer(configuration_file, &default_config)
.expect("serializing the config should not fail");
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps avoid this dance and simply add a method in Configuration like load_only_from_env :)

Copy link
Contributor

Choose a reason for hiding this comment

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

And use os::set_env for rocskdb and meta storage paths.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, that would be a tad bit easier. What I don't like so much about then env variable only approach is that it will silently break if we change the names of config options whereas now, the benchmark would stop compiling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I would love to have is a merge function between Configurations. That would probably be the easiest solution but it is not supported (needs manual implementation).

Copy link
Contributor

Choose a reason for hiding this comment

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

You could also do that, just copy the current Configuration::load function in Configuration::merge_with_env. The logic would be the very same of load except you remove the loading from file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea. I think I'll extend load to take a default configuration. That way we keep the exact same logic for how to load the configuration for benchmarks as well as for the binary.

@tillrohrmann
Copy link
Contributor Author

Thanks for the review. Merging this PR now.

@tillrohrmann tillrohrmann merged commit 3d57950 into restatedev:main Jul 13, 2023
@tillrohrmann tillrohrmann deleted the benchmark-configuration branch July 13, 2023 10:24
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.

Avoid recompiling the benchmarks when changing configuration options
2 participants