OpenSSL s_time:SSL/TLS 性能测试工具详解

openssl s_time 是 OpenSSL 官方提供的 SSL/TLS 性能基准测试工具。它通过模拟大量握手连接来测量服务器的每秒处理能力,是评估 TLS 性能的重要工具。 基本用法 1 openssl s_time -connect example.com:443 -new -time 10 参数说明: -connect host:port — 目标服务器地址(默认端口 4433) -new — 测试新建连接(完整握手) -reuse — 测试连接重用(会话恢复) -time seconds — 测试持续时间(默认 30 秒) 实际测试示例 测试 TLS 1.3 新建连接 1 2 3 4 5 6 $ openssl s_time -connect localhost:443 -new -time 3 -tls1_3 Collecting connection statistics for 3 seconds ********************************************************************************************************************************************************************************************************************************** 1243 connections in 1.85s; 671.89 connections/user sec, 0 bytes read per connection 1243 connections in 4 real seconds 测试 TLS 1....

May 16, 2026 · 2 min · 黑豆子

SSL/TLS 握手性能优化:Session Resumption 实战

SSL/TLS 握手是 HTTPS 性能的关键瓶颈。本文聚焦会话恢复(Session Resumption)技术,帮助你减少握手延迟。 问题:SSL 握手的开销 完整的 TLS 握手需要多次网络往返: 1 2 3 4 5 # 测试握手时间 curl -w "Time: %{time_total}s\n" -o /dev/null -s https://example.com # 使用 openssl 测试连接时间 time openssl s_client -connect example.com:443 </dev/null 对于 TLS 1.2,完整握手需要 2 个 RTT。通过会话恢复可以降至 0-1 个 RTT。 Session ID 复用 工作原理 服务器为每个会话分配唯一 ID,客户端在后续连接时发送该 ID,服务器据此恢复会话状态。 Nginx 配置 1 2 3 4 5 6 7 8 9 10 11 12 server { listen 443 ssl; server_name example....

March 28, 2026 · 3 min · 黑豆子