Skip to content

Conversation

@Mark-Simulacrum
Copy link
Collaborator

Release Summary:

  • opt(s2n-quic-dc): Use RwLock for id/peer maps

Resolved issues:

n/a

Description of changes:

This uses the parking_lot RwLock which helps ensure fairness and guarantees that writers make forward progress even with a continuous stream of readers.

In microbenchmarks, this essentially eliminates futex syscalls on the lock atomic, since readers are able to proceed in parallel. We likely still have cache line contention but that's cheaper than going to sleep on a Mutex and is a larger change to fix. The alignment to 128 bytes should also help with the contention.

Call-outs:

n/a

Testing:

~All of our tests exercise this code. The change shouldn't be purely about performance.

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

@Mark-Simulacrum Mark-Simulacrum marked this pull request as ready for review September 11, 2025 19:04
@boquan-fang boquan-fang self-requested a review September 11, 2025 19:50
This uses the parking_lot RwLock which helps ensure fairness and
guarantees that writers make forward progress even with a continuous
stream of readers.

In microbenchmarks, this essentially eliminates futex syscalls on the
lock atomic, since readers are able to proceed in parallel. We likely
still have cache line contention but that's cheaper than going to sleep
on a Mutex and is a larger change to fix. The alignment to 128 bytes
should also help with the contention.
@Mark-Simulacrum Mark-Simulacrum enabled auto-merge (squash) September 15, 2025 20:16
@Mark-Simulacrum Mark-Simulacrum merged commit 3b42424 into aws:main Sep 15, 2025
120 checks passed
@Mark-Simulacrum Mark-Simulacrum deleted the rwlock-maps branch September 15, 2025 20:25
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