← All Use Cases
🌐
Box-Behnken Design

TLS Handshake Optimization

Box-Behnken design for TLS version, cipher choice, and session cache for handshake speed

Summary

This experiment investigates tls handshake optimization. Box-Behnken design for TLS version, cipher choice, and session cache for handshake speed.

The design varies 3 factors: session cache size (entries), ranging from 1000 to 100000, session timeout s (s), ranging from 60 to 86400, and ocsp stapling workers (threads), ranging from 1 to 8. The goal is to optimize 2 responses: handshake ms (ms) (minimize) and resumption rate (%) (maximize). Fixed conditions held constant across all runs include tls version = 1.3, cipher = AES-256-GCM.

A Box-Behnken design was chosen because it efficiently fits quadratic models with 3 continuous factors while avoiding extreme corner combinations — requiring only 15 runs instead of the 8 needed for a full factorial at two levels.

Quadratic response surface models were fitted to capture potential curvature and factor interactions. The RSM contour plots below visualize how pairs of factors jointly affect each response.

Key Findings

For handshake ms, the most influential factors were session timeout s (44.8%), session cache size (36.9%), ocsp stapling workers (18.2%). The best observed value was 32.0 (at session cache size = 1000, session timeout s = 43230, ocsp stapling workers = 1).

For resumption rate, the most influential factors were session timeout s (37.0%), ocsp stapling workers (32.9%), session cache size (30.2%). The best observed value was 85.9 (at session cache size = 1000, session timeout s = 86400, ocsp stapling workers = 4.5).

Recommended Next Steps

Experimental Setup

Factors

FactorLowHighUnit
session_cache_size1000100000entries
session_timeout_s6086400s
ocsp_stapling_workers18threads

Fixed: tls_version = 1.3, cipher = AES-256-GCM

Responses

ResponseDirectionUnit
handshake_ms↓ minimizems
resumption_rate↑ maximize%

Configuration

use_cases/48_tls_handshake_optimization/config.json
{ "metadata": { "name": "TLS Handshake Optimization", "description": "Box-Behnken design for TLS version, cipher choice, and session cache for handshake speed" }, "factors": [ { "name": "session_cache_size", "levels": [ "1000", "100000" ], "type": "continuous", "unit": "entries" }, { "name": "session_timeout_s", "levels": [ "60", "86400" ], "type": "continuous", "unit": "s" }, { "name": "ocsp_stapling_workers", "levels": [ "1", "8" ], "type": "continuous", "unit": "threads" } ], "fixed_factors": { "tls_version": "1.3", "cipher": "AES-256-GCM" }, "responses": [ { "name": "handshake_ms", "optimize": "minimize", "unit": "ms" }, { "name": "resumption_rate", "optimize": "maximize", "unit": "%" } ], "settings": { "operation": "box_behnken", "test_script": "use_cases/48_tls_handshake_optimization/sim.sh" } }

Experimental Matrix

The Box-Behnken Design produces 15 runs. Each row is one experiment with specific factor settings.

Runsession_cache_sizesession_timeout_socsp_stapling_workers
150500601
250500432304.5
3100000432308
4100000432301
550500432304.5
650500432304.5
71000432308
8100000604.5
950500608
10100000864004.5
111000432301
1250500864008
131000604.5
141000864004.5
1550500864001

Step-by-Step Workflow

1

Preview the design

Terminal
$ doe info --config use_cases/48_tls_handshake_optimization/config.json
2

Generate the runner script

Terminal
$ doe generate --config use_cases/48_tls_handshake_optimization/config.json \ --output use_cases/48_tls_handshake_optimization/results/run.sh --seed 42
3

Execute the experiments

Terminal
$ bash use_cases/48_tls_handshake_optimization/results/run.sh
4

Analyze results

Terminal
$ doe analyze --config use_cases/48_tls_handshake_optimization/config.json
5

Get optimization recommendations

Terminal
$ doe optimize --config use_cases/48_tls_handshake_optimization/config.json
6

Multi-objective optimization

With 2 competing responses, use --multi to find the best compromise via Derringer–Suich desirability.

Terminal
$ doe optimize --config use_cases/48_tls_handshake_optimization/config.json --multi
7

Generate the HTML report

Terminal
$ doe report --config use_cases/48_tls_handshake_optimization/config.json \ --output use_cases/48_tls_handshake_optimization/results/report.html

Features Exercised

FeatureValue
Design typebox_behnken
Factor typescontinuous (all 3)
Arg styledouble-dash
Responses2 (handshake_ms ↓, resumption_rate ↑)
Total runs15

Analysis Results

Generated from actual experiment runs using the DOE Helper Tool.

Response: handshake_ms

Top factors: session_timeout_s (44.8%), session_cache_size (36.9%), ocsp_stapling_workers (18.2%).

ANOVA

SourceDFSSMSFp-value
SourceDFSSMSFp-value
session_cache_size2341.8533170.92660.4590.6475
session_timeout_s2663.3533331.67660.8910.4474
ocsp_stapling_workers2106.177253.08860.1430.8693
LackofFit6221.879036.9798
PureError2744.6067
Error8966.4856372.3033
Total142077.8693148.4192

Pareto Chart

Pareto chart for handshake_ms

Main Effects Plot

Main effects plot for handshake_ms

Normal Probability Plot of Effects

Normal probability plot for handshake_ms

Half-Normal Plot of Effects

Half-normal plot for handshake_ms

Model Diagnostics

Model diagnostics for handshake_ms

Response: resumption_rate

Top factors: session_timeout_s (37.0%), ocsp_stapling_workers (32.9%), session_cache_size (30.2%).

ANOVA

SourceDFSSMSFp-value
SourceDFSSMSFp-value
session_cache_size2713.4387356.71930.4060.6793
session_timeout_s21144.5098572.25490.6510.5470
ocsp_stapling_workers2951.4158475.70790.5410.6018
LackofFit6905.6624150.9437
PureError21757.3267
Error82662.9890878.6633
Total145472.3533390.8824

Pareto Chart

Pareto chart for resumption_rate

Main Effects Plot

Main effects plot for resumption_rate

Normal Probability Plot of Effects

Normal probability plot for resumption_rate

Half-Normal Plot of Effects

Half-normal plot for resumption_rate

Model Diagnostics

Model diagnostics for resumption_rate

Response Surface Plots

3D surfaces fitted with quadratic RSM. Red dots are observed data points.

handshake ms session cache size vs ocsp stapling workers

RSM surface: handshake ms session cache size vs ocsp stapling workers

handshake ms session cache size vs session timeout s

RSM surface: handshake ms session cache size vs session timeout s

handshake ms session timeout s vs ocsp stapling workers

RSM surface: handshake ms session timeout s vs ocsp stapling workers

resumption rate session cache size vs ocsp stapling workers

RSM surface: resumption rate session cache size vs ocsp stapling workers

resumption rate session cache size vs session timeout s

RSM surface: resumption rate session cache size vs session timeout s

resumption rate session timeout s vs ocsp stapling workers

RSM surface: resumption rate session timeout s vs ocsp stapling workers

Multi-Objective Optimization

When responses compete, Derringer–Suich desirability finds the best compromise. Each response is scaled to a 0–1 desirability, then combined via a weighted geometric mean.

Overall Desirability
D = 0.9150

Per-Response Desirability

ResponseWeightDesirabilityPredictedDir
handshake_ms 1.0
0.8586
36.60 0.8586 36.60 ms
resumption_rate 1.5
0.9545
85.90 0.9545 85.90 %

Recommended Settings

FactorValue
session_cache_size100000 entries
session_timeout_s43230 s
ocsp_stapling_workers8 threads

Source: from observed run #10

Trade-off Summary

Sacrifice = how much worse than single-objective best.

ResponsePredictedBest ObservedSacrifice
resumption_rate85.9085.90+0.00

Top 3 Runs by Desirability

RunDFactor Settings
#30.8623session_cache_size=50500, session_timeout_s=43230, ocsp_stapling_workers=4.5
#120.7816session_cache_size=1000, session_timeout_s=86400, ocsp_stapling_workers=4.5

Model Quality

ResponseType
resumption_rate0.6081quadratic

Full Multi-Objective Output

doe optimize --multi
============================================================ MULTI-OBJECTIVE OPTIMIZATION Method: Derringer-Suich Desirability Function ============================================================ Overall desirability: D = 0.9150 Response Weight Desirability Predicted Direction --------------------------------------------------------------------- handshake_ms 1.0 0.8586 36.60 ms ↓ resumption_rate 1.5 0.9545 85.90 % ↑ Recommended settings: session_cache_size = 100000 entries session_timeout_s = 43230 s ocsp_stapling_workers = 8 threads (from observed run #10) Trade-off summary: handshake_ms: 36.60 (best observed: 32.00, sacrifice: +4.60) resumption_rate: 85.90 (best observed: 85.90, sacrifice: +0.00) Model quality: handshake_ms: R² = 0.6594 (quadratic) resumption_rate: R² = 0.6081 (quadratic) Top 3 observed runs by overall desirability: 1. Run #10 (D=0.9150): session_cache_size=100000, session_timeout_s=43230, ocsp_stapling_workers=8 2. Run #3 (D=0.8623): session_cache_size=50500, session_timeout_s=43230, ocsp_stapling_workers=4.5 3. Run #12 (D=0.7816): session_cache_size=1000, session_timeout_s=86400, ocsp_stapling_workers=4.5

Full Analysis Output

doe analyze
=== Main Effects: handshake_ms === Factor Effect Std Error % Contribution -------------------------------------------------------------- session_timeout_s 15.8107 3.1456 44.8% session_cache_size 13.0250 3.1456 36.9% ocsp_stapling_workers 6.4321 3.1456 18.2% === ANOVA Table: handshake_ms === Source DF SS MS F p-value ----------------------------------------------------------------------------- session_cache_size 2 341.8533 170.9266 0.459 0.6475 session_timeout_s 2 663.3533 331.6766 0.891 0.4474 ocsp_stapling_workers 2 106.1772 53.0886 0.143 0.8693 Lack of Fit 6 221.8790 36.9798 0.099 0.9879 Pure Error 2 744.6067 372.3033 Error 8 966.4856 372.3033 Total 14 2077.8693 148.4192 === Summary Statistics: handshake_ms === session_cache_size: Level N Mean Std Min Max ------------------------------------------------------------ 1000 4 43.0000 9.4717 35.0000 55.7000 100000 4 56.0250 10.0613 46.0000 65.7000 50500 7 48.6857 13.9235 32.0000 75.6000 session_timeout_s: Level N Mean Std Min Max ------------------------------------------------------------ 43230 7 55.6857 13.1931 41.0000 75.6000 60 4 46.9000 7.9603 36.6000 55.7000 86400 4 39.8750 7.7474 32.0000 48.8000 ocsp_stapling_workers: Level N Mean Std Min Max ------------------------------------------------------------ 1 4 49.5250 14.4933 32.0000 65.7000 4.5 7 46.6429 13.6731 35.0000 75.6000 8 4 53.0750 8.5597 43.7000 63.6000 === Main Effects: resumption_rate === Factor Effect Std Error % Contribution -------------------------------------------------------------- session_timeout_s 20.9893 5.1048 37.0% ocsp_stapling_workers 18.6750 5.1048 32.9% session_cache_size 17.1250 5.1048 30.2% === ANOVA Table: resumption_rate === Source DF SS MS F p-value ----------------------------------------------------------------------------- session_cache_size 2 713.4387 356.7193 0.406 0.6793 session_timeout_s 2 1144.5098 572.2549 0.651 0.5470 ocsp_stapling_workers 2 951.4158 475.7079 0.541 0.6018 Lack of Fit 6 905.6624 150.9437 0.172 0.9607 Pure Error 2 1757.3267 878.6633 Error 8 2662.9890 878.6633 Total 14 5472.3533 390.8824 === Summary Statistics: resumption_rate === session_cache_size: Level N Mean Std Min Max ------------------------------------------------------------ 1000 4 61.9500 19.1744 40.8000 85.9000 100000 4 44.8250 17.1484 27.2000 63.6000 50500 7 47.5571 21.5009 13.2000 74.0000 session_timeout_s: Level N Mean Std Min Max ------------------------------------------------------------ 43230 7 42.2857 19.4086 13.2000 69.7000 60 4 52.7250 23.9978 33.5000 85.9000 86400 4 63.2750 10.6456 48.7000 74.0000 ocsp_stapling_workers: Level N Mean Std Min Max ------------------------------------------------------------ 1 4 47.2500 21.2629 27.2000 74.0000 4.5 7 58.7000 22.5078 13.2000 85.9000 8 4 40.0250 6.4552 33.8000 48.7000

Optimization Recommendations

doe optimize
=== Optimization: handshake_ms === Direction: minimize Best observed run: #3 session_cache_size = 1000 session_timeout_s = 43230 ocsp_stapling_workers = 1 Value: 32.0 RSM Model (linear, R² = 0.1849, Adj R² = -0.0374): Coefficients: intercept +49.1267 session_cache_size +5.5875 session_timeout_s -2.2125 ocsp_stapling_workers +3.4500 RSM Model (quadratic, R² = 0.5929, Adj R² = -0.1399): Coefficients: intercept +58.3333 session_cache_size +5.5875 session_timeout_s -2.2125 ocsp_stapling_workers +3.4500 session_cache_size*session_timeout_s +10.0250 session_cache_size*ocsp_stapling_workers +2.1500 session_timeout_s*ocsp_stapling_workers -2.0000 session_cache_size^2 -3.0792 session_timeout_s^2 -4.5792 ocsp_stapling_workers^2 -9.6042 Curvature analysis: ocsp_stapling_workers coef=-9.6042 concave (has a maximum) session_timeout_s coef=-4.5792 concave (has a maximum) session_cache_size coef=-3.0792 concave (has a maximum) Notable interactions: session_cache_size*session_timeout_s coef=+10.0250 (synergistic) session_cache_size*ocsp_stapling_workers coef=+2.1500 (synergistic) session_timeout_s*ocsp_stapling_workers coef=-2.0000 (antagonistic) Predicted optimum (from linear model, at observed points): session_cache_size = 100000 session_timeout_s = 43230 ocsp_stapling_workers = 8 Predicted value: 58.1642 Surface optimum (via L-BFGS-B, linear model): session_cache_size = 1000 session_timeout_s = 86400 ocsp_stapling_workers = 1 Predicted value: 37.8767 Model quality: Weak fit — consider adding center points or using a different design. Factor importance: 1. ocsp_stapling_workers (effect: 12.5, contribution: 42.3%) 2. session_cache_size (effect: 11.2, contribution: 37.8%) 3. session_timeout_s (effect: 5.9, contribution: 19.9%) === Optimization: resumption_rate === Direction: maximize Best observed run: #10 session_cache_size = 1000 session_timeout_s = 86400 ocsp_stapling_workers = 4.5 Value: 85.9 RSM Model (linear, R² = 0.1530, Adj R² = -0.0780): Coefficients: intercept +50.6667 session_cache_size -7.8875 session_timeout_s +6.0875 ocsp_stapling_workers -2.3250 RSM Model (quadratic, R² = 0.6768, Adj R² = 0.0950): Coefficients: intercept +34.2333 session_cache_size -7.8875 session_timeout_s +6.0875 ocsp_stapling_workers -2.3250 session_cache_size*session_timeout_s -19.8750 session_cache_size*ocsp_stapling_workers -4.1500 session_timeout_s*ocsp_stapling_workers -4.2500 session_cache_size^2 +8.9958 session_timeout_s^2 +6.9958 ocsp_stapling_workers^2 +14.8208 Curvature analysis: ocsp_stapling_workers coef=+14.8208 convex (has a minimum) session_cache_size coef=+8.9958 convex (has a minimum) session_timeout_s coef=+6.9958 convex (has a minimum) Notable interactions: session_cache_size*session_timeout_s coef=-19.8750 (antagonistic) session_timeout_s*ocsp_stapling_workers coef=-4.2500 (antagonistic) session_cache_size*ocsp_stapling_workers coef=-4.1500 (antagonistic) Predicted optimum (from quadratic model, at observed points): session_cache_size = 1000 session_timeout_s = 86400 ocsp_stapling_workers = 4.5 Predicted value: 84.0750 Surface optimum (via L-BFGS-B, quadratic model): session_cache_size = 1000 session_timeout_s = 86400 ocsp_stapling_workers = 1 Predicted value: 101.3208 Model quality: Moderate fit — use predictions directionally, not precisely. Factor importance: 1. ocsp_stapling_workers (effect: 16.0, contribution: 36.4%) 2. session_cache_size (effect: 15.8, contribution: 35.9%) 3. session_timeout_s (effect: 12.2, contribution: 27.7%)
← Previous: TCP Congestion Control Next: Firewall Rule Ordering →