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的更多相关文章

  1. Microchip 125 kHz RFID System Design Guide

    Passive RFID Basics - AN680 INTRODUCTION Radio Frequency Identification (RFID) systems use radio fre ...

  2. Rate Limiter

    Whenever you expose a web service / api endpoint, you need to implement a rate limiter to prevent ab ...

  3. Stanford机器学习笔记-7. Machine Learning System Design

    7 Machine Learning System Design Content 7 Machine Learning System Design 7.1 Prioritizing What to W ...

  4. 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 ...

  5. 【线性结构上的动态规划】UVa 11400 - Lighting System Design

    Problem F Lighting System Design Input: Standard Input Output: Standard Output You are given the tas ...

  6. Machine Learning - XI. Machine Learning System Design机器学习系统的设计(Week 6)

    http://blog.csdn.net/pipisorry/article/details/44119187 机器学习Machine Learning - Andrew NG courses学习笔记 ...

  7. 【系统设计】论文总结之: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 ...

  8. UVA11400-Lighting System Design(动态规划基础)

    Problem UVA11400-Lighting System Design Accept: 654  Submit: 4654Time Limit: 3000 mSec Problem Descr ...

  9. Qsys 设计流程---Qsys System Design Tutorial

    Qsys 设计流程 ---Qsys System Design Tutorial 1.Avalon-MM Pipeline Bridge Avalon-MM Pipeline Bridge在slave ...

随机推荐

  1. spring boot 缺点优点?

    作者:八面山人链接:https://www.zhihu.com/question/39483566/answer/246333825来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请 ...

  2. 倍福TwinCAT(贝福Beckhoff)基础教程2.2 TwinCAT常见类型使用和转换_枚举

    在Duts的文件夹上右击,可以声明一个枚举类型,按照格式填写所有类型(注意枚举的元素前面都是逗号,最后一个不需要符号)   在正常使用的时候,枚举的单词可以当全局变量来用     更多教学视频和资料下 ...

  3. Android学习(二) 标签滚动跳过

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools= ...

  4. UISearchBar 点击取消回到原来位置时会跳动的解决方法

    今天改动项目里面測试给提的bug.有一个bug就是当点击UISearchBar的取消buttonUISearchBar回到原来位置时会发生偏差50像素左右的跳动,细致看看前面几个程序写的那个页面,也没 ...

  5. ubuntu+let's encrypt生成永久免费https证书 ubuntu+tomcat+nginx+let's encrypt

    1. 下载let's encrypt $ sudo add-apt-repository ppa:certbot/certbot $ sudo apt-get update $ sudo apt-ge ...

  6. EFFECTIVE JAVA 第一天 静态工厂方法

    静态工厂方法:(这里指的是就是普通static方法),类可以通过静态工厂方法提供给它的客户端,而不是通过构造器.提供静态工厂方法而不是公有构造器,这样做有几大优势. 在类的实现中使用了API的类被称为 ...

  7. 手动建立storybook

    1. Add @storybook/react npm i --save-dev @storybook/react 2. Add react, react-dom, and babel-core np ...

  8. 获取、增加、修改、删除sqlserver字段描述及快速查看表字段与描述

    先看添加与删除字段描述 EXEC sys.sp_addextendedproperty @name = N'MS_Description', --添加Type字段说明 @value = N'屏蔽类型对 ...

  9. 查看/设置MySQL数据库的事务隔离级别

    查看InnoDB存储引擎 系统级的隔离级别 和 会话级的隔离级别: mysql> select @@global.tx_isolation,@@tx_isolation; +---------- ...

  10. Spring Framework简单介绍

    Spring Framework        学习java编程不知不觉已经三年时间了,開始的时候,总是喜欢看着视频,然后按部就班的敲打着键盘,每当系统正常执行后.心里乐开了花.最開始的时候,所有的代 ...