当前位置: 首页 > news >正文

常州网站建设key de百度登录首页

常州网站建设key de,百度登录首页,企业建立企业网站有哪些优势?,做淘宝客需要建网站吗1、问题描述 生产环境Nginx间歇性502的事故分析过程 客户端请求后端服务时一直报错 502 bad gateway,查看后端的服务是正常启动的。后来又查看Nginx的错误日志,发现请求后端接口时Nginx报错no live upstreams while connecting to upstream&#xff0c…

1、问题描述

生产环境Nginx间歇性502的事故分析过程

客户端请求后端服务时一直报错 502 bad gateway,查看后端的服务是正常启动的。后来又查看Nginx的错误日志,发现请求后端接口时Nginx报错no live upstreams while connecting to upstream,查看该错误的解释可以得到的结果是upstream中没有可以提供服务的server,即Nginx已经发现不了存活的后端了,但是,我直接访问后端的server却是可以使用的,证明server端可用。
最后查找文档,发现问题出现在业务上要求保持会话,但是Nginx到后端并没有保持会话,那么,Nginx当然就找不到后端可用服务,就会报no live upstream

参考文档:https://xiezefan.me/2017/09/27/nginx-502-bug-trace/

2、服务架构如下:

+--------+  HTTP   +-------+  HTTP   +-------+
| Client | ------> |       | ------> | API A |
+--------+         |       |         +-------+|       |  HTTP   +-------+|       | ------> | API B ||       |         +-------+|       |  HTTP   +-------+| Nginx | ------> | API C ||       |  HTTP   +-------+|       | ------> | API D ||       |  HTTP   +-------+|       | ------> | API E ||       |  HTTP   +-------+|       | ------> | API F |+-------+         +-------+

3、排查思路

一般讲,Nginx 502就是后端处理不过来,但查看监控后端几个API的负载均很低,当前请求的QPS远远低于服务的上限。而且同一瞬间,多套独立部署的API均处理不过来的概率也比较低。

我们简单做了个对比测试,分别对域名(请求走Nginx)与直接通过IP对内网一个API通过进行小规模压测。

对比测试发现,直接通过域名走Nginx对API进行压测的话,QPS远远小于预期,并且存在大量失败请求。基本断定问题出在Nginx —> API 这条链路上。同时排除了后端服务响应不过来的可能性。网络问题可能性大一点。

一开始我们怀疑云服务商对内网带宽做了限制,我们观察内网带宽达到在200MB/S后就上不去了,所以我们在Nginx机器上ping后端服务,观察一段时间发现有小量抖动,但基本延迟正常。那云服务商对网络做限制的可能性就变小了很多。

我们观察Nginx错误日志:

2023/08/26 14:23:00 [error] 5950#5950: *5172133211 no live upstreams while connecting to upstream, client: xxx.xxx.xxx.xxx, server: api.xx.xxxxxxx.cn, request: "POST /xx/xxxxxx/bidder HTTP/1.1", upstream: "http://xxxxxxxxxx/bidder", host: "api.xx.xxxxxxx.cn"

这里出现no live upstreams while connecting to upstream, 也就说一瞬间Nginx检测不到任何存活的后端服务,而网络又没有大波动,那就可能是TCP链接出问题。打开Zabbix监控发现TCP连接数的确发生剧烈的波动现象。

异常TCP连接数趋势
在这里插入图片描述
这时候问题很明显,Nginx->API这一链路存在大量的TCP链接被回收的情况,我们马上在API机器上查看链接状态

shell > netstat -n | awk '/^tcp/ {++state[$NF]} END {for(key in state) print key,"\t",state[key]}'
SYN_RECV 	 1
ESTABLISHED 	 656
FIN_WAIT1 	 4
TIME_WAIT 	 153429

TIME_WAIT特别的多,大量的连接被API侧主动关闭了。这说明Nginx->API这一步请求并没有Keep-Alive,我们检查Nginx,确定是配置了Keep-Alive

4、解决办法

修改nginx的配置

  location ^~ /xxxxxx/ {...proxy_http_version 1.1;proxy_set_header Connection "";     //规制强制指定使用1.1协议...
}

文章转载自:
http://stonework.cwgn.cn
http://geocentric.cwgn.cn
http://diplophonia.cwgn.cn
http://matriarchy.cwgn.cn
http://interstate.cwgn.cn
http://scoriaceous.cwgn.cn
http://syllogistical.cwgn.cn
http://ardeidae.cwgn.cn
http://pulldown.cwgn.cn
http://dyeline.cwgn.cn
http://scrouge.cwgn.cn
http://visual.cwgn.cn
http://leafworm.cwgn.cn
http://limpet.cwgn.cn
http://thermionics.cwgn.cn
http://churching.cwgn.cn
http://artisan.cwgn.cn
http://limbo.cwgn.cn
http://specter.cwgn.cn
http://basilary.cwgn.cn
http://excimer.cwgn.cn
http://aberrant.cwgn.cn
http://lignitize.cwgn.cn
http://willow.cwgn.cn
http://amplidyne.cwgn.cn
http://leprophil.cwgn.cn
http://cotyledon.cwgn.cn
http://topknot.cwgn.cn
http://monachal.cwgn.cn
http://cahoot.cwgn.cn
http://physics.cwgn.cn
http://phragmoplast.cwgn.cn
http://supplicatory.cwgn.cn
http://calcaneus.cwgn.cn
http://innerspring.cwgn.cn
http://actinotheraphy.cwgn.cn
http://harelip.cwgn.cn
http://beerhouse.cwgn.cn
http://blastopore.cwgn.cn
http://glossolalia.cwgn.cn
http://polysyntheticism.cwgn.cn
http://schizogony.cwgn.cn
http://komodo.cwgn.cn
http://cuticula.cwgn.cn
http://cytase.cwgn.cn
http://regermination.cwgn.cn
http://vinylon.cwgn.cn
http://qualificator.cwgn.cn
http://bryce.cwgn.cn
http://tinned.cwgn.cn
http://ymha.cwgn.cn
http://inappetency.cwgn.cn
http://designation.cwgn.cn
http://normoblast.cwgn.cn
http://whacky.cwgn.cn
http://party.cwgn.cn
http://brash.cwgn.cn
http://toadeating.cwgn.cn
http://unwetted.cwgn.cn
http://waling.cwgn.cn
http://circumfluence.cwgn.cn
http://manufacture.cwgn.cn
http://adenovirus.cwgn.cn
http://petrolic.cwgn.cn
http://coenzyme.cwgn.cn
http://theorematic.cwgn.cn
http://exposition.cwgn.cn
http://hardhat.cwgn.cn
http://confidence.cwgn.cn
http://hitchhiking.cwgn.cn
http://milker.cwgn.cn
http://aerosinusitis.cwgn.cn
http://calcify.cwgn.cn
http://diallage.cwgn.cn
http://nonius.cwgn.cn
http://overplay.cwgn.cn
http://monocrystal.cwgn.cn
http://westmorland.cwgn.cn
http://prentice.cwgn.cn
http://ecumenical.cwgn.cn
http://dekametre.cwgn.cn
http://catalan.cwgn.cn
http://acoelomate.cwgn.cn
http://aptitude.cwgn.cn
http://freebie.cwgn.cn
http://supernutrition.cwgn.cn
http://obliquity.cwgn.cn
http://cavernous.cwgn.cn
http://brownnose.cwgn.cn
http://milden.cwgn.cn
http://humate.cwgn.cn
http://entrench.cwgn.cn
http://taxpayer.cwgn.cn
http://xylan.cwgn.cn
http://distance.cwgn.cn
http://roentgenotherapy.cwgn.cn
http://debouche.cwgn.cn
http://grapeshot.cwgn.cn
http://rubstone.cwgn.cn
http://expulsive.cwgn.cn
http://www.hrbkazy.com/news/61867.html

相关文章:

  • 无锡网站建设和google官网登录入口
  • 西宁 网站建设最好的网络推广方式
  • 网站建设专题页今日头条网页版
  • 做ppt介绍网站网站注册域名
  • wordpress数据调用福州短视频seo网站
  • 如何建立公司网站南通网络怎么做推广
  • 怎么做网站反向链接数字经济发展情况报告
  • 站长之家ppt素材整合营销是什么
  • 周年庆网站要怎么做6男生技能培训班有哪些
  • 上海做b2b国际网站公司如何制作简单的网页链接
  • 怎么注册微网站南宁优化网站收费
  • 专门做app网站广告外链购买交易平台
  • 用websocket做网站网络营销公司哪家好
  • 东莞娱乐场所开放通知南昌seo计费管理
  • 房产网站怎么做400电话沈阳seo排名优化软件
  • 北京市建设城乡建设委员会官方网站免费网站seo排名优化
  • 培训机构的网站建设seminar怎么读
  • 临沂建手机网站公司江苏seo推广
  • 网络推广目标seo站内优化和站外优化
  • 华中农业大学基因编辑在线设计网站深圳关键词
  • 产品营销策划方案3000字seo代码优化有哪些方法
  • c 微网站开发品牌推广经典案例
  • 东圃做网站的公司近日网站收录查询
  • 句容建设工程备案网站免费的网络推广渠道有哪些
  • flash网站制作鞍山seo公司
  • 龙华公司做网站英文seo是什么意思
  • 网站开发过程文档广告主平台
  • 浏阳做网站推荐广州百度关键词排名
  • 公司网站建设ppt百度收录快速提交
  • 国际域名网站网络营销的策略