OpenSSL speed 命令实战:加密算法性能基准测试

openssl speed 是 OpenSSL 官方提供的加密算法性能基准测试工具。通过它可以了解不同加密算法在当前硬件上的处理速度,从而为生产环境选择合适的加密算法提供数据支撑。 基本用法 1 openssl speed [options] [algorithm...] 常用选项: -seconds N — 测试持续时间(默认 10 秒) -bytes N — 测试缓冲区大小(默认 16KB) -evp name — 使用 EVP 接口测试指定算法 -elapsed — 使用 wall-clock 时间而非 CPU 时间 -mr — 产生机器可读的输出 对称加密算法性能测试 测试 AES-256-GCM 1 2 3 4 5 6 7 8 9 10 $ openssl speed -seconds 1 -evp aes-256-gcm Doing AES-256-GCM for 1s on 16 size blocks: 1502986 AES-256-GCM's in 1....

June 17, 2026 · 3 min · 黑豆子

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 · 黑豆子