nginx学习随笔--sendfile
2017-09-12 11:30
232 查看
nginx学习随笔–sendfile
英文原文:Syntax: sendfile on | off; Default: sendfile off; Context: http, server, location, if in location
Enables or disables the use of sendfile().
Starting from nginx 0.8.12 and FreeBSD 5.2.1, aio can be used to pre-load data for sendfile():
location /video/ { sendfile on; tcp_nopush on; aio on; }
In this configuration, sendfile() is called with the SF_NODISKIO flag which causes it not to block on disk I/O, but, instead, report back that the data are not in memory. nginx then initiates an asynchronous data load by reading one byte. On the first read, the FreeBSD kernel loads the first 128K bytes of a file into memory, although next reads will only load data in 16K chunks. This can be changed using the read_ahead directive.
Before version 1.7.11, pre-loading could be enabled with aio sendfile;.
中文翻译:
允许或者禁止使用sendfile();
从nginx0.8.12和FreeBSD5.2.1开始,aio可以用来为sendfile()预加载数据。
location /video/ { sendfile on; tcp_nopush on; aio on; }
在上面的配置中,sendfile()和SF_NODISKIO标记一起调用,可以在不阻塞I/O的情况下,报告数据还没有到内存。nginx通过读取一个字节来启动异步数据加载。第一次读的时候,FreeBSD内核加载一个文件的第一个128K字节数据到内存中,下次再读数据时就只加载16K数据块数据。可以通过指令read_ahead来修改首次加在数据的量。
相关文章推荐
- nginx学习随笔--worker_processes
- nginx学习随笔--error_log
- nginx学习随笔--worker_rlimit_nofile
- nginx学习随笔--connection processing methods
- nginx学习随笔--keepalive_timeout
- nginx学习随笔--tcp-nopush
- nginx学习随笔--events
- nginx学习随笔--multi_accept
- nginx学习随笔--ssl_session_cache
- nginx学习随笔--proxy_temp_path
- nginx学习随笔--pid
- nginx学习随笔--use
- nginx学习随笔--tcp_nodelay
- nginx学习随笔--worker_rlimit_core
- 基于Theano的深度学习(Deep Learning)框架Keras学习随笔-09-约束限制
- 流媒体技术学习笔记之(一)nginx+nginx-rtmp-module+ffmpeg搭建流媒体服务器
- 【随笔】nginx重启问题和mysql挂了的解决办法
- Linux学习笔记之更新yum安装最新Nginx+Php
- 学习随笔——Hadoop伪分布式搭建
- nginx 整合tomcat 配置 学习笔记