最近 nginx,一直报错 recv() failed (104: Connection reset by peer) while reading response header from upstream - V2EX
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
longmeier90

最近 nginx,一直报错 recv() failed (104: Connection reset by peer) while reading response header from upstream

  •  
  •   longmeier90 Sep 17, 2022 3177 views
    This topic created in 1339 days ago, the information mentioned may be changed or developed.

    最近一段时间 pad 项目打开页面一直转圈,发现后端返回也不慢,但是很多时候接收不到请求不知道为什么?

    后来跟踪日志才发现 nginx 一直提示 recv() faile (104: Connection reset by peer) while reading response header from upstream 错误。 也把 nginx 最大连接数调高了也不行。

    6 replies    2022-09-19 13:59:04 +08:00
    knightdf
        1
    knightdf  
       Sep 17, 2022
    看后端有没有报错和其他超时
    fggz
        2
    fggz  
       Sep 17, 2022
    +1 一直报这个,还有 502 ,不过业务好像没有影响,一直没有找到原因。
    eason1874
        3
    eason1874  
       Sep 17, 2022
    这种情况只调 nginx 没用,因为也有可能是后端重置的
    cz5424
        5
    cz5424  
       Sep 18, 2022
    @corvofeng 我折腾了两天,发现了跟你同样的问题,我是盲猜 1.1 会 keepalive ,如果到 tcp timeout 就会把链接掐了,掐了的时候就返回 502
    longmeier90
        6
    longmeier90  
    OP
       Sep 19, 2022
    =============这是我的解决方案===========
    1. [后端] nginx 连接数调高、buffer 缓存调大、keepalive 加了长连接
    2. [后端] 增加后台服务进程数
    3. [后端] 慢接口进行读写分离优化(分析错误日志,找到转圈时刻慢接口)
    4. [后端] 增加自动访问接口提醒功能(每分钟)
    5. [后端] 增加了调第三方服务超时时间
    6. [前端] 优化了超时时间 30 秒改 10 秒
    7. [前端] 优化了页面快速切换的重复请求
    About     Help     Advertise     Blog     API     FAQ     Solana     2757 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 51ms UTC 14:37 PVG 22:37 LAX 07:37 JFK 10:37
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86