Google: RateLimit
来源:互联网 发布:单片机蜂鸣器实验报告 编辑:程序博客网 时间:2024/05/29 23:45
转自: http://www.careercup.com/question?id=5147519440912384
This is two questions I got from a google interview. Not very sure how to solve it. Any comments would be appreciated.
1.
interface RateLimit {
/** Sets the rate, from 1 to 1000000 queries per second */
void setQPS(int qps);
/** accept or reject a request, called when request is received */
boolean allowThisRequest();
}
brief example:
server instantiates your object, calls setQPS(1)
at at time t, user1 makes a request, allowThisRequest() returns true
at time t+0.01 sec, user2 makes a request, allowThisRequest() returns false
at at time t+1, user4 makes a request, allowThisRequest() returns true
at time t+5 sec, user3 makes a request, allowThisRequest() returns true
- Google: RateLimit
- RateLimit
- 修改openstack的nova-api的ratelimit
- RateLimit--使用guava来做接口限流
- RateLimit--使用guava来做接口限流
- RateLimit--使用guava来做接口限流
- RateLimit--使用guava来做接口限流
- Guava来做接口限流RateLimit
- golang 令牌桶限速器实现(ratelimit)
- 服务接口的流量控制策略之RateLimit
- 使用MongoDB的ORM版Mongose来写你的数据操作吧!
- 2000年清华大学计算机研究生机试真题
- 教你如何使用搜索引擎批量检测网站注入点
- head 详解
- [LeetCode] Binary Tree Postorder Traversal
- Google: RateLimit
- C++中二维数组作为函数参数
- hadoop-2.6.0单机配置和伪分布式配置
- 我的Android入门之路:一、初步接触之GreenDAO学习使用体验
- linux磁盘分区fdisk命令详解
- 关于C++中的vector的认识
- iOS7IPAD开发屏幕旋转显示不同宽度
- [BZOJ 1901][ZOJ 2112]Dynamic Rankings(树状数组套主席树、动态区间第k大值查询)
- Nginx 负载均衡