nginx

关注公众号 jb51net

关闭
首页 > 网站技巧 > 服务器 > nginx > nginx proxy_buffer_size后端服务传输数据过多header过大

nginx proxy_buffer_size解决后端服务传输数据过多,header过大问题

作者:Dream_Flying_BJ

这篇文章主要介绍了nginx proxy_buffer_size解决后端服务传输数据过多,header过大问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教

nginx proxy_buffer_size解决后端服务传输数据过多,其实是header过大

这三个参数已设置就搞定了

proxy_buffer_size 64k;
proxy_buffers   4 32k;
proxy_busy_buffers_size 64k;

本着精益求精的精神我翻了官网

官网解释

总体来说我还是没懂。

我把报错信息放出来,以后用得着。

开发说nginx502了,后端访问jesery没问题

不行
curl -i -v "test.lebi.letv.cn/report/rest/saiku/api/query/7C53220D-A870-1FE3-9353-4A6F967F25CB/result/metadata/hierarchies/%5BDM_REC.DIM_LIVE_STATION%5D.%5BDM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME%5D/levels/DM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME?result=false&_=1489736122190"
可以
curl -i -v "http://10.142.165.45:8080/report/rest/saiku/api/query/7C53220D-A870-1FE3-9353-4A6F967F25CB/result/metadata/hierarchies/%5BDM_REC.DIM_LIVE_STATION%5D.%5BDM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME%5D/levels/DM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME?result=false&_=1489736122190"

日志对比

返回502
"10.73.137.12","[17/Mar/2017:16:32:08 +0800]","HTTP/1.1","-","GET","/report/rest/saiku/api/query/7C53220D-A870-1FE3-9353-4A6F967F25CB/result/metadata/hierarchies/%5BDM_REC.DIM_LIVE_STATION%5D.%5BDM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME%5D/levels/DM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME?result=false&_=1489736122190","502","http://test.lebi.letv.cn/report/rest/saiku/api/query/7C53220D-A870-1FE3-9353-4A6F967F25CB/result/metadata/hierarchies/%5BDM_REC.DIM_LIVE_STATION%5D.%5BDM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME%5D/levels/DM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME?result=false&_=1489736122190","172","0.157","10.142.165.45:8080","-","curl/7.35.0","0.157","329","328"

正常了
"10.73.137.12","[17/Mar/2017:16:32:47 +0800]","HTTP/1.1","-","GET","/report/rest/saiku/api/query/7C53220D-A870-1FE3-9353-4A6F967F25CB/result/metadata/hierarchies/%5BDM_REC.DIM_LIVE_STATION%5D.%5BDM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME%5D/levels/DM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME?result=false&_=1489736122190","200","http://test.lebi.letv.cn/report/rest/saiku/api/query/7C53220D-A870-1FE3-9353-4A6F967F25CB/result/metadata/hierarchies/%5BDM_REC.DIM_LIVE_STATION%5D.%5BDM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME%5D/levels/DM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME?result=false&_=1489736122190","1342118","4.350","10.142.165.45:8080","-","curl/7.35.0","0.180","329","1346306"

我测了下,返回的json数据大约1.3M,可能是返回值太大,超过了阈值,但是超过了哪个呢,比较纠结。

查看error日志得到upstream sent too big header while reading response header from upstream,说header太大了。

好好学习下header

2017/03/17 16:32:08 [error] 17441#0: *403548696 upstream sent too big header while reading response header from upstream, client: 10.73.137.12, server: test.lebi.letv.cn, request: "GET /report/rest/saiku/api/query/7C53220D-A870-1FE3-9353-4A6F967F25CB/result/metadata/hierarchies/%5BDM_REC.DIM_LIVE_STATION%5D.%5BDM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME%5D/levels/DM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME?result=false&_=1489736122190 HTTP/1.1", upstream: "http://10.142.165.45:8080/report/rest/saiku/api/query/7C53220D-A870-1FE3-9353-4A6F967F25CB/result/metadata/hierarchies/%5BDM_REC.DIM_LIVE_STATION%5D.%5BDM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME%5D/levels/DM_REC.DIM_LIVE_STATION.LIVE_STATION_NAME?result=false&_=1489736122190", host: "test.lebi.letv.cn"

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文