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(s2n-quic-dc): Replace shared map with larger bitset #2464

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

Mark-Simulacrum
Copy link
Collaborator

Release Summary:

n/a

Resolved issues:

n/a

Description of changes:

This simplifies the receiver dedup implementation by replacing it with an inline bitset, which we shift over on new arrivals. The end result is that we have an effective tracker for ~896 packets fitting into about the same amount of space as the previous combination of shared map and entry data (+6 bytes/entry if we assume 500k entries).

The new implementation is also easier to tweak, since we directly expose the window size. It's likely that this slows down inserts a little (we need to shift over 112 bytes at the current size) but shuffling a 112-byte array should be sufficiently fast that I don't think it's worth worrying about it.

Call-outs:

I'd be open to re-writing bitvec's parts into our code if we wanted to, but it's a bit tricky to get the shifting right (doable but ugly). It seems like a pretty reasonable tradeoff for the current moment to take that dependency and we can revisit down the line.

My expectation is that as-is this should generally improve the likelihood we accurately track replay for incoming packets. We previously had some chance that we could track packets across effectively infinite range (since we'd store the full Credentials in the backup map), so it's not a perfect tradeoff, but I tend to expect this to improve things overall.

Testing:

Tests are slightly updated, but mostly keeping the pre-existing coverage.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

camshaft
camshaft previously approved these changes Feb 3, 2025
dc/s2n-quic-dc/src/path/secret/receiver.rs Show resolved Hide resolved
@camshaft
Copy link
Contributor

camshaft commented Feb 4, 2025

Looks like we need a couple of clippy fixes: https://github.com/aws/s2n-quic/actions/runs/13124837571/job/36618926298?pr=2464

This simplifies the receiver dedup implementation by replacing it with
an inline bitset, which we shift over on new arrivals. The end result is
that we have an effective tracker for ~896 packets fitting into about
the same amount of space as the previous combination of shared map and
entry data (+6 bytes if we assume 500k entries).

The new implementation is also easier to tweak, since we directly expose
the window size. It's likely that this slows down inserts a little (we
need to shift over 112 bytes) but shuffling a 112-byte array should be
sufficiently fast that I don't think it's worth worrying about it.
@camshaft camshaft enabled auto-merge (squash) February 4, 2025 15:26
@camshaft camshaft merged commit e8df067 into aws:main Feb 4, 2025
121 checks passed
@Mark-Simulacrum Mark-Simulacrum deleted the dedup-large branch February 5, 2025 15:41
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