32

面试官:来谈谈限流-RateLimiter源码分析-Java架构笔记

 5 years ago
source link: https://blog.51cto.com/14440216/2429205
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.
neoserver,ios ssh client
RateLimiter有两个实现类:SmoothBursty和SmoothWarmingUp,其都是令牌桶算法的变种实现,区别在于SmoothBursty加令牌的速度是恒定的,而SmoothWarmingUp会有个预热期,在预热期内加令牌的速度是慢慢增加的,直到达到固定速度为止。其适用场景是,对于有的系统而言刚启动时能承受的QPS较小,需要预热一段时间后才能达到最佳状态。基本使用RateLimit

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK