1.错误日志:warn:an upstream response is buffered to a temporary file

解决办法:增加fastcgi_buffers 8 4K;     fastcgi_buffer_size 4K;

2. a client request body is buffered to a temporary file

解决办法:增加client_max_body_size 2050m;     client_body_buffer_size 1024k;

Nginx 的 buffer 机制:

对于来自 FastCGI Server 的 Response,Nginx 将其缓冲到内存中,然后依次发送到客户端浏览器。缓冲区的大小由 fastcgi_buffers 和 fastcgi_buffer_size 两个值控制。

比如如下配置:

fastcgi_buffers      8 4K;
fastcgi_buffer_size 4K;

fastcgi_buffers 控制 nginx 最多创建 8 个大小为 4K 的缓冲区,而 fastcgi_buffer_size 则是处理 Response 时第一个缓冲区的大小,不包含在前者中。所以总计能创建的最大内存缓冲区大小是 8*4K+4K = 36k。而这些缓冲区是根据实际的 Response 大小动态生成的,并不是一次性创建的。比如一个 8K 的页面,Nginx 会创建 2*4K 共 2 个 buffers。

当 Response 小于等于 36k 时,所有数据当然全部在内存中处理。如果 Response 大于 36k 呢?fastcgi_temp 的作用就在于此。多出来的数据会被临时写入到文件中,放在这个目录下面。同时你会在 error.log 中看到一条类似 warning:

2010/03/13 03:42:22 [warn] 3994#0: *1 an upstream response is buffered to a temporary file
/usr/local/nginx/fastcgi_temp/1/00/0000000001 while reading upstream,
client: 192.168.1.111,
server: www.xxx.cn,
request: "POST /test.php HTTP/1.1",
upstream: "fastcgi://127.0.0.1:9000",
host: "xxx.cn",
referrer: "http://xxx.cn/test.php"

显然,缓冲区设置的太小的话,Nginx 会频繁读写硬盘,对性能有很大的影响,但也不是越大越好,没意义.

Nginx an upstream response is buffered to a temporary file的更多相关文章

  1. Nginx an upstream response is buffered to a temporary file,nginx502错误

    1.错误日志:warn:an upstream response is buffered to a temporary file 解决办法:增加fastcgi_buffers 8 4K;     fa ...

  2. nginx warn an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/ while reading upstream

    最近管理的nginx发现大量的error log,log内容如下: an upstream response is buffered to a temporary file /var/cache/ng ...

  3. nginx fastcgi_buffers to an upstream response is buffered to a temporary file

    fastcgi_buffers 16 16k; 指定本地需要用多少和多大的缓冲区来缓冲FastCGI的应答,如上所示,如果一个php脚本所产生的页面大小为256k,则会为其分配16个16k的缓冲区来缓 ...

  4. Nginx warn:an upstream response is buffered to a temporary file

    我通过nginx下载文件,error.log中出现如下警告日志:warn:an upstream response is buffered to a temporary file  . 虽然网上各种例 ...

  5. an upstream response is buffered to a temporary file

    an upstream response is buffered to a temporary file

  6. Nginx Errors: upstream response cache error

    Nginx Errors upstream response cache error *2470578 an upstream response is buffered to a temporary ...

  7. [warn] 7#7: *676 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000007

    nginx 上传文件遇到的Bug. fastcgi_buffer_size 128k; fastcgi_buffers 8 128k; fastcgi_busy_buffers_size 128k; ...

  8. nginx buffered to a temporary 解决

    今天开启了nginx的error_log,发现了三个配置问题: 问题一: 2011/07/18 17:04:37 [warn] 2422#0: *171505004 an upstream respo ...

  9. nginx的buffered to a temporary警告

    nginx日志报a client request body is buffered to a temporary file 这个意思是客户全请求的文件超过了nginx的缓存区大小,nginx将内容写入 ...

随机推荐

  1. Ubuntu下多个版本OpenCV管理(Multiple Opencv version)

    背景: 最近,在Nvidia的GPU嵌入式开发板Jetson TX1(简称TX1)上移植深度学习目标检测算法YOLO.在TX1上安装了官方提供的opencv版本——OpenCV4Tegra(OpenC ...

  2. discuz回贴通知插件实现-页面嵌入点(钩子)

    1.如何保证主题被回复时业务代码被执行. 2.获得主题,主题发布者,贴子等信息. 3.discuz发送email邮件.   discuz使用嵌入点(钩子)来处理代码的执行时机. 当用户开启插件开发者模 ...

  3. spring框架之依赖注入(DI)

    1. IOC和DI的概念 * IOC -- Inverse of Control,控制反转,将对象的创建权反转给Spring!! * DI -- Dependency Injection,依赖注入,在 ...

  4. binlog怎样参与mysql recover的

    转自  Louis Hust's Blog MySQL两阶段提交 29 July 2015 参数介绍 两阶段提交 什么情况下会出现binlog写入了,但是实际这条数据不存在库中? 参数介绍 innod ...

  5. script标签的type="test/html"时

    们可以在<script>片断中定义一个被JS调用的代码,但代码又不在页面上显示,这时,我们可以使用下面的方法: 1 <script id="commentTemplate& ...

  6. python创建独立虚拟工作环境方法

    前言: python的组件非常之多,有时这个项目依赖m个组件,有时那个项目依赖n个组件,时间一长很容易导致系统python环境的臃肿不堪,由此便有了virtualenv.virtualenvwrapp ...

  7. AJAX 请求中多出了一次 OPTIONS 请求 导致 Laravel 中间件无法对 Header 传入的 Token 无法获取

    背景知识: 我们会发现,在很多post,put,delete等请求之前,会有一次options请求.本文主要是来讨论一下这是什么原因引起的. 根本原因就是,W3C规范这样要求了!在跨域请求中,分为简单 ...

  8. 深入浅出 JMS(四) - ActiveMQ 消息存储

    深入浅出 JMS(四) - ActiveMQ 消息存储 一.消息的存储方式 ActiveMQ 支持 JMS 规范中的持久化消息与非持久化消息 持久化消息通常用于不管是否消费者在线,它们都会保证消息会被 ...

  9. 2018.10.08 NOIP模拟 斐波那契(贪心+hash/map)

    传送门 签到题. 显然是可以贪心分组的,也就是尽量跟当前的分成一组. 这时我们需要判断a[l]+a[r],a[l+1]+a[r]...a[r−1]+a[r]a[l]+a[r],a[l+1]+a[r]. ...

  10. C++之类和对象的使用(二)

    析构函数 析构函数的作用并不是删除对象,而是在撤销对象占用的内存之前完成一系列清理工作,使这部分内存可以被程序分配给新对象使用.对象生命周期结束,程序就自动执行析构函数来完成这些工作. 析构函数是一种 ...