配置文件如下
但是下载大文件的时候(文件超过 2GB)只吃满 1 个 CPU 核心,其他 3 个核心没有负载,然后速度也只有大概 30MB/s 跑不满带宽
如果不开启 https,只使用 http 是可以跑满 4 个核心的,所以来求问需要如何配置才能在 https 下载时同时调用多个核心呢?
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
types_hash_max_size 4096;
server_names_hash_bucket_size 128;
server {
listen 80 default_server;
return 301 https://$host$request_uri;
}
server {
listen 443 http2 ssl;
ssl_certificate /path/to/signed_cert_plus_intermediates;
ssl_certificate_key /path/to/private_key;
ssl_session_timeout 1d;
ssl_session_cache off;
ssl_session_tickets off;
ssl_dhparam /path/to/dhparam.pem;
ssl_protocols TLSv1.3;
ssl_prefer_server_ciphers off;
add_header Strict-Transport-Security "max-age=31536000" always;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /path/to/signed_cert_plus_intermediates;
resolver 1.1.1.1 8.8.8.8 valid=60s;
location / {
alias /download/;
aio threads;
}
}
}
1
Qetesh 2021-05-06 00:27:45 +08:00 via iPhone
可以考虑有个专门的 ssl 卸载,或者试试 reuseport 参数。没试过,希望楼主试过之后反馈下。
|