如果nginx只配置为将请求转发到FastCGI后端(Mono、PHP等),而不涉及任何基于文件的缓存,那么sendfile on在nginx.conf中的使用会带来性能改进吗?
示例nginx.conf:
worker_processes 1;
daemon off;
events {
worker_connections 1024;
use epoll;
}
http {
sendfile on; # <-- ???
tcp_nopush on;
tcp_nodelay on;
server {
listen 80;
server_name localhost;
location / {
root /usr/aspnet/;
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/nginx-fastcgi-params.conf;
}
}
}发布于 2015-11-06 22:57:44
来自Sendfile手册页
ssize_t sendfile(int out_fd,int in_fd,off_t *偏移",size_t“”count“); …… in_fd参数必须对应于支持mmap(2)-like操作的文件(也就是说,它不能是套接字)。
换句话说,启用sendfile不会产生任何影响,除非nginx是从可以像文件一样映射到虚拟内存空间的东西中读取。因此,它不会对fastcgi_pass的性能产生任何影响。
https://stackoverflow.com/questions/33565085
复制相似问题