9
在 TLS 上 Go 比 Nginx 厉害这么多吗?
source link: https://www.v2ex.com/t/877014
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
是我测试流程有问题吗?或者环境?
带:2222
的是 go 写的 https server 。代码很简单。都是标准库的。
根路径就返回个 index.html 内容是 404 not found
nginx 10 秒 1771 go 就 10 秒 6.9w
go 的 tlsconfig 如下
tlsCfg := &tls.Config{
SessionTicketsDisabled: false,
ClientSessionCache: tls.NewLRUClientSessionCache(1000)
}
nginx ssl 配置部分如下
ssl_certificate .pem;
ssl_certificate_key .key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1.2;
ssl_prefer_server_ciphers on;
证书是 rsa2048
而且还有测试期间,nginx 部分就 cpu100% go 部分就 cpu50%上下。
服务器是阿里云的性能突发实例。
第 1 条附言 · 8 小时 28 分钟前
服务器是 [阿里云] 的性能突发实例 8c8g
第 2 条附言 · 8 小时 24 分钟前
nginx
http {
user www www;
worker_processes auto;
worker_cpu_affinity auto;
error_log /usr/local/nginx/logs/error.log error;
pid /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 65535;
}
server_names_hash_max_size 1024;
server_names_hash_bucket_size 2048;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
tcp_nodelay on;
fastcgi_connect_timeout 15;
fastcgi_send_timeout 15;
fastcgi_read_timeout 15;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
ssl_session_cache ssl_session_cache builtin:1000 shared:SSL:10m;
server {
listen 443 ssl http2;
server_name xxx;
root xxx;
index index.html index.php;
ssl_certificate xxx.pem;
ssl_certificate_key xxx.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
}
}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK