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 batch size configurable #326

Merged
merged 4 commits into from
Sep 7, 2024
Merged

make batch size configurable #326

merged 4 commits into from
Sep 7, 2024

Conversation

philsippl
Copy link
Contributor

Since we will start with a DB that fits in memory and only a bit later have one that doesn't fit anymore, we'll also need to update the batchsize during operations (from 64 to 256). This now makes this only a config change.

@github-actions github-actions bot added the enhancement New feature or request label Sep 5, 2024
@philsippl philsippl requested a review from dkales September 6, 2024 06:06
const SERIAL_SIZE: usize = 16384;
pub const MAX_REQUESTS: usize = 256 * 2;
const MAX_REQUEST_ID_LEN: usize = 36; // uuidv4 string
const SERIAL_SIZE: usize = MAX_REQUESTS * MAX_REQUEST_ID_LEN;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is not enough since we use serde_json?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

replaced the json now with bincode, now we can calculate max sizes safely

@@ -72,7 +72,7 @@ mod tests {
// My state.
let state = SyncState {
db_len: 123,
deleted_request_ids: vec!["A".repeat(MAX_REQUEST_ID_LEN); MAX_REQUESTS],
deleted_request_ids: vec!["A".repeat(MAX_REQUEST_ID_LEN); 128],
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the point of this test is to really check that the worst-case serialization size fits into the above buffer size

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah let me add this MAX_REQUESTS here again

Copy link
Collaborator

Choose a reason for hiding this comment

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

also the max len gets overwritten here? probably not what is wanted

@philsippl philsippl requested a review from dkales September 6, 2024 08:47
@philsippl philsippl merged commit 29c54fe into main Sep 7, 2024
13 checks passed
@philsippl philsippl deleted the ps/feat/config-batch-size branch September 7, 2024 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants