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 ...
随机推荐
- [转载]Linux 卸载JDK并安装新版本JDK (rpm,tar)
FROM:http://josh-persistence.iteye.com/blog/1908549 一.查看Jdk的安装路径: whereis javawhich java (java执行路径)e ...
- .Net普通三层->工厂模式->线程内唯一+单元工作模式->WebService分布式三层
在软件世界分层的思想无处不在 主要是为了提高软件系统的维护性,扩展性,复用性和解耦等 软件的三层构架是一种最基本的分层思想的体现 结构图大体如下: 如此一来,开发人员可以只关注其中一层,而无需关心下一 ...
- 5.全局异常捕捉【从零开始学Spring Boot】
在一个项目中的异常我们我们都会统一进行处理的,那么如何进行统一进行处理呢? 新建一个类GlobalDefaultExceptionHandler, 在class注解上@ControllerAdvice ...
- jQuery的AJax异步载入片段
主要用到load()方法以及getScript()方法,详细以一个样例说明: 在现有html文件里载入一个拟好的片段,以及在片段载入完毕之前阻止用户进一步操作的弹出框. 首先是现有html代码.无不论 ...
- Android学习(二十二)ContentMenu上下文菜单
一.上下问菜单 在某个菜单项上长按,会弹出一个菜单,这个就是上下文菜单.有点类似与Windows系统中的右键菜单. 二.上下文菜单的内容 1.标题 2.图标 3.菜单项 4.对应的菜单事件 三.Opt ...
- Android学习(六) 文本框边框
BorderTextViews.java package xiaosi.BorderTextView; import android.content.Context; import android.g ...
- vue-router 运行机制 及 底层原理
1.测试页面 index.html <!DOCTYPE html> <html lang="en"> <head> <meta chars ...
- Activity的启动流程分析
Activity是Android应用程序的四大组件之中的一个,负责管理Android应用程序的用户界面,一般一个应用程序中包括非常多个Activity,他们可能执行在一个进程中.也可能执行在不同的进程 ...
- POJ2536 Gopher II【二分图最大匹配】
题目链接: http://poj.org/problem? id=2536 题目大意: 有N仅仅鼹鼠和M个洞穴,假设鼹鼠在S秒内不可以跑到洞穴,就会被老鹰捉住吃掉. 鼹鼠跑的速度为V米/秒. 已知一个 ...
- MATLAB squeeze 函数
squeeze 除去size为1的维度 B = squeeze(A) 描述: B = squeeze(A),B与A有相同的元素,但所有只有一行或一列的维度(a singleton dimension ...