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

feat(spooler): Add file backed envelope stacks #4138

Draft
wants to merge 44 commits into
base: master
Choose a base branch
from

Conversation

iambriccardo
Copy link
Member

@iambriccardo iambriccardo commented Oct 14, 2024

This PR implements a new file backend envelope stack, creating a file per own_key project_key combination. The files have a custom format designed for fast access and the data layout is explained in code comments.

The whole idea of this mechanism is that we always append and remove data from the end of the file, meaning no in-memory buffering takes place. When a file is found to be empty, it will be removed from the file system.

In the future, given our file-per-pair model, we could parallelize spools and batch them.

relay-config/src/config.rs Outdated Show resolved Hide resolved
relay-config/src/config.rs Outdated Show resolved Hide resolved
relay-server/src/services/buffer/envelope_buffer/mod.rs Outdated Show resolved Hide resolved
Comment on lines 1021 to 1022
#[default]
Memory,
Copy link
Member

Choose a reason for hiding this comment

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

With this default, our currently deployed configs will revert to Memory even if they have a path set.

Bonus points if you can make it an adjacently or untagged enum while maintaining backward compatibility:

Memory,
Sqlite(PathBuf),
FileBacked(PathBuf)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this is a good point. I will try to make it work.

jjbayer added a commit that referenced this pull request Oct 28, 2024
Adds the benchmarking tool introduced in #4138.

Example usage:

```shell
./target/release/bench-buffer \
    --envelope-size-kib 100 \
    --batch-size 1 \
    --implementation sqlite \
    --mode sequential \
    --projects 100000 \
    --duration-secs 100
```
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.

2 participants