Skip to content

S3FIFO Cache - #2865

Open
Tunglies wants to merge 8 commits into
rustls:mainfrom
Tunglies:perf/S3FIFO-ServerSessionMemoryCache
Open

Tunglies wants to merge 8 commits into
rustls:mainfrom
Tunglies:perf/S3FIFO-ServerSessionMemoryCache

Conversation

@Tunglies

@Tunglies Tunglies commented Jan 20, 2026 •

Copy link
Copy Markdown
Contributor

Related: #1503, #1200

Thea ideal to implement cache in s3fifo was initial mentioned by @djc in #1200 (comment)


I can not compile for this repo to run additional benchmark, dependency is kind of messy.

I've benchmarked this using a custom microbenchmark (repo) in #1200 (comment)

Outdate benchmark:

Details

Would like to share some of benchmark on my machine. M1Pro 10c 32G

> rustls-bench handshake TLS13_AES_256_GCM_SHA38

Basline 257e511

handshakes      TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       6966.17 handshakes/s
handshakes      TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       1649.87 handshakes/s
handshakes-unbuffered   TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       7071.62handshakes/s
handshakes-unbuffered   TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       1646.93handshakes/s
handshakes      TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       3908.12handshakes/s
handshakes      TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       8346.22handshakes/s
handshakes-unbuffered   TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume      3863.44  handshakes/s
handshakes-unbuffered   TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume      8284.81  handshakes/s
handshakes      TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       5116.57 handshakes/s
handshakes      TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       9550.34 handshakes/s
handshakes-unbuffered   TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       5036.99handshakes/s
handshakes-unbuffered   TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       9496.43handshakes/s

PR

handshakes      TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       7587.90 handshakes/s
handshakes      TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       1736.19 handshakes/s
handshakes-unbuffered   TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       7532.33handshakes/s
handshakes-unbuffered   TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       1721.51handshakes/s
handshakes      TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       4635.09handshakes/s
handshakes      TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       10245.13handshakes/s
handshakes-unbuffered   TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume      4645.36  handshakes/s
handshakes-unbuffered   TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume      10239.77 handshakes/s
handshakes      TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       5981.90 handshakes/s
handshakes      TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       11503.03       handshakes/s
handshakes-unbuffered   TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       6008.96handshakes/s
handshakes-unbuffered   TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       11559.65handshakes/s

Additional work would like to be

  • rewrite .lock() to .try_lock() (? early return None not wait to a value may changed the expected behavior
  • rewrite Mutex<Cache<T>> to [Mutex<Cache<T>>] for better lock contention optimization

Happy to receive any feedback so I(we) can move this forward

@codecov

codecov Bot commented Jan 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.68847% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.79%. Comparing base (cb81251) to head (a3e55e0).
⚠️ Report is 789 commits behind head on main.

Files with missing lines Patch % Lines
rustls/src/limited_cache.rs 99.68% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2865      +/-   ##
==========================================
+ Coverage   92.72%   92.79%   +0.07%     
==========================================
  Files          98       98              
  Lines       21849    22049     +200     
  Branches      618      627       +9     
==========================================
+ Hits        20259    20461     +202     
  Misses       1449     1449              
+ Partials      141      139       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Tunglies
Tunglies marked this pull request as draft January 21, 2026 08:37
@Tunglies
Tunglies force-pushed the perf/S3FIFO-ServerSessionMemoryCache branch 2 times, most recently from f60324a to f9bd0c3 Compare January 21, 2026 12:17
@Tunglies

Tunglies commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Fix the initial migrate to S3FIFO, now it is fully match the designed's behavior. See Designed behavior in Algorithm 1 S3-FIFO algorithm here

Outdate Benchmark:

Details

With Benchmark > rustls-bench handshake TLS13_AES_256_GCM_SHA38

handshakes      TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       7544.33       handshakes/s
handshakes      TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       1737.17       handshakes/s
handshakes-unbuffered   TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume    7541.12  handshakes/s
handshakes-unbuffered   TLSv1_3 Rsa2048 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume    1734.94  handshakes/s
handshakes      TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume    4655.45  handshakes/s
handshakes      TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume    10229.22 handshakes/s
handshakes-unbuffered   TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume     4660.05 handshakes/s
handshakes-unbuffered   TLSv1_3 EcdsaP256       TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume     10181.91        handshakes/s
handshakes      TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume       5997.39       handshakes/s
handshakes      TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume       11479.40      handshakes/s
handshakes-unbuffered   TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        client  server-auth     no-resume    6053.82  handshakes/s
handshakes-unbuffered   TLSv1_3 Ed25519 TLS13_AES_256_GCM_SHA384        server  server-auth     no-resume    11587.77 handshakes/s

@Tunglies
Tunglies marked this pull request as ready for review January 21, 2026 12:56

@djc djc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very interesting work!

Would suggest keeping the LimitedCache name (and interface, to the extent possible) and module and only changing its internals.

Would also be useful to add some design documentation on what it is implementing, maybe with references to the S3-FIFO paper or another implementation that you referenced in building this.

Have you profiled memory usage differences in old vs new implementation?

I'm going to approve this for now so that the benchmark bot will run.

@rustls-benchmarking

rustls-benchmarking Bot commented Jan 21, 2026 •

Copy link
Copy Markdown

Benchmark results

Instruction counts

Significant differences

⚠️ There are significant instruction count differences

Click to expand
Scenario Baseline Candidate Diff Threshold
handshake_no_resume_1.2_no_crypto_server 44969 43704 ✅ -1265 (-2.81%) 0.97%
handshake_tickets_1.2_no_crypto_client 1348196 1312958 ✅ -35238 (-2.61%) 1.41%
handshake_session_id_1.2_no_crypto_client 1261843 1232985 ✅ -28858 (-2.29%) 1.82%
handshake_tickets_1.2_no_crypto_server 1320719 1294900 ✅ -25819 (-1.95%) 0.90%
handshake_no_resume_1.2_no_crypto_client 63280 62237 ✅ -1043 (-1.65%) 0.32%
handshake_session_id_1.3_no_crypto_server 2303463 2335851 ⚠️ 32388 (1.41%) 0.99%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes_server 2431008 2411238 ✅ -19770 (-0.81%) 0.20%
handshake_session_id_ring_1.2_rsa_aes_server 3451307 3426740 ✅ -24567 (-0.71%) 0.32%
handshake_session_id_ring_1.2_rsa_aes_client 3560695 3536296 ✅ -24399 (-0.69%) 0.64%

Other differences

Click to expand
Scenario Baseline Candidate Diff Threshold
handshake_session_id_1.2_no_crypto_server 1157356 1138540 -18816 (-1.63%) 1.67%
handshake_tickets_1.3_no_crypto_client 2446820 2462592 15772 (0.64%) 1.77%
handshake_tickets_ring_1.2_rsa_aes_client 3956614 3931813 -24801 (-0.63%) 0.70%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes_client 9060963 9009923 -51040 (-0.56%) 1.31%
handshake_no_resume_aws_lc_rs_1.3_rsa_aes_server 11053906 11109570 55664 (0.50%) 1.27%
handshake_session_id_1.3_no_crypto_client 2431268 2443220 11952 (0.49%) 1.38%
handshake_tickets_ring_1.2_rsa_aes_server 4017002 4002511 -14491 (-0.36%) 0.36%
handshake_no_resume_aws_lc_rs_1.2_rsa_aes_server 10420627 10454399 33772 (0.32%) 1.12%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha_client 50304513 50166170 -138343 (-0.28%) 0.46%
handshake_tickets_aws_lc_rs_1.3_rsa_aes_client 50510969 50421025 -89944 (-0.18%) 0.49%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_client 9033254 9048742 15488 (0.17%) 0.91%
handshake_session_id_ring_1.3_rsa_chacha_server 31736057 31787247 51190 (0.16%) 0.20%
handshake_session_id_ring_1.3_rsa_aes_server 31858247 31909437 51190 (0.16%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes_client 50422049 50501885 79836 (0.16%) 0.60%
handshake_session_id_aws_lc_rs_1.3_rsa_chacha_server 41672107 41736810 64703 (0.16%) 0.31%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes_client 50424365 50501248 76883 (0.15%) 0.62%
handshake_session_id_aws_lc_rs_1.3_rsa_aes_server 41730796 41793001 62205 (0.15%) 0.44%
handshake_tickets_aws_lc_rs_1.3_rsa_chacha_client 50330820 50401132 70312 (0.14%) 0.49%
handshake_tickets_ring_1.3_rsa_chacha_client 30762178 30804216 42038 (0.14%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes_client 50254651 50186068 -68583 (-0.14%) 0.47%
handshake_tickets_ring_1.3_rsa_aes_client 30834433 30876471 42038 (0.14%) 0.20%
handshake_tickets_aws_lc_rs_1.3_rsa_aes_server 43064288 43008525 -55763 (-0.13%) 0.44%
handshake_session_id_ring_1.3_rsa_chacha_client 30647034 30685090 38056 (0.12%) 0.20%
handshake_session_id_ring_1.3_rsa_aes_client 30738729 30776785 38056 (0.12%) 0.20%
handshake_tickets_aws_lc_rs_1.2_rsa_aes_server 4983209 4988999 5790 (0.12%) 0.37%
handshake_session_id_ring_1.3_ecdsap256_chacha_client 30635348 30670714 35366 (0.12%) 0.20%
handshake_session_id_ring_1.3_ecdsap256_aes_client 30727073 30762409 35336 (0.11%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes_client 50244350 50187073 -57277 (-0.11%) 0.49%
handshake_session_id_ring_1.3_ecdsap384_chacha_server 31751736 31787311 35575 (0.11%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_aes_server 31873926 31909501 35575 (0.11%) 0.20%
handshake_no_resume_1.3_no_crypto_client 74213 74293 80 (0.11%) 0.69%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes_server 41789174 41831911 42737 (0.10%) 0.29%
handshake_session_id_ring_1.3_ecdsap256_chacha_server 31754264 31785307 31043 (0.10%) 0.20%
handshake_session_id_ring_1.3_ecdsap256_aes_server 31876454 31907497 31043 (0.10%) 0.20%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha_server 41738056 41775123 37067 (0.09%) 0.46%
handshake_tickets_1.3_no_crypto_server 2242993 2244949 1956 (0.09%) 1.15%
handshake_no_resume_1.3_no_crypto_server 65136 65083 -53 (-0.08%) 1.03%
handshake_no_resume_aws_lc_rs_1.3_rsa_chacha_server 11079205 11070293 -8912 (-0.08%) 1.70%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha_server 43046288 43012628 -33660 (-0.08%) 0.32%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes_server 1488197 1489303 1106 (0.07%) 0.20%
handshake_no_resume_ring_1.3_ecdsap256_aes_client 3274383 3272292 -2091 (-0.06%) 0.24%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha_client 50205596 50173677 -31919 (-0.06%) 0.72%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_server 1490689 1491493 804 (0.05%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha_client 50475201 50501979 26778 (0.05%) 0.32%
handshake_tickets_ring_1.3_ecdsap384_chacha_client 30744148 30760425 16277 (0.05%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_aes_client 30816403 30832680 16277 (0.05%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha_client 50398962 50372425 -26537 (-0.05%) 0.57%
handshake_tickets_ring_1.3_ecdsap256_chacha_client 30748266 30763170 14904 (0.05%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_aes_client 30820551 30835425 14874 (0.05%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_chacha_server 32047635 32063071 15436 (0.05%) 0.20%
handshake_tickets_ring_1.3_ecdsap384_aes_server 32150655 32166091 15436 (0.05%) 0.20%
handshake_tickets_aws_lc_rs_1.2_rsa_aes_client 4372007 4374014 2007 (0.05%) 0.27%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes_server 41816609 41834294 17685 (0.04%) 0.27%
handshake_session_id_aws_lc_rs_1.3_rsa_aes_client 50259548 50238865 -20683 (-0.04%) 0.67%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes_server 43138756 43155709 16953 (0.04%) 0.29%
handshake_session_id_aws_lc_rs_1.2_rsa_aes_server 3861393 3862816 1423 (0.04%) 0.90%
handshake_no_resume_ring_1.2_rsa_aes_client 2176978 2176184 -794 (-0.04%) 0.20%
handshake_no_resume_ring_1.3_rsa_aes_client 2303966 2304789 823 (0.04%) 0.20%
handshake_no_resume_ring_1.3_rsa_chacha_client 2309620 2310443 823 (0.04%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_chacha_server 32052696 32063502 10806 (0.03%) 0.20%
handshake_tickets_ring_1.3_ecdsap256_aes_server 32155716 32166522 10806 (0.03%) 0.20%
handshake_tickets_aws_lc_rs_1.3_rsa_chacha_server 42955969 42970297 14328 (0.03%) 0.42%
handshake_no_resume_aws_lc_rs_1.2_rsa_aes_client 1686774 1686284 -490 (-0.03%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_chacha_client 30655214 30663866 8652 (0.03%) 0.20%
handshake_session_id_ring_1.3_ecdsap384_aes_client 30746909 30755561 8652 (0.03%) 0.20%
handshake_session_id_aws_lc_rs_1.3_rsa_chacha_client 50240454 50251307 10853 (0.02%) 0.51%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes_server 43088393 43096136 7743 (0.02%) 0.41%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_aes_server 46085807 46078407 -7400 (-0.02%) 0.20%
handshake_session_id_aws_lc_rs_1.2_rsa_aes_client 3980018 3979481 -537 (-0.01%) 0.29%
transfer_no_resume_aws_lc_rs_1.3_rsa_chacha_server 80266523 80256385 -10138 (-0.01%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_client 3806331 3805926 -405 (-0.01%) 0.25%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_server 2413996 2414210 214 (0.01%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_server 80266287 80260167 -6120 (-0.01%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_rsa_aes_client 2627426 2627240 -186 (-0.01%) 1.55%
handshake_no_resume_ring_1.2_rsa_aes_server 10929164 10928409 -755 (-0.01%) 0.20%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes_client 3804778 3804520 -258 (-0.01%) 0.27%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha_server 41770213 41772461 2248 (0.01%) 0.27%
handshake_no_resume_aws_lc_rs_1.3_rsa_chacha_client 2633948 2634070 122 (0.00%) 0.20%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha_server 43135942 43137714 1772 (0.00%) 0.25%
handshake_no_resume_ring_1.3_ecdsap384_aes_server 7186495 7186781 286 (0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_chacha_server 7188456 7188732 276 (0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap256_aes_server 1238526 1238572 46 (0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap256_chacha_server 1239706 1239750 44 (0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap256_chacha_client 3275603 3275499 -104 (-0.00%) 0.23%
transfer_no_resume_ring_1.3_ecdsap256_aes_server 45911062 45912375 1313 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_aes_server 45912029 45912684 655 (0.00%) 0.20%
handshake_no_resume_ring_1.3_rsa_aes_server 11085672 11085820 148 (0.00%) 0.20%
handshake_no_resume_ring_1.3_rsa_chacha_server 11091428 11091576 148 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_rsa_aes_server 46074354 46074625 271 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.2_rsa_aes_client 57997665 57997506 -159 (-0.00%) 0.20%
transfer_no_resume_1.2_no_crypto_server 104818963 104819139 176 (0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_aes_client 34715334 34715388 54 (0.00%) 0.20%
handshake_no_resume_ring_1.3_ecdsap384_chacha_client 34717063 34717100 37 (0.00%) 0.20%
handshake_tickets_ring_1.3_rsa_chacha_server 32046748 32046774 26 (0.00%) 0.20%
handshake_tickets_ring_1.3_rsa_aes_server 32149768 32149794 26 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_aes_client 58065939 58065904 -35 (-0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_aes_server 46085956 46085983 27 (0.00%) 0.20%
transfer_no_resume_1.3_no_crypto_server 104858439 104858381 -58 (-0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.2_rsa_aes_server 46033469 46033490 21 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_rsa_aes_client 58072221 58072199 -22 (-0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_client 92526099 92526064 -35 (-0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_chacha_server 80147862 80147890 28 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_server 80266436 80266463 27 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_rsa_chacha_client 92533661 92533639 -22 (-0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_chacha_server 80147549 80147564 15 (0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_chacha_client 92480286 92480286 0 (0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_aes_server 45913072 45913072 0 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_aes_client 58065858 58065858 0 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_aes_client 57952915 57952915 0 (0.00%) 0.20%
transfer_no_resume_1.3_no_crypto_client 117078035 117078035 0 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap384_chacha_client 92480275 92480275 0 (0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_aes_client 57954206 57954206 0 (0.00%) 0.20%
transfer_no_resume_ring_1.2_rsa_aes_server 45844764 45844764 0 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_aes_client 57954195 57954195 0 (0.00%) 0.20%
transfer_no_resume_ring_1.3_ecdsap256_chacha_client 92480275 92480275 0 (0.00%) 0.20%
transfer_no_resume_ring_1.2_rsa_aes_client 57810832 57810832 0 (0.00%) 0.20%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_client 92526018 92526018 0 (0.00%) 0.20%
transfer_no_resume_ring_1.3_rsa_chacha_server 80147952 80147952 0 (0.00%) 0.20%
transfer_no_resume_1.2_no_crypto_client 117037511 117037511 0 (0.00%) 0.20%

Wall-time

Significant differences

There are no significant wall-time differences

Other differences

Click to expand
Scenario Baseline Candidate Diff Threshold
handshake_session_id_1.2_no_crypto 395.22 µs 372.83 µs -22.39 µs (-5.67%) 7.64%
handshake_tickets_1.2_no_crypto 432.63 µs 409.20 µs -23.43 µs (-5.42%) 8.20%
handshake_session_id_1.3_no_crypto 732.04 µs 761.91 µs 29.87 µs (4.08%) 5.63%
handshake_no_resume_1.2_no_crypto 76.99 µs 75.92 µs -1.07 µs (-1.39%) 14.12%
handshake_session_id_ring_1.2_rsa_aes 1.48 ms 1.47 ms -0.01 ms (-0.88%) 2.49%
handshake_session_id_aws_lc_rs_1.2_rsa_aes 1.66 ms 1.65 ms -0.01 ms (-0.84%) 2.03%
handshake_session_id_ring_1.3_ecdsap256_chacha 5.49 ms 5.53 ms 0.04 ms (0.72%) 1.94%
handshake_tickets_aws_lc_rs_1.2_rsa_aes 1.83 ms 1.82 ms -0.01 ms (-0.69%) 2.67%
handshake_session_id_ring_1.3_rsa_chacha 5.98 ms 6.02 ms 0.04 ms (0.65%) 1.62%
handshake_session_id_ring_1.3_ecdsap256_aes 5.53 ms 5.57 ms 0.03 ms (0.63%) 1.94%
handshake_tickets_ring_1.2_rsa_aes 1.57 ms 1.56 ms -0.01 ms (-0.62%) 3.10%
handshake_session_id_ring_1.3_rsa_aes 6.03 ms 6.06 ms 0.04 ms (0.61%) 1.81%
handshake_session_id_ring_1.3_ecdsap384_chacha 8.57 ms 8.62 ms 0.05 ms (0.57%) 1.65%
handshake_session_id_ring_1.3_ecdsap384_aes 8.61 ms 8.65 ms 0.04 ms (0.49%) 1.78%
handshake_tickets_1.3_no_crypto 707.34 µs 709.97 µs 2.64 µs (0.37%) 5.98%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes 7.44 ms 7.47 ms 0.03 ms (0.37%) 2.61%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes 8.12 ms 8.14 ms 0.03 ms (0.32%) 2.05%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha 543.06 µs 541.37 µs -1.68 µs (-0.31%) 3.93%
handshake_session_id_aws_lc_rs_1.3_rsa_aes 8.10 ms 8.13 ms 0.02 ms (0.30%) 2.14%
handshake_tickets_ring_1.3_ecdsap384_chacha 8.63 ms 8.65 ms 0.02 ms (0.24%) 1.73%
handshake_tickets_ring_1.3_rsa_chacha 6.04 ms 6.05 ms 0.01 ms (0.23%) 2.07%
handshake_tickets_ring_1.3_ecdsap256_chacha 5.54 ms 5.55 ms 0.01 ms (0.22%) 2.16%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes 7.63 ms 7.65 ms 0.02 ms (0.21%) 2.18%
handshake_tickets_aws_lc_rs_1.3_rsa_chacha 8.28 ms 8.26 ms -0.02 ms (-0.21%) 1.89%
handshake_tickets_ring_1.3_rsa_aes 6.09 ms 6.10 ms 0.01 ms (0.20%) 2.32%
transfer_no_resume_aws_lc_rs_1.2_rsa_aes 5.27 ms 5.28 ms 0.01 ms (0.20%) 7.21%
transfer_no_resume_aws_lc_rs_1.3_rsa_aes 5.45 ms 5.46 ms 0.01 ms (0.19%) 6.44%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha 1.23 ms 1.22 ms -0.00 ms (-0.18%) 1.67%
handshake_tickets_ring_1.3_ecdsap384_aes 8.67 ms 8.69 ms 0.02 ms (0.17%) 2.02%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes 1.23 ms 1.23 ms -0.00 ms (-0.17%) 1.78%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_aes 4.82 ms 4.83 ms 0.01 ms (0.16%) 7.59%
handshake_no_resume_aws_lc_rs_1.2_rsa_aes 1.05 ms 1.05 ms -0.00 ms (-0.15%) 1.58%
handshake_session_id_aws_lc_rs_1.3_rsa_chacha 8.07 ms 8.08 ms 0.01 ms (0.15%) 2.11%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes 545.29 µs 544.51 µs -0.78 µs (-0.14%) 3.77%
handshake_tickets_ring_1.3_ecdsap256_aes 5.58 ms 5.59 ms 0.01 ms (0.14%) 2.54%
handshake_tickets_aws_lc_rs_1.3_rsa_aes 8.29 ms 8.30 ms 0.01 ms (0.14%) 1.81%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha 8.30 ms 8.29 ms -0.01 ms (-0.12%) 1.75%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha 7.42 ms 7.43 ms 0.01 ms (0.12%) 2.11%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha 8.10 ms 8.10 ms 0.01 ms (0.12%) 1.60%
handshake_no_resume_aws_lc_rs_1.3_rsa_aes 1.18 ms 1.18 ms -0.00 ms (-0.11%) 2.00%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_aes 5.51 ms 5.51 ms 0.01 ms (0.11%) 6.74%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes 8.32 ms 8.33 ms 0.01 ms (0.10%) 2.09%
handshake_no_resume_ring_1.3_ecdsap256_aes 461.92 µs 462.38 µs 0.46 µs (0.10%) 3.38%
handshake_no_resume_ring_1.3_rsa_aes 950.57 µs 949.64 µs -0.92 µs (-0.10%) 1.59%
transfer_no_resume_ring_1.3_ecdsap256_aes 5.62 ms 5.62 ms -0.01 ms (-0.09%) 6.13%
handshake_no_resume_ring_1.3_ecdsap256_chacha 459.49 µs 459.89 µs 0.41 µs (0.09%) 4.34%
transfer_no_resume_1.3_no_crypto 12.01 ms 12.00 ms -0.01 ms (-0.08%) 3.08%
transfer_no_resume_ring_1.3_rsa_aes 6.11 ms 6.10 ms -0.01 ms (-0.08%) 5.71%
handshake_no_resume_ring_1.2_rsa_aes 943.47 µs 942.82 µs -0.65 µs (-0.07%) 1.67%
handshake_no_resume_1.3_no_crypto 84.99 µs 84.93 µs -0.06 µs (-0.07%) 13.65%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha 7.61 ms 7.61 ms -0.00 ms (-0.06%) 2.03%
transfer_no_resume_1.2_no_crypto 11.97 ms 11.96 ms -0.01 ms (-0.06%) 2.87%
handshake_no_resume_ring_1.3_ecdsap384_aes 3.55 ms 3.55 ms 0.00 ms (0.06%) 2.64%
transfer_no_resume_ring_1.3_ecdsap256_chacha 13.18 ms 13.19 ms 0.01 ms (0.06%) 2.81%
transfer_no_resume_aws_lc_rs_1.3_ecdsap256_chacha 13.30 ms 13.30 ms -0.01 ms (-0.06%) 2.72%
transfer_no_resume_aws_lc_rs_1.3_ecdsap384_chacha 13.99 ms 13.98 ms -0.01 ms (-0.06%) 2.60%
transfer_no_resume_aws_lc_rs_1.3_rsa_chacha 13.94 ms 13.93 ms -0.01 ms (-0.06%) 2.69%
handshake_no_resume_ring_1.3_rsa_chacha 953.59 µs 953.17 µs -0.42 µs (-0.04%) 1.66%
transfer_no_resume_ring_1.2_rsa_aes 6.01 ms 6.01 ms 0.00 ms (0.04%) 5.55%
handshake_no_resume_aws_lc_rs_1.3_rsa_chacha 1.18 ms 1.18 ms -0.00 ms (-0.03%) 1.43%
handshake_no_resume_ring_1.3_ecdsap384_chacha 3.55 ms 3.55 ms 0.00 ms (0.03%) 2.45%
transfer_no_resume_ring_1.3_ecdsap384_chacha 16.28 ms 16.28 ms 0.00 ms (0.02%) 1.73%
transfer_no_resume_ring_1.3_rsa_chacha 13.68 ms 13.68 ms 0.00 ms (0.01%) 2.53%
transfer_no_resume_ring_1.3_ecdsap384_aes 8.71 ms 8.71 ms -0.00 ms (-0.01%) 2.94%

Memory usage

Key:

  • ∑: sum usage for entire benchmark run
  • 🔝: peak usage
  • B: bytes
  • a: allocations

Significant differences

⚠️ There are significant memory usage differences

Click to expand
Scenario Baseline Candidate Diff Threshold
handshake_session_id_1.2_no_crypto_client ∑ 130403B 563a
🔝 51139B 191a
∑ 115619B 568a
🔝 45383B 276a
✅ ∑ -14784B +5a
🔝 -5756B +85a (-11.34%)
0.10%
handshake_tickets_1.2_no_crypto_client ∑ 132235B 569a
🔝 51139B 191a
∑ 117451B 574a
🔝 45383B 276a
✅ ∑ -14784B +5a
🔝 -5756B +85a (-11.18%)
0.10%
handshake_session_id_1.3_no_crypto_client ∑ 136516B 629a
🔝 51139B 191a
∑ 121732B 634a
🔝 45383B 276a
✅ ∑ -14784B +5a
🔝 -5756B +85a (-10.83%)
0.10%
handshake_tickets_1.3_no_crypto_client ∑ 136772B 629a
🔝 51139B 191a
∑ 121988B 634a
🔝 45383B 276a
✅ ∑ -14784B +5a
🔝 -5756B +85a (-10.81%)
0.10%
handshake_session_id_ring_1.2_rsa_aes_client ∑ 154025B 607a
🔝 51320B 191a
∑ 139241B 612a
🔝 45882B 221a
✅ ∑ -14784B +5a
🔝 -5438B +30a (-9.60%)
0.10%
handshake_tickets_ring_1.2_rsa_aes_client ∑ 155817B 612a
🔝 51320B 191a
∑ 141033B 617a
🔝 46162B 224a
✅ ∑ -14784B +5a
🔝 -5158B +33a (-9.49%)
0.10%
handshake_session_id_ring_1.3_ecdsap256_chacha_client ∑ 156841B 661a
🔝 51121B 191a
∑ 142057B 666a
🔝 45383B 276a
✅ ∑ -14784B +5a
🔝 -5738B +85a (-9.43%)
0.10%
handshake_session_id_ring_1.3_ecdsap256_aes_client ∑ 156838B 661a
🔝 51121B 191a
∑ 142056B 666a
🔝 45381B 276a
✅ ∑ -14782B +5a
🔝 -5740B +85a (-9.43%)
0.10%
handshake_session_id_ring_1.3_ecdsap384_aes_client ∑ 158634B 665a
🔝 51150B 191a
∑ 143849B 670a
🔝 45774B 234a
✅ ∑ -14785B +5a
🔝 -5376B +43a (-9.32%)
0.10%
handshake_session_id_ring_1.3_ecdsap384_chacha_client ∑ 158632B 665a
🔝 51150B 191a
∑ 143849B 670a
🔝 45774B 234a
✅ ∑ -14783B +5a
🔝 -5376B +43a (-9.32%)
0.10%
handshake_tickets_ring_1.3_ecdsap256_chacha_client ∑ 158665B 663a
🔝 51121B 191a
∑ 143880B 668a
🔝 45383B 276a
✅ ∑ -14785B +5a
🔝 -5738B +85a (-9.32%)
0.10%
handshake_tickets_ring_1.3_ecdsap256_aes_client ∑ 158665B 663a
🔝 51121B 191a
∑ 143881B 668a
🔝 45383B 276a
✅ ∑ -14784B +5a
🔝 -5738B +85a (-9.32%)
0.10%
handshake_no_resume_1.2_no_crypto_client ∑ 108417B 505a
🔝 45383B 276a
∑ 98377B 507a
🔝 45383B 276a
✅ ∑ -10040B +2a
🔝 +0B +0a (-9.26%)
0.10%
handshake_tickets_ring_1.3_ecdsap384_aes_client ∑ 160457B 667a
🔝 51150B 191a
∑ 145673B 672a
🔝 46002B 234a
✅ ∑ -14784B +5a
🔝 -5148B +43a (-9.21%)
0.10%
handshake_tickets_ring_1.3_ecdsap384_chacha_client ∑ 160457B 667a
🔝 51150B 191a
∑ 145673B 672a
🔝 46002B 234a
✅ ∑ -14784B +5a
🔝 -5148B +43a (-9.21%)
0.10%
handshake_no_resume_1.3_no_crypto_client ∑ 109763B 505a
🔝 45383B 276a
∑ 99723B 507a
🔝 45383B 276a
✅ ∑ -10040B +2a
🔝 +0B +0a (-9.15%)
0.10%
handshake_session_id_ring_1.3_rsa_aes_client ∑ 174100B 677a
🔝 55673B 231a
∑ 159316B 682a
🔝 50929B 234a
✅ ∑ -14784B +5a
🔝 -4744B +3a (-8.49%)
0.10%
handshake_session_id_ring_1.3_rsa_chacha_client ∑ 174102B 677a
🔝 55673B 231a
∑ 159318B 682a
🔝 50929B 234a
✅ ∑ -14784B +5a
🔝 -4744B +3a (-8.49%)
0.10%
handshake_no_resume_ring_1.3_ecdsap256_aes_client ∑ 119133B 521a
🔝 45381B 276a
∑ 109093B 523a
🔝 45381B 276a
✅ ∑ -10040B +2a
🔝 +0B +0a (-8.43%)
0.10%
handshake_no_resume_ring_1.3_ecdsap256_chacha_client ∑ 119135B 521a
🔝 45383B 276a
∑ 109096B 523a
🔝 45383B 276a
✅ ∑ -10039B +2a
🔝 +0B +0a (-8.43%)
0.10%
handshake_tickets_ring_1.3_rsa_aes_client ∑ 175924B 679a
🔝 55901B 231a
∑ 161140B 684a
🔝 51157B 234a
✅ ∑ -14784B +5a
🔝 -4744B +3a (-8.40%)
0.10%
handshake_tickets_ring_1.3_rsa_chacha_client ∑ 175926B 679a
🔝 55901B 231a
∑ 161142B 684a
🔝 51157B 234a
✅ ∑ -14784B +5a
🔝 -4744B +3a (-8.40%)
0.10%
handshake_no_resume_ring_1.3_ecdsap384_aes_client ∑ 119848B 525a
🔝 45383B 276a
∑ 109807B 527a
🔝 45383B 276a
✅ ∑ -10041B +2a
🔝 +0B +0a (-8.38%)
0.10%
handshake_no_resume_ring_1.3_ecdsap384_chacha_client ∑ 119847B 525a
🔝 45383B 276a
∑ 109808B 527a
🔝 45383B 276a
✅ ∑ -10039B +2a
🔝 +0B +0a (-8.38%)
0.10%
handshake_no_resume_ring_1.2_rsa_aes_client ∑ 123773B 537a
🔝 45381B 276a
∑ 113733B 539a
🔝 45381B 276a
✅ ∑ -10040B +2a
🔝 +0B +0a (-8.11%)
0.10%
handshake_no_resume_ring_1.3_rsa_aes_client ∑ 129332B 537a
🔝 45381B 276a
∑ 119292B 539a
🔝 45381B 276a
✅ ∑ -10040B +2a
🔝 +0B +0a (-7.76%)
0.10%
handshake_no_resume_ring_1.3_rsa_chacha_client ∑ 129334B 537a
🔝 45383B 276a
∑ 119294B 539a
🔝 45383B 276a
✅ ∑ -10040B +2a
🔝 +0B +0a (-7.76%)
0.10%
handshake_session_id_aws_lc_rs_1.2_rsa_aes_client ∑ 442582B 746a
🔝 184152B 199a
∑ 427798B 751a
🔝 179157B 231a
✅ ∑ -14784B +5a
🔝 -4995B +32a (-3.34%)
0.10%
handshake_tickets_aws_lc_rs_1.2_rsa_aes_client ∑ 444518B 751a
🔝 184229B 231a
∑ 429734B 756a
🔝 179485B 234a
✅ ∑ -14784B +5a
🔝 -4744B +3a (-3.33%)
0.10%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha_client ∑ 488363B 926a
🔝 187359B 243a
∑ 473616B 932a
🔝 182615B 246a
✅ ∑ -14747B +6a
🔝 -4744B +3a (-3.02%)
0.10%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes_client ∑ 488427B 926a
🔝 187359B 243a
∑ 473680B 932a
🔝 182615B 246a
✅ ∑ -14747B +6a
🔝 -4744B +3a (-3.02%)
0.10%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha_client ∑ 491048B 931a
🔝 187748B 243a
∑ 476227B 935a
🔝 183004B 246a
✅ ∑ -14821B +4a
🔝 -4744B +3a (-3.02%)
0.10%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes_client ∑ 489332B 926a
🔝 187695B 243a
∑ 474576B 932a
🔝 182951B 246a
✅ ∑ -14756B +6a
🔝 -4744B +3a (-3.02%)
0.10%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha_client ∑ 489259B 926a
🔝 187695B 243a
∑ 474512B 932a
🔝 182951B 246a
✅ ∑ -14747B +6a
🔝 -4744B +3a (-3.01%)
0.10%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes_client ∑ 491075B 930a
🔝 187748B 243a
∑ 476328B 936a
🔝 183004B 246a
✅ ∑ -14747B +6a
🔝 -4744B +3a (-3.00%)
0.10%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes_client ∑ 491980B 930a
🔝 188084B 243a
∑ 477215B 936a
🔝 183340B 246a
✅ ∑ -14765B +6a
🔝 -4744B +3a (-3.00%)
0.10%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha_client ∑ 491907B 930a
🔝 188084B 243a
∑ 477151B 936a
🔝 183340B 246a
✅ ∑ -14756B +6a
🔝 -4744B +3a (-3.00%)
0.10%
handshake_session_id_aws_lc_rs_1.3_rsa_chacha_client ∑ 527909B 975a
🔝 189912B 243a
∑ 513125B 980a
🔝 185168B 246a
✅ ∑ -14784B +5a
🔝 -4744B +3a (-2.80%)
0.10%
handshake_session_id_aws_lc_rs_1.3_rsa_aes_client ∑ 527973B 975a
🔝 189912B 243a
∑ 513189B 980a
🔝 185168B 246a
✅ ∑ -14784B +5a
🔝 -4744B +3a (-2.80%)
0.10%
handshake_tickets_aws_lc_rs_1.3_rsa_chacha_client ∑ 528805B 975a
🔝 190248B 243a
∑ 514021B 980a
🔝 185504B 246a
✅ ∑ -14784B +5a
🔝 -4744B +3a (-2.80%)
0.10%
handshake_tickets_aws_lc_rs_1.3_rsa_aes_client ∑ 528869B 975a
🔝 190248B 243a
∑ 514085B 980a
🔝 185504B 246a
✅ ∑ -14784B +5a
🔝 -4744B +3a (-2.80%)
0.10%
handshake_no_resume_aws_lc_rs_1.2_rsa_aes_client ∑ 411880B 666a
🔝 175128B 196a
∑ 401840B 668a
🔝 172753B 242a
✅ ∑ -10040B +2a
🔝 -2375B +46a (-2.44%)
0.10%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_client ∑ 422480B 691a
🔝 174958B 196a
∑ 412403B 692a
🔝 173629B 219a
✅ ∑ -10077B +1a
🔝 -1329B +23a (-2.39%)
0.10%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_client ∑ 420884B 686a
🔝 174929B 196a
∑ 410872B 689a
🔝 173600B 219a
✅ ∑ -10012B +3a
🔝 -1329B +23a (-2.38%)
0.10%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes_client ∑ 420916B 686a
🔝 174929B 196a
∑ 410904B 689a
🔝 173600B 219a
✅ ∑ -10012B +3a
🔝 -1329B +23a (-2.38%)
0.10%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes_client ∑ 422484B 690a
🔝 174958B 196a
∑ 412444B 692a
🔝 173629B 219a
✅ ∑ -10040B +2a
🔝 -1329B +23a (-2.38%)
0.10%
handshake_no_resume_aws_lc_rs_1.3_rsa_chacha_client ∑ 453359B 735a
🔝 178459B 250a
∑ 443319B 737a
🔝 178459B 250a
✅ ∑ -10040B +2a
🔝 +0B +0a (-2.21%)
0.10%
handshake_no_resume_aws_lc_rs_1.3_rsa_aes_client ∑ 453391B 735a
🔝 178475B 250a
∑ 443351B 737a
🔝 178475B 250a
✅ ∑ -10040B +2a
🔝 +0B +0a (-2.21%)
0.10%
handshake_session_id_1.3_no_crypto_server ∑ 149744B 649a
🔝 70599B 189a
∑ 151040B 659a
🔝 71639B 193a
⚠️ ∑ +1296B +10a
🔝 +1040B +4a (0.87%)
0.10%
handshake_session_id_ring_1.3_ecdsap256_aes_server ∑ 168850B 675a
🔝 72276B 194a
∑ 170152B 685a
🔝 73316B 198a
⚠️ ∑ +1302B +10a
🔝 +1040B +4a (0.77%)
0.10%
handshake_session_id_ring_1.3_ecdsap256_chacha_server ∑ 168855B 675a
🔝 72276B 194a
∑ 170151B 685a
🔝 73316B 198a
⚠️ ∑ +1296B +10a
🔝 +1040B +4a (0.77%)
0.10%
handshake_session_id_ring_1.3_ecdsap384_chacha_server ∑ 170072B 675a
🔝 72456B 194a
∑ 171371B 685a
🔝 73496B 198a
⚠️ ∑ +1299B +10a
🔝 +1040B +4a (0.76%)
0.10%
handshake_session_id_ring_1.3_ecdsap384_aes_server ∑ 170078B 675a
🔝 72456B 194a
∑ 171371B 685a
🔝 73496B 198a
⚠️ ∑ +1293B +10a
🔝 +1040B +4a (0.76%)
0.10%
handshake_session_id_1.2_no_crypto_server ∑ 146545B 556a
🔝 70599B 189a
∑ 147633B 561a
🔝 71639B 193a
⚠️ ∑ +1088B +5a
🔝 +1040B +4a (0.74%)
0.10%
handshake_session_id_ring_1.3_rsa_aes_server ∑ 186138B 699a
🔝 75128B 204a
∑ 187434B 709a
🔝 76168B 208a
⚠️ ∑ +1296B +10a
🔝 +1040B +4a (0.70%)
0.10%
handshake_session_id_ring_1.3_rsa_chacha_server ∑ 186140B 699a
🔝 75128B 204a
∑ 187436B 709a
🔝 76168B 208a
⚠️ ∑ +1296B +10a
🔝 +1040B +4a (0.70%)
0.10%
handshake_session_id_ring_1.2_rsa_aes_server ∑ 175939B 607a
🔝 75128B 204a
∑ 177027B 612a
🔝 76168B 208a
⚠️ ∑ +1088B +5a
🔝 +1040B +4a (0.62%)
0.10%
handshake_no_resume_1.2_no_crypto_server ∑ 120962B 493a
🔝 54879B 187a
∑ 121610B 495a
🔝 55527B 189a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.54%)
0.10%
handshake_no_resume_1.3_no_crypto_server ∑ 121459B 518a
🔝 54879B 187a
∑ 122107B 520a
🔝 55527B 189a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.53%)
0.10%
handshake_tickets_1.2_no_crypto_server ∑ 132315B 581a
🔝 63835B 203a
∑ 133011B 584a
🔝 64483B 205a
⚠️ ∑ +696B +3a
🔝 +648B +2a (0.53%)
0.10%
handshake_no_resume_ring_1.3_ecdsap256_chacha_server ∑ 134434B 538a
🔝 56556B 192a
∑ 135085B 540a
🔝 57204B 194a
⚠️ ∑ +651B +2a
🔝 +648B +2a (0.48%)
0.10%
handshake_no_resume_ring_1.3_ecdsap256_aes_server ∑ 134432B 538a
🔝 56556B 192a
∑ 135080B 540a
🔝 57204B 194a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.48%)
0.10%
handshake_no_resume_ring_1.3_ecdsap384_chacha_server ∑ 135654B 538a
🔝 56736B 192a
∑ 136305B 540a
🔝 57384B 194a
⚠️ ∑ +651B +2a
🔝 +648B +2a (0.48%)
0.10%
handshake_tickets_1.3_no_crypto_server ∑ 135032B 644a
🔝 63993B 209a
∑ 135680B 646a
🔝 64641B 211a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.48%)
0.10%
handshake_no_resume_ring_1.3_ecdsap384_aes_server ∑ 135657B 538a
🔝 56736B 192a
∑ 136302B 540a
🔝 57384B 194a
⚠️ ∑ +645B +2a
🔝 +648B +2a (0.48%)
0.10%
handshake_no_resume_ring_1.2_rsa_aes_server ∑ 148556B 539a
🔝 59408B 202a
∑ 149204B 541a
🔝 60056B 204a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.44%)
0.10%
handshake_tickets_ring_1.2_rsa_aes_server ∑ 162801B 633a
🔝 74512B 221a
∑ 163497B 636a
🔝 75160B 223a
⚠️ ∑ +696B +3a
🔝 +648B +2a (0.43%)
0.10%
handshake_no_resume_ring_1.3_rsa_aes_server ∑ 151701B 562a
🔝 59408B 202a
∑ 152349B 564a
🔝 60056B 204a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.43%)
0.10%
handshake_no_resume_ring_1.3_rsa_chacha_server ∑ 151703B 562a
🔝 59408B 202a
∑ 152351B 564a
🔝 60056B 204a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.43%)
0.10%
handshake_tickets_ring_1.3_ecdsap256_aes_server ∑ 155395B 671a
🔝 69831B 218a
∑ 156043B 673a
🔝 70479B 220a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.42%)
0.10%
handshake_tickets_ring_1.3_ecdsap256_chacha_server ∑ 155395B 671a
🔝 69831B 218a
∑ 156040B 673a
🔝 70478B 220a
⚠️ ∑ +645B +2a
🔝 +647B +2a (0.42%)
0.10%
handshake_tickets_ring_1.3_ecdsap384_aes_server ∑ 156615B 671a
🔝 70463B 218a
∑ 157263B 673a
🔝 71111B 220a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.41%)
0.10%
handshake_tickets_ring_1.3_ecdsap384_chacha_server ∑ 156615B 671a
🔝 70463B 218a
∑ 157263B 673a
🔝 71111B 220a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.41%)
0.10%
handshake_tickets_ring_1.3_rsa_aes_server ∑ 172678B 695a
🔝 75621B 228a
∑ 173326B 697a
🔝 76269B 230a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.38%)
0.10%
handshake_tickets_ring_1.3_rsa_chacha_server ∑ 172680B 695a
🔝 75621B 228a
∑ 173328B 697a
🔝 76269B 230a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.38%)
0.10%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_chacha_server ∑ 485728B 908a
🔝 205633B 207a
∑ 487120B 919a
🔝 206673B 211a
⚠️ ∑ +1392B +11a
🔝 +1040B +4a (0.29%)
0.10%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_chacha_server ∑ 483676B 903a
🔝 205421B 207a
∑ 484908B 912a
🔝 206461B 211a
⚠️ ∑ +1232B +9a
🔝 +1040B +4a (0.25%)
0.10%
handshake_session_id_aws_lc_rs_1.3_ecdsap256_aes_server ∑ 483748B 903a
🔝 205421B 207a
∑ 484980B 912a
🔝 206461B 211a
⚠️ ∑ +1232B +9a
🔝 +1040B +4a (0.25%)
0.10%
handshake_session_id_aws_lc_rs_1.3_ecdsap384_aes_server ∑ 485896B 909a
🔝 205633B 207a
∑ 487096B 918a
🔝 206673B 211a
⚠️ ∑ +1200B +9a
🔝 +1040B +4a (0.25%)
0.10%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_chacha_server ∑ 430639B 670a
🔝 189913B 205a
∑ 431383B 673a
🔝 190561B 207a
⚠️ ∑ +744B +3a
🔝 +648B +2a (0.17%)
0.10%
handshake_no_resume_aws_lc_rs_1.3_ecdsap384_aes_server ∑ 430771B 671a
🔝 189913B 205a
∑ 431419B 673a
🔝 190561B 207a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.15%)
0.10%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_chacha_server ∑ 477580B 923a
🔝 208171B 239a
∑ 478232B 925a
🔝 208820B 241a
⚠️ ∑ +652B +2a
🔝 +649B +2a (0.14%)
0.10%
handshake_tickets_aws_lc_rs_1.3_ecdsap384_aes_server ∑ 477656B 923a
🔝 208188B 239a
∑ 478304B 925a
🔝 208836B 241a
⚠️ ∑ +648B +2a
🔝 +648B +2a (0.14%)
0.10%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_chacha_server ∑ 428591B 665a
🔝 189701B 205a
∑ 429171B 666a
🔝 190349B 207a
⚠️ ∑ +580B +1a
🔝 +648B +2a (0.14%)
0.10%
handshake_no_resume_aws_lc_rs_1.3_ecdsap256_aes_server ∑ 428623B 665a
🔝 189701B 205a
∑ 429203B 666a
🔝 190349B 207a
⚠️ ∑ +580B +1a
🔝 +648B +2a (0.14%)
0.10%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_chacha_server ∑ 475432B 917a
🔝 207507B 239a
∑ 476016B 918a
🔝 208157B 241a
⚠️ ∑ +584B +1a
🔝 +650B +2a (0.12%)
0.10%
handshake_tickets_aws_lc_rs_1.3_ecdsap256_aes_server ∑ 475508B 917a
🔝 207524B 239a
∑ 476088B 918a
🔝 208173B 241a
⚠️ ∑ +580B +1a
🔝 +649B +2a (0.12%)
0.10%

Additional information

Historical results

Checkout details:

@djc

djc commented Jan 21, 2026

Copy link
Copy Markdown
Member

So interestingly, memory usage is much better but mostly only small benefits for performance, and only on the client...

@Tunglies

Copy link
Copy Markdown
Contributor Author

Basline

/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 100
5472
/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 1000
14848
/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 5000
54544
/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS13_AES_256_GCM_SHA384 100
7312
/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS13_AES_256_GCM_SHA384 1000
21184
/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS13_AES_256_GCM_SHA384 5000
83296

PR

/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 100
5424
/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 1000
14688
/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 5000
54512
/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS13_AES_256_GCM_SHA384 100
7248
/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS13_AES_256_GCM_SHA384 1000
21280
/usr/bin/env gtime -f %M target/release/rustls-bench memory TLS13_AES_256_GCM_SHA384 5000
83280

Designed follow the Paper FIFO queues are all you need for cache eviction in 4.1 S3-FIFO design - S3-FIFO algorithm

Other implementation reference: https://github.com/wfraser/s3fifo and https://github.com/YjyJeff/s3fifo

@Tunglies

Tunglies commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor Author

only small benefits for performance

I only do have one machine and with boost CPU. The benchmark locally follow by handshake TLS13_AES_256_GCM_SHA384 for quickly performance compare. And it does has difference between baseline and S3FIFO implementation on my machine.

Would you like to benchmark locally? And see if performance actually improved. My environment can not disable CPU boost.

@Tunglies
Tunglies force-pushed the perf/S3FIFO-ServerSessionMemoryCache branch from 8056b9d to 7800579 Compare January 21, 2026 15:44
@Tunglies

Tunglies commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Wrote some debug for checking capacity and len. Basline(Dequeue) in branch here and S3fifo in branch here

With > rustls-bench handshake-resume TLS13_AES_128_GCM_SHA256 we can see something likes (Copy randomly)


The Dequeue Map capacity increasing quickly to almost 4 times than setting(128) to

... 
LimitedCache observer: map capacity: 426, map len: 127, oldest capacity: 128, oldest len: 127

and map capacity decreasing while the progress till to be done

...
LimitedCache observer: map capacity: 369, map len: 127, oldest capacity: 128, oldest len: 127
// Done

The S3fifo also increasing capacity quickly but with less stress(capacity)

...
Cache Observer:
  Map:    len = 128, cap = 229
  Small:  len = 256, cap = 384
  Main:   len = 0, cap = 116
  Ghost:  len = 58, cap = 58
...
Cache Observer:
  Map:    len = 128, cap = 146
  Small:  len = 255, cap = 384
  Main:   len = 0, cap = 116
  Ghost:  len = 58, cap = 58
// Done

Roughly look over, has around 10% difference on max capacity, maybe the memory improvements is from here?

On the performance side, noticed that Main: len = 0, cap = 116, and never any K really put in main_queue. The additional condition check confirm my suspicion.

// Never has any print out
if main_len != 0 {
            println!("Cache Observer:");
            println!("  Map:    len = {}, cap = {}", map_len, map_cap);
            println!("  Small:  len = {}, cap = {}", small_len, small_cap);
            println!("  Main:   len = {}, cap = {}", main_len, main_cap);
            println!("  Ghost:  len = {}, cap = {}", ghost_len, ghost_cap);
        }

My implementation may have flaws, or the the benchmark not suitable for s3fifo implementation. I prefer it is due to my implementation. Still need works on it.

CC @djc

@Tunglies
Tunglies marked this pull request as draft January 21, 2026 20:20
@Tunglies

Tunglies commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Write a signle program for test S3fifo

Details
use rand_distr::{Distribution, Zipf};
use rustls::limited_cache::LimitedCache;
use std::time::Instant;

fn main() {
    let capacity = 400;
    let mut cache = LimitedCache::new(capacity);

    let mut rng = rand::rng();
    let zipf = Zipf::new(1000.0, 1.03).unwrap();

    println!("Starting Zipf distribution test with performance metrics...");

    let total_start = Instant::now();
    let mut last_checkpoint = Instant::now();
    let mut total_hits = 0;

    for i in 1..=20000 {
        let key = zipf.sample(&mut rng) as u64;

        if let Some(_) = cache.get(&key) {
            total_hits += 1;
        } else {
            cache.insert(key, vec![0u8; 10]);
        }

        if i % 1000 == 0 {
            let elapsed = last_checkpoint.elapsed();
            let avg_op_time = elapsed.as_nanos() / 1000;

            println!("--- Step {} ---", i);
            println!("Latency: {} ns/op", avg_op_time);

            cache.observer();

            last_checkpoint = Instant::now();
            println!();
        }
    }

    let total_duration = total_start.elapsed();
    let hit_rate = (total_hits as f64 / 20000.0) * 100.0;

    println!("========================================");
    println!("Test Completed!");
    println!("Total Duration:  {:.2?}", total_duration);
    println!(
        "Average Throughput: {:.2} ops/sec",
        20000.0 / total_duration.as_secs_f64()
    );
    println!("Overall Hit Rate:   {:.2}%", hit_rate);
    println!("========================================");
}
--- Step 20000 ---
Latency: 270 ns/op
Cache Observer:
  Map:    len = 400, cap = 791
  Small:  len = 39, cap = 40
  Main:   len = 361, cap = 720
  Ghost:  len = 400, cap = 400

========================================
Test Completed!
Total Duration:  5.56ms
Average Throughput: 3596556.30 ops/sec
Overall Hit Rate:   83.99%
========================================

It shows the implementation works as expected, rustls-bench did not cover the s3fifo use case. Forget the messy commits, rebase them at eventually.

@Tunglies
Tunglies marked this pull request as ready for review January 22, 2026 07:13
@Tunglies
Tunglies force-pushed the perf/S3FIFO-ServerSessionMemoryCache branch 2 times, most recently from e968dd7 to b9037f1 Compare January 22, 2026 07:49
@Tunglies
Tunglies marked this pull request as draft January 22, 2026 07:49
@Tunglies
Tunglies force-pushed the perf/S3FIFO-ServerSessionMemoryCache branch 4 times, most recently from 181789b to 4d09b73 Compare January 22, 2026 10:02
@Tunglies
Tunglies marked this pull request as ready for review January 22, 2026 12:49
@Tunglies
Tunglies requested a review from djc January 22, 2026 12:49
@Tunglies

Copy link
Copy Markdown
Contributor Author

Hey @djc, I have made some changes for better code coverage. Would you like to trigger the benchmark bot again? And see what's come up with. Also, we might need a additional benchmark use case for workload to see difference bewtween baseline and S3fifo implementation.

@Tunglies
Tunglies force-pushed the perf/S3FIFO-ServerSessionMemoryCache branch 3 times, most recently from 547906d to d6c5f41 Compare January 24, 2026 14:42
@Tunglies

Copy link
Copy Markdown
Contributor Author

Seemed some regression with d6c5f41 or 6bc3c92 .

Is any chance to rewrite Mutex<S3FifoShard> as cache: Arc<Mutex<S3FifoShard>> ? Wonder if it well changes the purpose behavior.

@Tunglies

Tunglies commented Feb 7, 2026

Copy link
Copy Markdown
Contributor Author

Hey @djc, any plan to going forward? Or see if https://cachemon.github.io/SIEVE-website/ could helps.

@ctz

ctz commented Feb 10, 2026

Copy link
Copy Markdown
Member

This is on my plate, sorry for the delay and I will try to get to it soon.

@Tunglies

Copy link
Copy Markdown
Contributor Author

Feel free to reach out, I'll handle the conflicts later.

@Tunglies
Tunglies marked this pull request as draft February 14, 2026 10:21
@Tunglies
Tunglies force-pushed the perf/S3FIFO-ServerSessionMemoryCache branch from d6c5f41 to 9715522 Compare February 14, 2026 10:33
@Tunglies
Tunglies force-pushed the perf/S3FIFO-ServerSessionMemoryCache branch 2 times, most recently from d10c31f to 65d965b Compare February 14, 2026 11:03
@Tunglies
Tunglies force-pushed the perf/S3FIFO-ServerSessionMemoryCache branch from 65d965b to a3e55e0 Compare February 14, 2026 11:03
@Tunglies
Tunglies marked this pull request as ready for review February 14, 2026 11:03
@Tunglies
Tunglies marked this pull request as draft February 14, 2026 11:10
@Tunglies

Copy link
Copy Markdown
Contributor Author

There you go. @ctz

@Tunglies
Tunglies marked this pull request as ready for review February 14, 2026 19:33
@KirillLykov

Copy link
Copy Markdown

I think it would be better to implement a data structure which is designed for the particular load that the tls1.3 cache experiences rather that adopting some general-purpose data structure. As have been mentioned in #1200 (comment), the complexity of 3 fifo doesn't give much of the profit here.

@Tunglies

Copy link
Copy Markdown
Contributor Author

Still any plan to forward? Or else I would like to close this PR on my own.

This branch has not been deployed

No deployments
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.

4 participants