当前位置: 首页 > 现代文学 > 文章

聊聊高并发系统之限流特技

2019-08-13

	聊聊高并发系统之限流特技

//nginxlimit_connGuavaRateLimiternginxlimit_reqMQCPU6182r/s500bnnnTheLeakyBucketAlgorithmasaMeterTrafficShapingTrafficPolicing34112///TPS/QPSTomcatConnectoracceptCountTomcatmaxConnectionsmaxThreadsTomcatMysqlmax_connectionsRedistcp-backlog100100//JavaAtomicLong{(()限流数){}}{();}=================================5r/s200GuavaGuavaRateLimiter(SmoothBursty)(SmoothWarmingUp)()(5)(1)()()()5002SmoothBurstymaxBurstSeconds1s/=*maxBurstSeconds/2SmoothBurstyRateLimitertryAc(doublepermitsPerSecond,longwarmupPeriod,TimeUnitunit)permitsPerSecondwarmupPeriodwarmupPeriodredis+luanginx+luaredis+lua/LuaRedisLuaTIMERedisLuaTIMEredisnginxRedis+LuaNginxhttps:///wiki/Token_buckethttps:///wiki/Leaky_buckethttp:///commands/incrhttp:///en/docs/http/ngx_http_limit_req_:///en/docs/http/ngx_http_limit_conn_:///openresty/lua-resty-limit-traffichttp:///s__biz=MzIwODA4NjMwNA==mid=2652897781idx=1sn=ae121ce4c3c37b7158bc9f067fa024c0scene=22srcid=0612HUDZ8kkp1INrr4fceNoK#rd。