Commit 8060c86
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:#761
---------
Signed-off-by: Uri Yagelnik <[email protected]>
Signed-off-by: ranshid <[email protected]>
Co-authored-by: ranshid <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>1 parent e203ca3 commit 8060c86
File tree
8 files changed
+174
-70
lines changed- .github/workflows
- src
8 files changed
+174
-70
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
378 | 416 | | |
379 | 417 | | |
380 | 418 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
561 | 561 | | |
562 | 562 | | |
563 | 563 | | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| |||
4805 | 4806 | | |
4806 | 4807 | | |
4807 | 4808 | | |
| 4809 | + | |
| 4810 | + | |
4808 | 4811 | | |
4809 | 4812 | | |
4810 | 4813 | | |
| 4814 | + | |
| 4815 | + | |
| 4816 | + | |
4811 | 4817 | | |
4812 | 4818 | | |
4813 | 4819 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2645 | 2645 | | |
2646 | 2646 | | |
2647 | 2647 | | |
| 2648 | + | |
2648 | 2649 | | |
2649 | 2650 | | |
2650 | 2651 | | |
| |||
5915 | 5916 | | |
5916 | 5917 | | |
5917 | 5918 | | |
| 5919 | + | |
5918 | 5920 | | |
5919 | 5921 | | |
5920 | 5922 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1869 | 1869 | | |
1870 | 1870 | | |
1871 | 1871 | | |
| 1872 | + | |
1872 | 1873 | | |
1873 | 1874 | | |
1874 | 1875 | | |
| |||
0 commit comments