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. Tomcat7.0源代码分析——启动与停止服务原理

    前言 熟悉Tomcat的project师们.肯定都知道Tomcat是怎样启动与停止的. 对于startup.sh.startup.bat.shutdown.sh.shutdown.bat等脚本或者批处 ...

  2. [iOS 高级] iOS远程推送与本地推送大致流程

    本地推送: UILocalNotification *notification=[[UILocalNotification alloc] init]; if (notification!=nil) { ...

  3. wp8使用mvvm模式简单例子(二)---登陆功能,事件触发

    首先,还是需要一个Model类来为UI层的元素提供数据源 public class LoginModel:DependencyObject { public string Uid { get { re ...

  4. Apache环境下搭建KodExplorer网盘

    Apache环境下搭建KodExplorer网盘 环境说明: 系统版本    CentOS 6.9 x86_64 软件版本    yum安装httpd和php    kodexplorer4.25 1 ...

  5. SQL Server 2008 导入MDF数据库文件

    1.将.MDF和.LDF文件拷到SQL Server2008数据目录,如:\\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\ ...

  6. Android学习(十六) 通过GestureDetector进行手势识别

    一.手势交互过程: 1)触屏时,触发MotionEvent事件. 2)被OnTouchListener监听,在onTouch()中获得MotionEvent对象. 3)GestureDetector转 ...

  7. react-native 调用第三方 SDK

    步骤一:android 文件修改 (1)In android/settings.gradle ... include ':VoiceModule', ':app' project(':VoiceMod ...

  8. vuejs 表单验证插件 VeeValidate

    VeeValidate https://baianat.github.io/vee-validate/

  9. POJ 2375 Cow Ski Area (强连通分量)

    题目地址:POJ 2375 对每一个点向与之相邻并h小于该点的点加有向边. 然后强连通缩点.问题就转化成了最少加几条边使得图为强连通图,取入度为0和出度为0的点数的较大者就可以.注意,当强连通分量仅仅 ...

  10. Java中的split函数的用法

    Java中的 split  函数是用于按指定字符(串)或正则去分割某个字符串,结果以字符串数组形式返回: 例如: String str="1234@abc"; String[] a ...