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

Make max_bytes_per_stream optional in config #474

Merged
merged 1 commit into from Dec 12, 2023

Conversation

allada
Copy link
Collaborator

@allada allada commented Dec 12, 2023

Defaults "max_bytes_per_stream" to 64Kib in config file.


This change is Reviewable

Copy link
Collaborator Author

@allada allada left a comment

Choose a reason for hiding this comment

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

+@adam-singer

Reviewable status: 0 of 10 files reviewed, all discussions resolved (waiting on @adam-singer)

Copy link
Contributor

@adam-singer adam-singer left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 10 of 10 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @allada)


nativelink-config/src/cas_server.rs line 126 at r1 (raw file):

    /// 16KiB - 64KiB is optimal.
    ///
    /// Defaults: 64Kib

nit: 64Kib -> 64KiB


nativelink-config/src/cas_server.rs line 128 at r1 (raw file):

    /// Defaults: 64Kib
    #[serde(default, deserialize_with = "convert_numeric_with_shellexpand")]
    pub max_bytes_per_stream: usize,

What happens with serialization here if parses for a size larger than machine architecture (given usize is machine size specific)?

It does seem the least bad choice to keep ubiquitous between specific size, wondering if configuration mishaps could happen here (and think probably very low)


nativelink-service/src/bytestream_server.rs line 176 at r1 (raw file):

            stores.insert(instance_name.to_string(), store);
        }
        let max_bytes_per_stream = if config.max_bytes_per_stream == 0 {

Are there any maximum value constraints that we should guard here on? A size that might have the opposite regardless of situation?

Defaults "max_bytes_per_stream" to 64Kib in config file.
@allada allada force-pushed the make-default-max_bytes_per_stream branch from 4cb0679 to bb5cbb3 Compare December 12, 2023 21:51
Copy link
Collaborator Author

@allada allada left a comment

Choose a reason for hiding this comment

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

Reviewable status: 9 of 10 files reviewed, 1 unresolved discussion (waiting on @adam-singer)


nativelink-config/src/cas_server.rs line 126 at r1 (raw file):

Previously, adam-singer (Adam Singer) wrote…

nit: 64Kib -> 64KiB

Done.


nativelink-config/src/cas_server.rs line 128 at r1 (raw file):

Previously, adam-singer (Adam Singer) wrote…

What happens with serialization here if parses for a size larger than machine architecture (given usize is machine size specific)?

It does seem the least bad choice to keep ubiquitous between specific size, wondering if configuration mishaps could happen here (and think probably very low)

I'm pretty sure it'll panic at parse time. Rust has undefined behavior protection even at runtime (in theory).


nativelink-service/src/bytestream_server.rs line 176 at r1 (raw file):

Previously, adam-singer (Adam Singer) wrote…

Are there any maximum value constraints that we should guard here on? A size that might have the opposite regardless of situation?

In theory the maximum is how much ram you have. This is a config value, so it's generally considered a "safe" variable since it's a config set by the server and not a property sent by a user.

Copy link
Collaborator Author

@allada allada left a comment

Choose a reason for hiding this comment

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

Dismissed @adam-singer from a discussion.
Reviewable status: 9 of 10 files reviewed, all discussions resolved (waiting on @adam-singer)

@allada allada merged commit a01a552 into main Dec 12, 2023
17 of 21 checks passed
@allada allada deleted the make-default-max_bytes_per_stream branch December 12, 2023 22:23
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.

None yet

2 participants