nginx响应速度很慢
项目使用的是 django
+ uwsgi
+ nginx
下面是我的 uwsgi 和 nginx 的一些配置, 还有请求日志
1
uwsgi.ini
[uwsgi]
pythonpath=/xxx
static-map=/static=/xxx/static
chdir=/xxx
env=DJANGO_SETTINGS_MODULE=conf.settings
module=xxx.wsgi
master=True
pidfile=logs/xxx.pid
vacuum=True
max-requests=100000
enable-threads=true
processes=16
threads=32
listen=1024
log-slow=3000
daemonize=logs/wsgi.log
stats=/tmp/xxx/socket/stats.socket
http=0.0.0.0:6187
buffer-size=220000000
socket-timeout=1500
harakiri=1500
http-timeout=1500
reqeust log
[pid: 10550|app: 0|req: 549/6061] 103.218.240.105 () {50 vars in 1037 bytes}
[Mon Mar 8 15:24:30 2021] GET /api/v2/analysis/xxxx => generated 3890508 bytes in 397 msecs
(HTTP/1.1 200) 5 headers in 222 bytes (1 switches on core 16)
2
nginx.conf
worker_processes 12;
events {
use epoll;
worker_connections 65535;
}
http {
include mime.types;
include log_format.conf;
include upstream.conf;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
keepalive_timeout 1800;
server_tokens off;
client_max_body_size 100m;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 5;
gzip_types text/plain application/json application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
include "site-enabled/*.conf";
}
upstream.conf
upstream bv_crm_server_proxy_line {
server proxy.xxxx.cn:6187 weight=100 fail_timeout=0;
keepalive 500;
}
log_format.conf
log_format upstream '$remote_addr - $host [$time_local] "$request" '
'$status $body_bytes_sent $request_time $upstream_response_time '
'"$http_user_agent" "$http_x_forwarded_for" ';
site-enabled.xxx.conf
server {
listen 7020;
server_name xxxx.xx.cn;
client_max_body_size 100M;
access_log logs/xxx.log upstream;
root /home/smb/web/xxx/dist;
client_header_buffer_size 16k;
large_client_header_buffers 4 16k;
location ^~ /api/ {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_send_timeout 1800;
proxy_connect_timeout 1800;
proxy_read_timeout 1800;
proxy_ignore_client_abort on;
proxy_pass http://bv_crm_server_proxy_line;
}
location / {
try_files $uri /index.html =404;
}
}
192.168.12.12 - xxx.cn [08/Mar/2021:15:24:34 +0800] "GET /api/v2/analysis/xxx HTTP/1.1"
200 531500 4.714 4.714 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36" "103.120.18.243"
现在 nginx 的响应速度很慢,请求大佬帮忙看一下是不是哪里配置的有问题。
感谢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论