nginx proxy_buffer_size 解决后端服务传输数据过多,其实是header过大的问题
这三个参数已设置就搞定了额
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
- 1
- 2
- 3
本着精益求精的精神我翻了官网
官网解释
总体来说我还是没懂。我把报错信息放出来,以后用得着。
开发说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"
- 1
- 2
- 3
- 4
- 5
- 6
日志对比
返回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"
- 1
- 2
- 3
- 4
- 5
- 6
我测了下,返回的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"
- 1