We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 72338d2 commit d0da51bCopy full SHA for d0da51b
rate-limiter/src/main/java/io/github/gunkim/ratelimiter/window/FixedWindowRateLimiter.java
@@ -6,6 +6,18 @@
6
import java.util.concurrent.ConcurrentHashMap;
7
import java.util.concurrent.atomic.AtomicInteger;
8
9
+/**
10
+ * ## 처리 제한 알고리즘, 고정 윈도우 카운터
11
+ * - 고정된 간격의 윈도 내의 요청은 지정된 임계치 만큼 처리한다.
12
+ * - 임계치를 넘어선 요청은 새 윈도가 열릴 때까지 버려진다.
13
+ * <p>
14
+ * 윈도 경계 부근에 순간적으로 많은 트래픽이 집중된다면 할당된 임계치보다 많은 요청이 처리될 수 있는 문제가 있다.
15
+ * 예를 들어,
16
+ * - 윈도 크기가 1분이고 임계치가 100이라고 가정할 때,
17
+ * - 12:00:30에 100개의 요청이 처리되고,
18
+ * - 12:01:00에 윈도가 새로 열리면서 다시 100개의 요청이 처리될 수 있다.
19
+ * - 이러한 경우 12:00:30에서 12:01:00 사이에 200개의 요청이 처리된 것이다.
20
+ */
21
public class FixedWindowRateLimiter implements RateLimiter {
22
private final int maxRequestsPerWindow;
23
private final int windowDurationMillis;
0 commit comments