rate limiter - system design
1 问题
Whenever you expose a web service / api endpoint, you need to implement a rate limiter to prevent abuse of the service (DOS attacks).
Implement a RateLimiter Class with an isAllow method. Every request comes in with a unique clientID, deny a request if that client has made more than 100 requests in the past second.
这是一个流控问题。
2 输入
Request:
client ID和时间戳timestamp
3 输出
true or false
4 思路
保存每个client ID过去1s的所有请求。
数据结构?
5 关于guava的RateLimiter
5.1 RateLimiter在下列应用场景中的应用
https://www.cnblogs.com/yeyinfu/p/7316972.html
5.2 RateLimiter用在接口中不会超时吗?
比如限制访问数据库,每秒不超过10,使用RateLimiter的本质是每个请求等待0.1秒。这不会导致请求超时吗?
5.3 抢购场景降级 tryAcquire()
6 限流算法:令牌桶算法和漏桶算法
rate limiter - system design的更多相关文章
- Microchip 125 kHz RFID System Design Guide
Passive RFID Basics - AN680 INTRODUCTION Radio Frequency Identification (RFID) systems use radio fre ...
- Rate Limiter
Whenever you expose a web service / api endpoint, you need to implement a rate limiter to prevent ab ...
- Stanford机器学习笔记-7. Machine Learning System Design
7 Machine Learning System Design Content 7 Machine Learning System Design 7.1 Prioritizing What to W ...
- Machine Learning - 第6周(Advice for Applying Machine Learning、Machine Learning System Design)
In Week 6, you will be learning about systematically improving your learning algorithm. The videos f ...
- 【线性结构上的动态规划】UVa 11400 - Lighting System Design
Problem F Lighting System Design Input: Standard Input Output: Standard Output You are given the tas ...
- Machine Learning - XI. Machine Learning System Design机器学习系统的设计(Week 6)
http://blog.csdn.net/pipisorry/article/details/44119187 机器学习Machine Learning - Andrew NG courses学习笔记 ...
- 【系统设计】论文总结之:Butler W. Lampson. Hints for computer system design
Butler W. Lampson. Hints for computer system design. ACM Operating Systems Rev. 15, 5 (Oct. 1983), p ...
- UVA11400-Lighting System Design(动态规划基础)
Problem UVA11400-Lighting System Design Accept: 654 Submit: 4654Time Limit: 3000 mSec Problem Descr ...
- Qsys 设计流程---Qsys System Design Tutorial
Qsys 设计流程 ---Qsys System Design Tutorial 1.Avalon-MM Pipeline Bridge Avalon-MM Pipeline Bridge在slave ...
随机推荐
- ElasticSearch 安装中文分词器
1.安装中文分词器IK 下载地址:https://github.com/medcl/elasticsearch-analysis-ik 在线下载安装: elasticsearch-plugin.bat ...
- ElasticSearch5.5.2常用命令
1.启动 转到elasticsearch-5.5.2\bin目录: 打开命令行输入:elasticsearch 2.ELasticsearch集群已经启动并且正常运行 curl http://127. ...
- Elasticsearch 之 query与filter区别
转载: http://xiaorui.cc/category/elasticsearch/ http://blog.csdn.net/asia_kobe/article/details/5056301 ...
- Java的位运算
左移位操作 左移位运算的符号为[<<],左移位运算符左面的操作元称作被移位数,右面的操作数称作移位量. 左移位运算是双目运算符,操作元必须是整型类型的数据,其移动过程是:[a <&l ...
- SQL 关键字 'USER' 附近有语法错误怎么办
如下图所示,我想要访问我的Database1.mdf的user这张表,提示如下错误 user在SQL Server中是系统保留字,将user修改为[user]就可以了.但是直接在VS中是无法修改的 ...
- 安全狗两个中危提权+NET提权
1.循环加组复现 for /l %%i in (1,1,1000) do @net user admin admin /add&@ net localgroup administrators ...
- 标准库priority_queue的一种实现
优先级队列相对于普通队列,提供了插队功能,每次最先出队的不是最先入队的元素,而是优先级最高的元素. 它的实现采用了标准库提供的heap算法.该系列算法一共提供了四个函数.使用方式如下: 首先,建立一个 ...
- h5+ 管理设备信息
Device模块管理设备信息,用于获取手机设备的相关信息,如IMEI.IMSI.型号.厂商等.通过plus.device获取设备信息管理对象. 1.属性 1.1.imei: 设备的国际移动设备身份码, ...
- 端口监听与telnet
例一: 明明端口已经监听了,为什么远程的telnet连接不上. 远程机器 telnet 10.10.1.85 53 就是进不去. Linux 防火墙一关,ok service iptables sto ...
- 【BIEE】08_修改浏览器标题栏显示内容
打开分析,我们可以看到标题栏中显示的BIEE默认的,现在想要把这个修改为自定义的 打开文件路径: D:\obiee\Oracle_BI1\bifoundation\web\msgdb\l_zh-CN\ ...