d********w 发帖数: 363 | 1 Implement rate limiting for an API so that we rate limit if the same
developer makes > 10K req/sec. What would the logic be? What would the
structure be? Where would you store this structure?
一家SF公司的面试题 | d********w 发帖数: 363 | 2
我想这个设计
map>
if (map.containsKay(developId))
last_time, last_count = map.get(developId)
if last_time != cur_time
map.put(developId, new pair)
else {
last_count++;
if (last_count > 10K)
return false;
map.put(developId, new pair)
}
后来又问如果是多台机器(后端做load balancing)如何限制总流量,大家觉得如何考
虑?
【在 d********w 的大作中提到】 : Implement rate limiting for an API so that we rate limit if the same : developer makes > 10K req/sec. What would the logic be? What would the : structure be? Where would you store this structure? : 一家SF公司的面试题
| k***t 发帖数: 276 | 3 关于多机分布的,看到过一篇Paper的题目,好像有关。
"Cloud Control with Distributed Rate Limiting"。
不过我没读过这篇Paper:)谁有兴趣读一下,给版上的总结一下。
http://www.cs.ucla.edu/classes/cs217/SIG07Award.pdf
考虑?
【在 d********w 的大作中提到】 : : 我想这个设计 : map> : if (map.containsKay(developId)) : last_time, last_count = map.get(developId) : if last_time != cur_time : map.put(developId, new pair) : else { : last_count++; : if (last_count > 10K)
|
|