服务器问答
Python 使用者,对比了一下用 Tornado Fastapi 和 Nginx 做文件上传服务器,在 100+ 并发的情况下测试,发现 Nginx 这个模块只用了 120% 左右的 CPU,而 Python 这些服务可以打满 CPU,从而造成 Nginx 上传速度比 Python 慢 2-3 倍的情况。upload 模块版本为 2.3.0,Nginx 为 1.19.1,upload 的 conf 如下:
server {
listen 80;
client_max_body_size 10M; 抗投诉服务器# 文件传输限制 10M
upload_buffer_size 10M; # 文件 buffer 10M
location /upload {
upload_pass @after_upload;
upload_store /storage;
upload_store_access user:rw group:rw all:r;
upload_set_form_field $upload_field_name.name "$upload_file_name";
upload_set_form_field $upload_field_name.content_type "$upload_content_type";
upload_set_form_field $upload_field_name.path "$upload_tmp_path";
upload_aggregate_form_field $upload_field_name.md5 "$upload_file_md5";
upload_aggregate_form_field $upload_field_name.size "$upload_file_size";
upload_pass_form_field "^.*$"; #
upload_cleanup 400 404 499 500-505;
}
location @after_upload {
proxy_pass http://filesys_handler:8090;
}
}
求大佬们能解惑,如果这个模块是因为缺乏支持而这样的话我就要弃用了