nginx影响性能

crazy_samba 2016-01-31 05:36:02
我的客户端向服务器传输文件,文件以512K作为一个块大小,一块一块地传给服务器端.这个服务器是用nginx作为代理的.

不用nginx作为代理时,速度大概200MB/s, 如果用nginx作为代理,速度就下降到100MB/s.请问有什么办法可以优化nginx性能呢?

下面是我的nginx.cnf文件内容:
#user  nobody;
worker_processes 4;

error_log X:\logs\Nginx/error.log;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_body_buffer_size 1m;

upstream localhost{
least_conn;
server 127.0.0.1:24042; # websocket backup server 1
}

server {
listen 442;
server_name localhost;

location / {
proxy_pass http://localhost; #have to set
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;#have to set
proxy_set_header Upgrade $http_upgrade;#have to set
proxy_set_header Connection "upgrade";#have to set
proxy_send_timeout 1h;#have to set, if not set it, it will close the connection after 60s.
proxy_read_timeout 1h;#have to set
}
}
}
...全文
208 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
crazy_samba 2016-02-02
  • 打赏
  • 举报
回复
Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() connection processing method is currently used, so high performance and scalability should not be expected. Due to this and some other known issues version of nginx for Windows is considered to be a beta version. At this time, it provides almost the same functionality as a UNIX version of nginx except for XSLT filter, image filter, GeoIP module, and embedded Perl language. 所以放弃在windows上使用Nginx....
crazy_samba 2016-02-01
  • 打赏
  • 举报
回复
有人可以给些建议吗?先谢谢了.
crazy_samba 2016-01-31
  • 打赏
  • 举报
回复
请问client_body_buffer_size从默认值4k改成512k,对性能为什么几乎没有影响呢?

25,984

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧