uriyage
8060c86d20
Offload TLS negotiation to I/O threads (#1338)
## TLS Negotiation Offloading to I/O Threads
### Overview
This PR introduces the ability to offload TLS handshake negotiations to
I/O threads, significantly improving performance under high TLS
connection loads.
### Key Changes
- Added infrastructure to offload TLS negotiations to I/O threads
- Refactored SSL event handling to allow I/O threads modify conn flags.
- Introduced new connection flag to identify client connections
### Performance Impact
Testing with 650 clients with SET commands and 160 new TLS connections
per second in the background:
#### Throughput Impact of new TLS connections
- **With Offloading**: Minimal impact (1050K → 990K ops/sec)
- **Without Offloading**: Significant drop (1050K → 670K ops/sec)
#### New Connection Rate
- **With Offloading**:
- 1,757 conn/sec
- **Without Offloading**:
- 477 conn/sec
### Implementation Details
1. **Main Thread**:
- Initiates negotiation-offload jobs to I/O threads
- Adds connections to pending-read clients list (using existing read
offload mechanism)
- Post-negotiation handling:
- Creates read/write events if needed for incomplete negotiations
- Calls accept handler for completed negotiations
2. **I/O Thread**:
- Performs TLS negotiation
- Updates connection flags based on negotiation result
Related issue:https://github.com/valkey-io/valkey/issues/761
---------
Signed-off-by: Uri Yagelnik <uriy@amazon.com>
Signed-off-by: ranshid <88133677+ranshid@users.noreply.github.com>
Co-authored-by: ranshid <88133677+ranshid@users.noreply.github.com>
Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
2024-12-18 09:03:30 +02:00
..
2024-04-16 07:01:36 -07:00
2024-11-21 19:19:10 -08:00
2024-12-18 09:03:30 +02:00
2024-06-14 13:40:06 -07:00