8

Web 服务突然被挤暴,如何有效分流

 2 years ago
source link: https://www.v2ex.com/t/810416
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  程序员

Web 服务突然被挤暴,如何有效分流

  kaka6 · 21 小时 47 分钟前 · 717 次点击

如题,一款微信小程序,平常日均活跃量 100 人左右,日均 pv 5K 以内 但没想到搞了个活动,访问人数直接上了 4 万+,把服务器挤爆,结果大家都无法访问,系统挂了

avatar

一台 Web 服务器(4C8G ,弹性 200M 带宽) + 一个 RDS Redis + 一个单机 RDS MySql 数据库(4C8G)

看服务日志,主要是数据库的 CPU 遇到瓶颈,直接上了 100%

临时数据库加到 8C 也不够,程序估计也是有问题,缺少合理的缓存,造成数据库访问频繁

加硬件,是简单粗暴的方式 优化程序,还需要从头计议

我想到做入口分流,大家有没有相关经验分享

就是我根据环境配置,同一时间只想服务好比如 5000 人,超过 5000 人,在外面等候

这样至少能保证一部分用户可用,不致于造成系统挂掉

本地性的小应用,日常访问量少,感觉还没到做微服务、中台、集群等层面上

所以想通过什么策略搞搞分流,至少在流量大时能保持一部分用户可用,会不会好做些

大家给给建议,谢谢!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK