Rate Limiter
Diagram: Rate Limiter · 78 elements
{
"type": "excalidraw",
"version": 2,
"source": "https://marketplace.visualstudio.com/items?itemName=pomdtr.excalidraw-editor",
"elements": [
{
"id": "r7xW-bVel7SLI7zxZX5eS",
"type": "text",
"x": 1335.8451454803164,
"y": -825.2905916389246,
"width": 559.319580078125,
"height": 250,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a0",
"roundness": null,
"seed": 1081807926,
"version": 501,
"versionNonce": 1287140086,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Functional Requirements\n\n- Rate limiter throttle API requests based on IP, \nuser ID or other properties\n- Distributed rate limiting. The rate limiter can be shared\nacross multiple servers or process\n- Exception handling. show clear exceptions to users\nwhen their requests are throttled\n- High Fault Tolerance: any problems with the rate limiter\nlike cache offline, it does not affect the entire system",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Functional Requirements\n\n- Rate limiter throttle API requests based on IP, \nuser ID or other properties\n- Distributed rate limiting. The rate limiter can be shared\nacross multiple servers or process\n- Exception handling. show clear exceptions to users\nwhen their requests are throttled\n- High Fault Tolerance: any problems with the rate limiter\nlike cache offline, it does not affect the entire system",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "23cYLW4BHdjVjXqx4YtFW",
"type": "text",
"x": 2106.4659880523786,
"y": -834.2844940779488,
"width": 542.07958984375,
"height": 175,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a1",
"roundness": null,
"seed": 1941380470,
"version": 317,
"versionNonce": 542187370,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Non Functional Requirements\n\n- Minimum latency overhead (<10ms per request check)\n- availability >> consistency\n- The system should handle 1M requests/second across\n100M DAU\n",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Non Functional Requirements\n\n- Minimum latency overhead (<10ms per request check)\n- availability >> consistency\n- The system should handle 1M requests/second across\n100M DAU\n",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "yy58CRpnkMuYpp5KKUZOY",
"type": "text",
"x": 1358.489269648831,
"y": -445.8560018384811,
"width": 641.1995849609375,
"height": 775,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a2",
"roundness": null,
"seed": 220200630,
"version": 1211,
"versionNonce": 543319094,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Rules: Authenticated users get 1k requests/hr \n\nClients: Rate limited by user ID, IP addresses, API keys\n or combinations of them.\n\nRequests: Incoming API requests evaluated against rate\nlimiting rules. Each requsts carries context like client identiy\nendpoint being accessed and timestamp that determines\nwhich rules to apply and how to track usage.\n\nisRequestAllowed(clientID,ruleID):\n return {\n passess: bool,\n remaining: number,\n resetTime: timestamp\n }\n\n\nX-RateLimit-Limit: how many call clients can make per time window.\nX-RateLimit-Remaining: no. of req left in the current window.\nX-RateLimit-Reset: rate limit resets as a Unix Timestamp.\nX-RateLimit-Retry-After: no. of seconds to wait until \nyou can make a request again without being throttled.\n\nIdentify Client?\n- User ID: JWT token present in Authorization header\n- IP Address: Present in X-Forwarded-For header\nAPI Key: X-API-Key header. Each key holder gets their own\nlimits\n\n",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Rules: Authenticated users get 1k requests/hr \n\nClients: Rate limited by user ID, IP addresses, API keys\n or combinations of them.\n\nRequests: Incoming API requests evaluated against rate\nlimiting rules. Each requsts carries context like client identiy\nendpoint being accessed and timestamp that determines\nwhich rules to apply and how to track usage.\n\nisRequestAllowed(clientID,ruleID):\n return {\n passess: bool,\n remaining: number,\n resetTime: timestamp\n }\n\n\nX-RateLimit-Limit: how many call clients can make per time window.\nX-RateLimit-Remaining: no. of req left in the current window.\nX-RateLimit-Reset: rate limit resets as a Unix Timestamp.\nX-RateLimit-Retry-After: no. of seconds to wait until \nyou can make a request again without being throttled.\n\nIdentify Client?\n- User ID: JWT token present in Authorization header\n- IP Address: Present in X-Forwarded-For header\nAPI Key: X-API-Key header. Each key holder gets their own\nlimits\n\n",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "HqazpUSdb5s3EqG59oJOl",
"type": "text",
"x": -1113.3014058052604,
"y": 103.14545429380394,
"width": 1296.7392578125,
"height": 1275,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a3",
"roundness": null,
"seed": 1633335286,
"version": 938,
"versionNonce": 1485677098,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Fixed Window Counter: \n- Simplest approach divides time into fixed windows and counts requests in each window.\n- Concept: Track request count in rolling time window (e.g., last 60 seconds). Reject if exceeds limit.\n- Types: Fixed window (simpler, edge case spike), Sliding window (exact, needs log of requests)\n- PROS: Easy to understand, accurate tracking, no burst complexity, works well for simple limits\n- CONS: Requires storing request timestamps, edge case at window boundaries (fixed), higher memory usage\n- WHEN TO USE: Simple rate limiting, API quotas (requests per minute/hour), when accuracy matters more than simplicity.\n- EXAMPLE: 100 req/min → Track all requests in last 60 sec. If count >= 100, reject new ones. Old requests fall out of window.\n- EDGE CASE (FIXED WINDOW): Request limit changes at boundary → spike of 200 req/sec if 100 at :59 and 100 at :00.\n\nSliding Window Log: \n- Log of individual request timestamps for each users. When a new requests arrives, remove all timestamps older that your window.\n- Concept: Keep ordered log of all request timestamps. Check if Nth request (from end) is within window.\n- Memory: Stores all request times → High memory usage. Good for small limits or counting specific requests.\n- PROS: Most accurate, handles all edge cases, supports weighted requests\n- CONS: High memory overhead, slower lookups, difficult to scale to distributed systems\n- WHEN TO USE: Accurate quota tracking, fraud detection, when precision is critical and request volume is moderate.\n- EXAMPLE: Limit 10 requests per minute. Store timestamps [12:00:05, 12:00:15, 12:00:45, ...]. Check if request at 12:01:05 exceeds.\n\n\nSliding Window Counter: \n- Combines sliding window log and fixed window counter. More accurate than fixed window, less memory than sliding log.\n- Token Bucket: Tokens added at fixed rate (refill). \n- Each request consumes 1 token. If no tokens, request rejected. \n- Allows burst traffic up to bucket capacity, then limited by refill rate. \n- Used by AWS, Google. Most versatile for APIs.\n\n\nLeaky Bucket:\n- Concept: Requests flow into bucket. Bucket leaks (processes) at fixed rate. If bucket full, new requests dropped.\n- Stability: Output rate = leak rate. Very stable, predictable latency. No burst allowed.\n- PROS: Smooth traffic output, perfect for bandwidth-constrained systems, predictable rate\n- CONS: No burst handling, can feel unfair (requests queued but dropped if bucket full), higher latency\n- WHEN TO USE: Stream processing, fixed bandwidth allocation, when you need smooth constant rate (not bursty).\n- EXAMPLE: 10 req/sec leak rate → All requests processed at exactly 10/sec, queued if arrives faster. Dropped if queue full.\n\nREAL-WORLD IMPLEMENTATIONS\n- Google APIs: Token Bucket (with burst allowance). 100 req/sec sustained, 1000 burst capacity.\n- AWS API Gateway: Token Bucket algorithm with Reserved Concurrency model.\n- Twitter API: Leaky Bucket style (window-based counting).\n- Stripe API: Sliding Window with edge case mitigation. Detailed 429 responses.\n- Redis-based: Implement any algorithm with Lua scripts for atomic operations in distributed systems.\n- Nginx: Token Bucket (limit_req). Leaky bucket queue model (queue bursts).\n- Cloud CDNs: Token Bucket with geographic distribution (per-region limits).\n\nDistributed Environment:\n- Race Condition: locks may slow down the system.\n Lua scripts\n\n- Synchronization issues: make it stateless with the help of common redis\n",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Fixed Window Counter: \n- Simplest approach divides time into fixed windows and counts requests in each window.\n- Concept: Track request count in rolling time window (e.g., last 60 seconds). Reject if exceeds limit.\n- Types: Fixed window (simpler, edge case spike), Sliding window (exact, needs log of requests)\n- PROS: Easy to understand, accurate tracking, no burst complexity, works well for simple limits\n- CONS: Requires storing request timestamps, edge case at window boundaries (fixed), higher memory usage\n- WHEN TO USE: Simple rate limiting, API quotas (requests per minute/hour), when accuracy matters more than simplicity.\n- EXAMPLE: 100 req/min → Track all requests in last 60 sec. If count >= 100, reject new ones. Old requests fall out of window.\n- EDGE CASE (FIXED WINDOW): Request limit changes at boundary → spike of 200 req/sec if 100 at :59 and 100 at :00.\n\nSliding Window Log: \n- Log of individual request timestamps for each users. When a new requests arrives, remove all timestamps older that your window.\n- Concept: Keep ordered log of all request timestamps. Check if Nth request (from end) is within window.\n- Memory: Stores all request times → High memory usage. Good for small limits or counting specific requests.\n- PROS: Most accurate, handles all edge cases, supports weighted requests\n- CONS: High memory overhead, slower lookups, difficult to scale to distributed systems\n- WHEN TO USE: Accurate quota tracking, fraud detection, when precision is critical and request volume is moderate.\n- EXAMPLE: Limit 10 requests per minute. Store timestamps [12:00:05, 12:00:15, 12:00:45, ...]. Check if request at 12:01:05 exceeds.\n\n\nSliding Window Counter: \n- Combines sliding window log and fixed window counter. More accurate than fixed window, less memory than sliding log.\n- Token Bucket: Tokens added at fixed rate (refill). \n- Each request consumes 1 token. If no tokens, request rejected. \n- Allows burst traffic up to bucket capacity, then limited by refill rate. \n- Used by AWS, Google. Most versatile for APIs.\n\n\nLeaky Bucket:\n- Concept: Requests flow into bucket. Bucket leaks (processes) at fixed rate. If bucket full, new requests dropped.\n- Stability: Output rate = leak rate. Very stable, predictable latency. No burst allowed.\n- PROS: Smooth traffic output, perfect for bandwidth-constrained systems, predictable rate\n- CONS: No burst handling, can feel unfair (requests queued but dropped if bucket full), higher latency\n- WHEN TO USE: Stream processing, fixed bandwidth allocation, when you need smooth constant rate (not bursty).\n- EXAMPLE: 10 req/sec leak rate → All requests processed at exactly 10/sec, queued if arrives faster. Dropped if queue full.\n\nREAL-WORLD IMPLEMENTATIONS\n- Google APIs: Token Bucket (with burst allowance). 100 req/sec sustained, 1000 burst capacity.\n- AWS API Gateway: Token Bucket algorithm with Reserved Concurrency model.\n- Twitter API: Leaky Bucket style (window-based counting).\n- Stripe API: Sliding Window with edge case mitigation. Detailed 429 responses.\n- Redis-based: Implement any algorithm with Lua scripts for atomic operations in distributed systems.\n- Nginx: Token Bucket (limit_req). Leaky bucket queue model (queue bursts).\n- Cloud CDNs: Token Bucket with geographic distribution (per-region limits).\n\nDistributed Environment:\n- Race Condition: locks may slow down the system.\n Lua scripts\n\n- Synchronization issues: make it stateless with the help of common redis\n",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "fccVqpW6QYnPiwnhjpChF",
"type": "rectangle",
"x": 1297.735427708336,
"y": 1062.4141027598107,
"width": 198.565687361419,
"height": 111.75859201773847,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a4",
"roundness": {
"type": 3
},
"seed": 1751927094,
"version": 436,
"versionNonce": 2050256246,
"isDeleted": false,
"boundElements": [
{
"id": "uuDqYSCg44_GS59SWU5gn",
"type": "arrow"
},
{
"type": "text",
"id": "TMUmlyBfdiCDjQyNLo8tJ"
}
],
"updated": 1766968580469,
"link": null,
"locked": false
},
{
"id": "TMUmlyBfdiCDjQyNLo8tJ",
"type": "text",
"x": 1372.5749120140454,
"y": 1105.79339876868,
"width": 48.88671875,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a5",
"roundness": null,
"seed": 1371124342,
"version": 71,
"versionNonce": 2098256630,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580552,
"link": null,
"locked": false,
"text": "Client",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "fccVqpW6QYnPiwnhjpChF",
"originalText": "Client",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "VuPCCB16y5MVRjZvqMHI0",
"type": "diamond",
"x": 1719.19136067515,
"y": 1050.0616419103821,
"width": 181.50637472283825,
"height": 147.28381374722835,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a6",
"roundness": {
"type": 2
},
"seed": 403174326,
"version": 241,
"versionNonce": 2004045494,
"isDeleted": false,
"boundElements": [
{
"id": "uuDqYSCg44_GS59SWU5gn",
"type": "arrow"
},
{
"id": "IN9dmgn3jfTH3xFkJeDQD",
"type": "arrow"
},
{
"id": "pBvLD2ldI5Gv1t9BHbFCf",
"type": "arrow"
},
{
"id": "-GCRL2QFzqSpwZUXCFKkn",
"type": "arrow"
},
{
"id": "YoL4Vy8E_JK9X84nhHbz8",
"type": "arrow"
}
],
"updated": 1766968580469,
"link": null,
"locked": false
},
{
"id": "BJFyjuSkwRkpzSBX-AgE-",
"type": "rectangle",
"x": 2202.339919433465,
"y": 1045.6131940168125,
"width": 205.11363636363626,
"height": 118.33425720620858,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a7",
"roundness": {
"type": 3
},
"seed": 360451318,
"version": 192,
"versionNonce": 1731633066,
"isDeleted": false,
"boundElements": [
{
"id": "IN9dmgn3jfTH3xFkJeDQD",
"type": "arrow"
},
{
"type": "text",
"id": "a3ylaIM-wjUUN7d9CX1co"
}
],
"updated": 1766968580469,
"link": null,
"locked": false
},
{
"id": "a3ylaIM-wjUUN7d9CX1co",
"type": "text",
"x": 2251.2567763726074,
"y": 1092.2803226199167,
"width": 107.27992248535156,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a8",
"roundness": null,
"seed": 396033590,
"version": 161,
"versionNonce": 298529478,
"isDeleted": false,
"boundElements": [],
"updated": 1767027320967,
"link": null,
"locked": false,
"text": "API Server",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "BJFyjuSkwRkpzSBX-AgE-",
"originalText": "API Server",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "FGGSHCcEkDd2IRpiiXerU",
"type": "rectangle",
"x": 2187.9262628429287,
"y": 1372.8420079526363,
"width": 144.46699066132805,
"height": 70.49054808713548,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a9",
"roundness": {
"type": 3
},
"seed": 1934215030,
"version": 388,
"versionNonce": 1499925856,
"isDeleted": false,
"boundElements": [
{
"id": "pBvLD2ldI5Gv1t9BHbFCf",
"type": "arrow"
},
{
"type": "text",
"id": "CdKbQXvee2OedsBllzOMq"
}
],
"updated": 1766968776096,
"link": null,
"locked": false
},
{
"id": "CdKbQXvee2OedsBllzOMq",
"type": "text",
"x": 2233.509787165292,
"y": 1395.587281996204,
"width": 53.29994201660156,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "a9V",
"roundness": null,
"seed": 1279361184,
"version": 77,
"versionNonce": 668885344,
"isDeleted": false,
"boundElements": [],
"updated": 1766968776096,
"link": null,
"locked": false,
"text": "Redis",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "FGGSHCcEkDd2IRpiiXerU",
"originalText": "Redis",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "uuDqYSCg44_GS59SWU5gn",
"type": "arrow",
"x": 1497.4110763709493,
"y": 1122.2809590752242,
"width": 221.02335295663556,
"height": 3.487585175356571,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aA",
"roundness": {
"type": 2
},
"seed": 416114870,
"version": 755,
"versionNonce": 477585760,
"isDeleted": false,
"boundElements": [],
"updated": 1766968891755,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
221.02335295663556,
3.487585175356571
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "fccVqpW6QYnPiwnhjpChF",
"focus": 0.041838247567413125,
"gap": 1.1099613011945166
},
"endBinding": {
"elementId": "VuPCCB16y5MVRjZvqMHI0",
"focus": -0.04764892251727936,
"gap": 6.563976951662025
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": false
},
{
"id": "IN9dmgn3jfTH3xFkJeDQD",
"type": "arrow",
"x": 1898.8892542449948,
"y": 1127.4452339281206,
"width": 308.4326496674057,
"height": 7.608093126385711,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aB",
"roundness": {
"type": 2
},
"seed": 667607542,
"version": 451,
"versionNonce": 182336810,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
308.4326496674057,
-7.608093126385711
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "GvpcQvfEXflAILYLnG49b",
"focus": 0.28542406708417434,
"gap": 14
},
"endBinding": {
"elementId": "BJFyjuSkwRkpzSBX-AgE-",
"focus": -0.20503373796470026,
"gap": 4.981984478935601
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": false
},
{
"id": "pBvLD2ldI5Gv1t9BHbFCf",
"type": "arrow",
"x": 2180.0278317178404,
"y": 1394.1944899969703,
"width": 319.74195299067105,
"height": 233.27503212206489,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aD",
"roundness": {
"type": 2
},
"seed": 1705466998,
"version": 631,
"versionNonce": 322450592,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "vGddh9hUR0Zn-vpWBYWMW"
}
],
"updated": 1766969016770,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
-319.74195299067105,
-233.27503212206489
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "FGGSHCcEkDd2IRpiiXerU",
"focus": -0.5072050711659278,
"gap": 8.993902439024396
},
"endBinding": {
"elementId": "GvpcQvfEXflAILYLnG49b",
"focus": 0.1154495412605846,
"gap": 14.024390243902417
},
"startArrowhead": "arrow",
"endArrowhead": "arrow",
"elbowed": false
},
{
"id": "vGddh9hUR0Zn-vpWBYWMW",
"type": "text",
"x": 1935.836916562837,
"y": 1265.056973935938,
"width": 168.63987731933594,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aDV",
"roundness": null,
"seed": 1561658720,
"version": 22,
"versionNonce": 726842720,
"isDeleted": false,
"boundElements": [],
"updated": 1766969015908,
"link": null,
"locked": false,
"text": "connection polling",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "pBvLD2ldI5Gv1t9BHbFCf",
"originalText": "connection polling",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "GvpcQvfEXflAILYLnG49b",
"type": "text",
"x": 1757.51591721617,
"y": 1096.8950676310033,
"width": 119.95989990234375,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aE",
"roundness": null,
"seed": 1957715382,
"version": 207,
"versionNonce": 389556576,
"isDeleted": false,
"boundElements": [
{
"id": "uuDqYSCg44_GS59SWU5gn",
"type": "arrow"
},
{
"id": "IN9dmgn3jfTH3xFkJeDQD",
"type": "arrow"
},
{
"id": "pBvLD2ldI5Gv1t9BHbFCf",
"type": "arrow"
}
],
"updated": 1766968756259,
"link": null,
"locked": false,
"text": "Rate Limiter\nmiddleware",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Rate Limiter\nmiddleware",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "Nwqh3mfbLeGEQaFS_d2AB",
"type": "text",
"x": 2233.788039106041,
"y": -456.553934431632,
"width": 583.9196166992188,
"height": 550,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aG",
"roundness": null,
"seed": 1085335606,
"version": 589,
"versionNonce": 297622774,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Rules: marketing messages per day\n\n domain: messaging\ndescriptors:\n - key: message_type\n value: marketing\n rate_limit:\n unit: day\n requests_per_unit: 5\n\nclients not allowed to login more than 5 times in 1 min\n\ndomain: auth\ndescriptors:\n - key: auth_type\n value: login\n rate_limit: \n unit: minute\n requests_per_unit: 5\n\nExceeding the rate limit, API return a HTTP response code\n429 (too many requests) to the client.",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Rules: marketing messages per day\n\n domain: messaging\ndescriptors:\n - key: message_type\n value: marketing\n rate_limit:\n unit: day\n requests_per_unit: 5\n\nclients not allowed to login more than 5 times in 1 min\n\ndomain: auth\ndescriptors:\n - key: auth_type\n value: login\n rate_limit: \n unit: minute\n requests_per_unit: 5\n\nExceeding the rate limit, API return a HTTP response code\n429 (too many requests) to the client.",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "lM0zo7a17iMkwbEuOMm7N",
"type": "rectangle",
"x": 1734.0900746673492,
"y": 769.3465317871104,
"width": 154.76081974897124,
"height": 152.02658715691894,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aH",
"roundness": {
"type": 3
},
"seed": 370307446,
"version": 264,
"versionNonce": 281459872,
"isDeleted": false,
"boundElements": [
{
"id": "-GCRL2QFzqSpwZUXCFKkn",
"type": "arrow"
}
],
"updated": 1766969152949,
"link": null,
"locked": false
},
{
"id": "K1cbAtZbLSe-TBVrSFNeX",
"type": "rectangle",
"x": 2088.4498736361525,
"y": 740.3441360785536,
"width": 211.90302588406848,
"height": 168.17157960522889,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aI",
"roundness": {
"type": 3
},
"seed": 1894830774,
"version": 247,
"versionNonce": 142087328,
"isDeleted": false,
"boundElements": [
{
"id": "63gAWnLB1_UQceqoA9w_U",
"type": "arrow"
},
{
"id": "BYMXB41OVkoPh_TBetU97",
"type": "arrow"
}
],
"updated": 1766969152949,
"link": null,
"locked": false
},
{
"id": "S7RkaM4iwATedjSCtzl_m",
"type": "rectangle",
"x": 2045.0113808493184,
"y": 545.9043933568204,
"width": 280.03098796937684,
"height": 118.16604603926879,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aJ",
"roundness": {
"type": 3
},
"seed": 1005652982,
"version": 266,
"versionNonce": 836556960,
"isDeleted": false,
"boundElements": [
{
"id": "BYMXB41OVkoPh_TBetU97",
"type": "arrow"
}
],
"updated": 1766969152949,
"link": null,
"locked": false
},
{
"id": "jt6hWDJ8bH654GQ90ogKc",
"type": "text",
"x": 2124.499428346845,
"y": 594.2742699257491,
"width": 51.77995300292969,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aK",
"roundness": null,
"seed": 1159208246,
"version": 217,
"versionNonce": 2008494240,
"isDeleted": false,
"boundElements": [],
"updated": 1766969152949,
"link": null,
"locked": false,
"text": "Rules",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Rules",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "wqx-0glPAR56Ne5w-cnEQ",
"type": "text",
"x": 2149.669015868328,
"y": 807.1538074498363,
"width": 75.85992431640625,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aL",
"roundness": null,
"seed": 1372259958,
"version": 246,
"versionNonce": 650648736,
"isDeleted": false,
"boundElements": [],
"updated": 1766969152949,
"link": null,
"locked": false,
"text": "Workers",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Workers",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "JcVt3ixvybZM_vipe4ddm",
"type": "text",
"x": 1748.290181432622,
"y": 830.9806914662939,
"width": 128.139892578125,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aM",
"roundness": null,
"seed": 852412342,
"version": 257,
"versionNonce": 484149408,
"isDeleted": false,
"boundElements": [],
"updated": 1766969152949,
"link": null,
"locked": false,
"text": "Cached Rules",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Cached Rules",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "-GCRL2QFzqSpwZUXCFKkn",
"type": "arrow",
"x": 1798.3026397456583,
"y": 1053.3745114674975,
"width": 1.0439028933453756,
"height": 130.6560364604494,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aN",
"roundness": {
"type": 2
},
"seed": 1481138422,
"version": 471,
"versionNonce": 235284640,
"isDeleted": false,
"boundElements": [],
"updated": 1766969152949,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
-1.0439028933453756,
-130.6560364604494
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "VuPCCB16y5MVRjZvqMHI0",
"focus": -0.1223535946248422,
"gap": 6.628750341370826
},
"endBinding": {
"elementId": "lM0zo7a17iMkwbEuOMm7N",
"focus": 0.19156801031271345,
"gap": 1.9193814869105381
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": false
},
{
"id": "63gAWnLB1_UQceqoA9w_U",
"type": "arrow",
"x": 2088.238296114149,
"y": 819.3113773680699,
"width": 198.4353028488099,
"height": 0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aO",
"roundness": {
"type": 2
},
"seed": 1706873398,
"version": 589,
"versionNonce": 418631008,
"isDeleted": false,
"boundElements": [],
"updated": 1766969152966,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
-198.4353028488099,
0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "K1cbAtZbLSe-TBVrSFNeX",
"focus": 0.06087293138488143,
"gap": 1
},
"endBinding": null,
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": false
},
{
"id": "BYMXB41OVkoPh_TBetU97",
"type": "arrow",
"x": 2183.3993554339754,
"y": 731.1486514683771,
"width": 3.5154419040675293,
"height": 69.45439039633351,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aP",
"roundness": {
"type": 2
},
"seed": 1175526262,
"version": 659,
"versionNonce": 665318752,
"isDeleted": false,
"boundElements": [],
"updated": 1766969152967,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
3.5154419040675293,
-69.45439039633351
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "K1cbAtZbLSe-TBVrSFNeX",
"focus": -0.14267150571977347,
"gap": 9.195484610176436
},
"endBinding": {
"elementId": "S7RkaM4iwATedjSCtzl_m",
"focus": -0.03327235449815856,
"gap": 2.3761783240454406
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": false
},
{
"id": "YoL4Vy8E_JK9X84nhHbz8",
"type": "arrow",
"x": 1809.8445480365692,
"y": 1202.3454556576107,
"width": 434.291851441242,
"height": 302.4081893931052,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aQ",
"roundness": null,
"seed": 1066024118,
"version": 332,
"versionNonce": 1491518816,
"isDeleted": false,
"boundElements": [],
"updated": 1766969078368,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
0,
272.30148207603224
],
[
-434.291851441242,
272.30148207603224
],
[
-434.291851441242,
-30.10670731707296
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "VuPCCB16y5MVRjZvqMHI0",
"focus": 0.11286954915580984,
"gap": 1,
"fixedPoint": [
0.4702353474908652,
0.9939539946100425
]
},
"endBinding": null,
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true,
"fixedSegments": [
{
"index": 2,
"start": [
0,
272.30148207603224
],
"end": [
-434.291851441242,
272.30148207603224
]
}
],
"startIsSpecial": false,
"endIsSpecial": false
},
{
"id": "zWnU7s557BoCBdFa0JUdx",
"type": "rectangle",
"x": 1709.1597318909608,
"y": 1675.732793579819,
"width": 364.8898494870059,
"height": 89.82279568772447,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aR",
"roundness": {
"type": 3
},
"seed": 130889206,
"version": 351,
"versionNonce": 1119069344,
"isDeleted": false,
"boundElements": [
{
"id": "qaj_Y_ADW7u1oaDY-g25n",
"type": "arrow"
}
],
"updated": 1766969098427,
"link": null,
"locked": false
},
{
"id": "CqeKxaKfz3lwqNt7FJzNB",
"type": "ellipse",
"x": 2022.5921385331649,
"y": 1467.4692406412248,
"width": 144.54813551377538,
"height": 141.41516066871532,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aS",
"roundness": {
"type": 2
},
"seed": 1474234166,
"version": 394,
"versionNonce": 2138646688,
"isDeleted": false,
"boundElements": [
{
"id": "uY-53o-jYzIalVwGArWp1",
"type": "arrow"
}
],
"updated": 1766969108778,
"link": null,
"locked": false
},
{
"id": "Yjzp6lN00YWTE6TM4NgH1",
"type": "text",
"x": 2050.362526542325,
"y": 1522.2242454468803,
"width": 87.85993957519531,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aT",
"roundness": null,
"seed": 2404470,
"version": 382,
"versionNonce": 645890208,
"isDeleted": false,
"boundElements": [
{
"id": "uY-53o-jYzIalVwGArWp1",
"type": "arrow"
}
],
"updated": 1766969108778,
"link": null,
"locked": false,
"text": "Request \nDropped",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Request \nDropped",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "GE5Mh7rDXax8LB6bjjeq2",
"type": "text",
"x": 1810.2612370209022,
"y": 1710.1385536964794,
"width": 147.89987182617188,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aU",
"roundness": null,
"seed": 2086875574,
"version": 348,
"versionNonce": 38468768,
"isDeleted": false,
"boundElements": [],
"updated": 1766969098427,
"link": null,
"locked": false,
"text": "Message Queue",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Message Queue",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "uY-53o-jYzIalVwGArWp1",
"type": "arrow",
"x": 1811.1407204365642,
"y": 1465.6759936255373,
"width": 206.51253902388044,
"height": 69.48861209422353,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aV",
"roundness": null,
"seed": 129993462,
"version": 719,
"versionNonce": 1060210848,
"isDeleted": false,
"boundElements": [],
"updated": 1767024282973,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
206.51253902388044,
69.48861209422353
]
],
"lastCommittedPoint": null,
"startBinding": null,
"endBinding": {
"elementId": "CqeKxaKfz3lwqNt7FJzNB",
"focus": -0.2417094128879426,
"gap": 5.000065599511148
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": false,
"fixedSegments": null,
"startIsSpecial": null,
"endIsSpecial": null
},
{
"id": "qaj_Y_ADW7u1oaDY-g25n",
"type": "arrow",
"x": 1795.5990616237725,
"y": 1480.3565545682554,
"width": 5.292585849980469,
"height": 193.60164528799237,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aW",
"roundness": null,
"seed": 817806390,
"version": 704,
"versionNonce": 624286880,
"isDeleted": false,
"boundElements": [],
"updated": 1767024278071,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
5.292585849980469,
193.60164528799237
]
],
"lastCommittedPoint": null,
"startBinding": null,
"endBinding": {
"elementId": "zWnU7s557BoCBdFa0JUdx",
"focus": -0.48693537682454946,
"gap": 1.7745937235711153
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": false
},
{
"id": "9nXGFsJYz0nfAba-7JPCv",
"type": "text",
"x": 1877.1352528763455,
"y": 1461.759526618533,
"width": 80.67996215820312,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aX",
"roundness": null,
"seed": 1833289078,
"version": 287,
"versionNonce": 2050293920,
"isDeleted": false,
"boundElements": [],
"updated": 1766969110645,
"link": null,
"locked": false,
"text": "Option 1",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Option 1",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "OZJxWMob4mWIsMoJj4JQB",
"type": "text",
"x": 1827.9690490069408,
"y": 1575.6075927400989,
"width": 86.13996887207031,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aY",
"roundness": null,
"seed": 781821622,
"version": 275,
"versionNonce": 1473932448,
"isDeleted": false,
"boundElements": [],
"updated": 1766969100194,
"link": null,
"locked": false,
"text": "Option 2",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Option 2",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "FNV9e_LEvBgZtpdYGs9hf",
"type": "text",
"x": 1470.4591327291596,
"y": 1500.394679418171,
"width": 236.23988342285156,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aZ",
"roundness": null,
"seed": 1969184758,
"version": 270,
"versionNonce": 921017696,
"isDeleted": false,
"boundElements": [],
"updated": 1766969085735,
"link": null,
"locked": false,
"text": "429: Too many requests",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "429: Too many requests",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "FuRuHob2zHmvCbqQPWWPs",
"type": "text",
"x": 1819.0398761117408,
"y": 1381.3653183188744,
"width": 110.17991638183594,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aa",
"roundness": null,
"seed": 1704718646,
"version": 76,
"versionNonce": 1341112694,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "rate limited",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "rate limited",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "0N4ATvLpiif5CfcsG1J3z",
"type": "text",
"x": 1996.1014620934634,
"y": 1098.7057403923334,
"width": 74.43991088867188,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "dashed",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ab",
"roundness": null,
"seed": 1521769078,
"version": 82,
"versionNonce": 1377671328,
"isDeleted": false,
"boundElements": [],
"updated": 1767024290114,
"link": null,
"locked": false,
"text": "success",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "success",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "aikLa6bjXPGfon-bxQ5Re",
"type": "text",
"x": 374.3153173918363,
"y": -71.13403322895772,
"width": 900,
"height": 30,
"angle": 0,
"strokeColor": "#d32f2f",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ac",
"roundness": null,
"seed": 2070780854,
"version": 284,
"versionNonce": 581182134,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "ALGORITHM COMPARISON & DECISION MATRIX",
"fontSize": 18,
"fontFamily": 1,
"fontWeight": "bold",
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "ALGORITHM COMPARISON & DECISION MATRIX",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "xhoM0tzCPXGprdBM8CRWH",
"type": "text",
"x": -289.1303117569769,
"y": 1500.04415465497,
"width": 1363.2944046083649,
"height": 438.2933320438159,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ad",
"roundness": null,
"seed": 1307358454,
"version": 777,
"versionNonce": 1663896490,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Algorithm | Burst | Stability | Accuracy | Memory | Complexity | Distributed | Best For\n───────────────────────────────────────────────\nToken Bucket | Yes | Good | Good | Low | Medium | Yes | General APIs, AWS\nLeaky Bucket | No | Perfect | Good | Low | Medium | Yes | Smooth streams\nSliding Window | No | Good | Excellent| Medium | Low | No | Simple quotas\nRolling Counter | No | Perfect | Perfect | High | High | No | Fraud detection\n\nCHOOSE BASED ON:\n1. Need burst traffic? → Token Bucket\n2. Need smooth constant rate? → Leaky Bucket\n3. Simple implementation? → Sliding Window (fixed) or Token Bucket\n4. Maximum accuracy needed? → Rolling Counter or Sliding Window (log)\n5. Distributed system? → Token Bucket (easiest) or implement with Redis\n6. High throughput APIs? → Token Bucket with Redis (Lua scripts for atomic operations)",
"fontSize": 25.045333259646622,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Algorithm | Burst | Stability | Accuracy | Memory | Complexity | Distributed | Best For\n───────────────────────────────────────────────\nToken Bucket | Yes | Good | Good | Low | Medium | Yes | General APIs, AWS\nLeaky Bucket | No | Perfect | Good | Low | Medium | Yes | Smooth streams\nSliding Window | No | Good | Excellent| Medium | Low | No | Simple quotas\nRolling Counter | No | Perfect | Perfect | High | High | No | Fraud detection\n\nCHOOSE BASED ON:\n1. Need burst traffic? → Token Bucket\n2. Need smooth constant rate? → Leaky Bucket\n3. Simple implementation? → Sliding Window (fixed) or Token Bucket\n4. Maximum accuracy needed? → Rolling Counter or Sliding Window (log)\n5. Distributed system? → Token Bucket (easiest) or implement with Redis\n6. High throughput APIs? → Token Bucket with Redis (Lua scripts for atomic operations)",
"autoResize": false,
"lineHeight": 1.25
},
{
"id": "MFZxNS_UEm9LW9PSPqV3E",
"type": "text",
"x": 385.6827382578913,
"y": 5.497065051453205,
"width": 400,
"height": 25,
"angle": 0,
"strokeColor": "#1976d2",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ae",
"roundness": null,
"seed": 1270261302,
"version": 339,
"versionNonce": 2059033590,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "1. TOKEN BUCKET ALGORITHM",
"fontSize": 14,
"fontFamily": 1,
"fontWeight": "bold",
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "1. TOKEN BUCKET ALGORITHM",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "2WPkUqPm0ISKFNONFmpUc",
"type": "text",
"x": 425.6827382578913,
"y": 95.4970650514532,
"width": 80,
"height": 30,
"angle": 0,
"strokeColor": "#1976d2",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "af",
"roundness": null,
"seed": 1974497142,
"version": 207,
"versionNonce": 1772226154,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "100\nTokens",
"fontSize": 12,
"fontFamily": 1,
"fontWeight": "bold",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "100\nTokens",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "4vxrPGLb1OF6BcLmymWgR",
"type": "arrow",
"x": 535.6827382578913,
"y": 80.4970650514532,
"width": 80,
"height": 0,
"angle": 0,
"strokeColor": "#2e7d32",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ag",
"roundness": {
"type": 2
},
"seed": 1746866358,
"version": 207,
"versionNonce": 2117561654,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
80,
0
]
],
"lastCommittedPoint": null,
"startBinding": null,
"endBinding": null,
"startArrowhead": null,
"endArrowhead": "arrow"
},
{
"id": "19_IqAoMx_n6rmQjHMbez",
"type": "text",
"x": 555.6827382578913,
"y": 60.497065051453205,
"width": 50,
"height": 20,
"angle": 0,
"strokeColor": "#2e7d32",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ah",
"roundness": null,
"seed": 1856473590,
"version": 207,
"versionNonce": 891922730,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Refill\n10/sec",
"fontSize": 10,
"fontFamily": 1,
"textAlign": "center",
"verticalAlign": "top",
"containerId": null,
"originalText": "Refill\n10/sec",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "-z9lm-yyGjoLRjfhYXMgA",
"type": "arrow",
"x": 415.6827382578913,
"y": 185.49706505145332,
"width": 0,
"height": 60,
"angle": 0,
"strokeColor": "#d32f2f",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ai",
"roundness": {
"type": 2
},
"seed": 407821110,
"version": 207,
"versionNonce": 1249924726,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
0,
-60
]
],
"lastCommittedPoint": null,
"startBinding": null,
"endBinding": null,
"startArrowhead": null,
"endArrowhead": "arrow"
},
{
"id": "REkeSe0479F6tbHC9aVAQ",
"type": "text",
"x": 375.6827382578913,
"y": 200.49706505145332,
"width": 80,
"height": 20,
"angle": 0,
"strokeColor": "#d32f2f",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aj",
"roundness": null,
"seed": 1266287734,
"version": 207,
"versionNonce": 1563358186,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Request\n-1 token",
"fontSize": 10,
"fontFamily": 1,
"textAlign": "center",
"verticalAlign": "top",
"containerId": null,
"originalText": "Request\n-1 token",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "CyWd4vRp_EXAQ3W4rlqbU",
"type": "text",
"x": 635.6827382578913,
"y": 55.497065051453205,
"width": 450,
"height": 140,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#f5f5f5",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ak",
"roundness": {
"type": 3
},
"seed": 1508771254,
"version": 344,
"versionNonce": 140122038,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "FLOW:\n1. Bucket capacity = 100 tokens\n2. Refill rate = 10 tokens/sec\n3. Each request costs 1 token\n4. If bucket empty → reject request\n5. BURST: First 100 requests allowed immediately\n6. After burst: Limited to 10/sec (sustained rate)",
"fontSize": 16,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "FLOW:\n1. Bucket capacity = 100 tokens\n2. Refill rate = 10 tokens/sec\n3. Each request costs 1 token\n4. If bucket empty → reject request\n5. BURST: First 100 requests allowed immediately\n6. After burst: Limited to 10/sec (sustained rate)",
"autoResize": false,
"lineHeight": 1.25
},
{
"id": "ft4Ypon_SWYDCxhLd6AxI",
"type": "text",
"x": 363.9635901894562,
"y": 370.830471922863,
"width": 400,
"height": 25,
"angle": 0,
"strokeColor": "#2e7d32",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "al",
"roundness": null,
"seed": 349167350,
"version": 312,
"versionNonce": 1404888746,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "2. LEAKY BUCKET ALGORITHM",
"fontSize": 14,
"fontFamily": 1,
"fontWeight": "bold",
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "2. LEAKY BUCKET ALGORITHM",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "s1_dxmrvMnZ2YFps2Sp4U",
"type": "rectangle",
"x": 393.9635901894562,
"y": 420.830471922863,
"width": 100,
"height": 120,
"angle": 0,
"strokeColor": "#2e7d32",
"backgroundColor": "#f1f8f4",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "am",
"roundness": {
"type": 3
},
"seed": 1621397558,
"version": 180,
"versionNonce": 2146021622,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false
},
{
"id": "krQ9HSuYaKlAYaBSawd59",
"type": "text",
"x": 403.9635901894562,
"y": 440.830471922863,
"width": 80,
"height": 60,
"angle": 0,
"strokeColor": "#2e7d32",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "an",
"roundness": null,
"seed": 1230051702,
"version": 312,
"versionNonce": 293503338,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Queue\n[req1]\n[req2]\n[req3]",
"fontSize": 10,
"fontFamily": 1,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "Queue\n[req1]\n[req2]\n[req3]",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "0_a7RqYUl1pTXoc0E92OU",
"type": "text",
"x": 418.9635901894562,
"y": 560.830471922863,
"width": 40,
"height": 20,
"angle": 0,
"strokeColor": "#d32f2f",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ao",
"roundness": null,
"seed": 370834102,
"version": 180,
"versionNonce": 750002742,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "10/sec",
"fontSize": 10,
"fontFamily": 1,
"fontWeight": "bold",
"textAlign": "center",
"verticalAlign": "top",
"containerId": null,
"originalText": "10/sec",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "xMiUZ1K8R6cvavrtlJR_X",
"type": "arrow",
"x": 393.9635901894562,
"y": 400.830471922863,
"width": 0,
"height": 40,
"angle": 0,
"strokeColor": "#1976d2",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ap",
"roundness": {
"type": 2
},
"seed": 1571140598,
"version": 180,
"versionNonce": 1103021098,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
0,
40
]
],
"lastCommittedPoint": null,
"startBinding": null,
"endBinding": null,
"startArrowhead": null,
"endArrowhead": "arrow"
},
{
"id": "Sw72OpZzhOe6BpO2_QHTu",
"type": "text",
"x": 353.9635901894562,
"y": 385.830471922863,
"width": 50,
"height": 20,
"angle": 0,
"strokeColor": "#1976d2",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aq",
"roundness": null,
"seed": 435668278,
"version": 180,
"versionNonce": 1369336694,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Requests\n(bursty)",
"fontSize": 9,
"fontFamily": 1,
"textAlign": "center",
"verticalAlign": "top",
"containerId": null,
"originalText": "Requests\n(bursty)",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "15buJLuAdpfEbwY3_CRkl",
"type": "text",
"x": 613.9635901894562,
"y": 420.830471922863,
"width": 450,
"height": 140,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#f5f5f5",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ar",
"roundness": {
"type": 3
},
"seed": 1014345334,
"version": 317,
"versionNonce": 1852354282,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "FLOW:\n1. Requests enter queue (bucket)\n2. Queue has capacity limit\n3. Leak (process) at fixed rate = 10/sec\n4. Output rate = CONSTANT (no burst)\n5. If queue full → reject new requests\n6. Fair, smooth, predictable latency",
"fontSize": 16,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "FLOW:\n1. Requests enter queue (bucket)\n2. Queue has capacity limit\n3. Leak (process) at fixed rate = 10/sec\n4. Output rate = CONSTANT (no burst)\n5. If queue full → reject new requests\n6. Fair, smooth, predictable latency",
"autoResize": false,
"lineHeight": 1.25
},
{
"id": "7yBtXDrT2RuX3P2__jHi4",
"type": "text",
"x": 301.06015110080034,
"y": 751.2844964517818,
"width": 400,
"height": 25,
"angle": 0,
"strokeColor": "#f57c00",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "as",
"roundness": null,
"seed": 1105489846,
"version": 326,
"versionNonce": 216894646,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "3. SLIDING WINDOW ALGORITHM",
"fontSize": 14,
"fontFamily": 1,
"fontWeight": "bold",
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "3. SLIDING WINDOW ALGORITHM",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "_lqQ7gKs2gtNby7MvpjDz",
"type": "rectangle",
"x": 331.06015110080034,
"y": 801.284496451782,
"width": 400,
"height": 30,
"angle": 0,
"strokeColor": "#999999",
"backgroundColor": "#f5f5f5",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "at",
"roundness": null,
"seed": 1181288694,
"version": 194,
"versionNonce": 738673066,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false
},
{
"id": "JzjK_pklRINh9bkAQMjO4",
"type": "text",
"x": 331.06015110080034,
"y": 801.284496451782,
"width": 400,
"height": 30,
"angle": 0,
"strokeColor": "#000000",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "au",
"roundness": null,
"seed": 428374582,
"version": 326,
"versionNonce": 1816561142,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Time → [00:00 01 02 03 04 05 06 07 08 09 00:10 (now)]",
"fontSize": 10,
"fontFamily": 2,
"textAlign": "left",
"verticalAlign": "middle",
"containerId": null,
"originalText": "Time → [00:00 01 02 03 04 05 06 07 08 09 00:10 (now)]",
"autoResize": false,
"lineHeight": 1.25
},
{
"id": "aiMhqgrgctShcS51MYGFk",
"type": "rectangle",
"x": 531.0601511008003,
"y": 791.284496451782,
"width": 200,
"height": 50,
"angle": 0,
"strokeColor": "#f57c00",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 3,
"strokeStyle": "dashed",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "av",
"roundness": null,
"seed": 1378337654,
"version": 194,
"versionNonce": 1170570346,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false
},
{
"id": "d011WzVFe_AsKHswt7uS4",
"type": "text",
"x": 531.0601511008003,
"y": 851.284496451782,
"width": 400,
"height": 80,
"angle": 0,
"strokeColor": "#f57c00",
"backgroundColor": "#f5f5f5",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "aw",
"roundness": {
"type": 3
},
"seed": 1653335222,
"version": 326,
"versionNonce": 11425590,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "SLIDING 60-SEC WINDOW (now = 00:10)\nWindow spans: 00:10 - 01:00 (previous 60 sec)\nCount requests in this window\nLimit: 100 requests/minute\nIf count >= 100 → reject new request",
"fontSize": 10,
"fontFamily": 2,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "SLIDING 60-SEC WINDOW (now = 00:10)\nWindow spans: 00:10 - 01:00 (previous 60 sec)\nCount requests in this window\nLimit: 100 requests/minute\nIf count >= 100 → reject new request",
"autoResize": false,
"lineHeight": 1.25
},
{
"id": "MLiykoOc-NHVocJRcxrOd",
"type": "text",
"x": 184.457127149798,
"y": 1159.6643654367604,
"width": 399.2764921847793,
"height": 24.954780761548705,
"angle": 0,
"strokeColor": "#7b1fa2",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ax",
"roundness": null,
"seed": 744087030,
"version": 267,
"versionNonce": 1768841002,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "4. ROLLING COUNTER / SLIDING LOG",
"fontSize": 13.974677226467273,
"fontFamily": 1,
"fontWeight": "bold",
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "4. ROLLING COUNTER / SLIDING LOG",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "OjWX-EssKCvah6F_izX_r",
"type": "rectangle",
"x": 191.1216726308121,
"y": 1205.1290981767538,
"width": 412.37939921934026,
"height": 126.77943746337269,
"angle": 0,
"strokeColor": "#7b1fa2",
"backgroundColor": "#f3e5f5",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "ay",
"roundness": {
"type": 3
},
"seed": 345419574,
"version": 188,
"versionNonce": 1921646710,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false
},
{
"id": "qluX6Tma7h-J41RUgqEep",
"type": "text",
"x": 224.3847763682761,
"y": 1219.555839264477,
"width": 379.3126675755403,
"height": 79.85529843695585,
"angle": 0,
"strokeColor": "#7b1fa2",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "az",
"roundness": null,
"seed": 396843126,
"version": 267,
"versionNonce": 1399646698,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "Request Log (stored timestamps):\n[12:00:05, 12:00:15, 12:00:45, 12:01:10, 12:01:23, ...]\n\nNew request at 12:01:35?\nCheck: Is oldest request > 60 sec old?\nIf yes → count += 1, remove old timestamp\nIf count < limit → ACCEPT\nElse → REJECT",
"fontSize": 9.981912304619481,
"fontFamily": 2,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "Request Log (stored timestamps):\n[12:00:05, 12:00:15, 12:00:45, 12:01:10, 12:01:23, ...]\n\nNew request at 12:01:35?\nCheck: Is oldest request > 60 sec old?\nIf yes → count += 1, remove old timestamp\nIf count < limit → ACCEPT\nElse → REJECT",
"autoResize": false,
"lineHeight": 1.25
},
{
"id": "fZbja0JQ1kVgGPlcxAhmZ",
"type": "text",
"x": 695.4743044835595,
"y": 1192.9674490021448,
"width": 379.3126675755403,
"height": 200,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#f5f5f5",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b00",
"roundness": {
"type": 3
},
"seed": 1565579702,
"version": 313,
"versionNonce": 362709430,
"isDeleted": false,
"boundElements": [],
"updated": 1766968580469,
"link": null,
"locked": false,
"text": "ADVANTAGES:\n✓ Most accurate - exact timing\n✓ No edge cases - every request tracked\n✓ Supports weighted requests\n✓ Perfect fairness\n\nDISADVANTAGES:\n✗ High memory usage\n✗ Slower lookups O(n)\n✗ Hard to scale distributed",
"fontSize": 16,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "ADVANTAGES:\n✓ Most accurate - exact timing\n✓ No edge cases - every request tracked\n✓ Supports weighted requests\n✓ Perfect fairness\n\nDISADVANTAGES:\n✗ High memory usage\n✗ Slower lookups O(n)\n✗ Hard to scale distributed",
"autoResize": false,
"lineHeight": 1.25
},
{
"id": "yssxqHvZ4Si-rBMxkQJx0",
"type": "text",
"x": 1335.3238497020366,
"y": 1969.4393449476534,
"width": 415.0797119140625,
"height": 100,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b01",
"roundness": null,
"seed": 1858828202,
"version": 193,
"versionNonce": 929638560,
"isDeleted": false,
"boundElements": [],
"updated": 1766968941807,
"link": null,
"locked": false,
"text": "fail open if RL down then pass\nfail close if RL down then block all\n\nor flag to switch to Fixed window counter",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "fail open if RL down then pass\nfail close if RL down then block all\n\nor flag to switch to Fixed window counter",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "06u1tZWflRyLQe1rzubyP",
"type": "rectangle",
"x": 2214.8053843855087,
"y": 1375.5630584629112,
"width": 144.46699066132805,
"height": 70.49054808713548,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b02",
"roundness": {
"type": 3
},
"seed": 1886564704,
"version": 391,
"versionNonce": 1337842016,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "R9-LEMZmc1ZhX62Uy4CXG"
}
],
"updated": 1766968778511,
"link": null,
"locked": false
},
{
"id": "R9-LEMZmc1ZhX62Uy4CXG",
"type": "text",
"x": 2260.388908707872,
"y": 1398.3083325064788,
"width": 53.29994201660156,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b03",
"roundness": null,
"seed": 634750304,
"version": 81,
"versionNonce": 1734891680,
"isDeleted": false,
"boundElements": [],
"updated": 1766968778519,
"link": null,
"locked": false,
"text": "Redis",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "06u1tZWflRyLQe1rzubyP",
"originalText": "Redis",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "SituyyI1t2GxuPwmCugLG",
"type": "rectangle",
"x": 2229.921644751418,
"y": 1378.5531449322734,
"width": 144.46699066132805,
"height": 70.49054808713548,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b04",
"roundness": {
"type": 3
},
"seed": 1617080480,
"version": 391,
"versionNonce": 1889994912,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "P1CzScsPA-nKMbyzMejg_"
}
],
"updated": 1766968779850,
"link": null,
"locked": false
},
{
"id": "P1CzScsPA-nKMbyzMejg_",
"type": "text",
"x": 2275.5051690737814,
"y": 1401.298418975841,
"width": 53.29994201660156,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b05",
"roundness": null,
"seed": 1845730464,
"version": 81,
"versionNonce": 1576150368,
"isDeleted": false,
"boundElements": [],
"updated": 1766968779854,
"link": null,
"locked": false,
"text": "Redis",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "SituyyI1t2GxuPwmCugLG",
"originalText": "Redis",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "V-VFxp3oRpwn-GYPeRPSx",
"type": "rectangle",
"x": 2229.921644751418,
"y": 1378.5531449322734,
"width": 144.46699066132805,
"height": 70.49054808713548,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b06",
"roundness": {
"type": 3
},
"seed": 1391480160,
"version": 391,
"versionNonce": 1820620128,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "O90hfIwHsc3Gg_jf9CvAu"
}
],
"updated": 1766968780584,
"link": null,
"locked": false
},
{
"id": "O90hfIwHsc3Gg_jf9CvAu",
"type": "text",
"x": 2275.5051690737814,
"y": 1401.298418975841,
"width": 53.29994201660156,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b07",
"roundness": null,
"seed": 507486560,
"version": 81,
"versionNonce": 1361378464,
"isDeleted": false,
"boundElements": [],
"updated": 1766968780589,
"link": null,
"locked": false,
"text": "Redis",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "V-VFxp3oRpwn-GYPeRPSx",
"originalText": "Redis",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "Gk4lySDtzn7qTXVPAVyKX",
"type": "rectangle",
"x": 2248.432197383242,
"y": 1385.4350077248437,
"width": 144.46699066132805,
"height": 70.49054808713548,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b08",
"roundness": {
"type": 3
},
"seed": 1984320672,
"version": 392,
"versionNonce": 992610464,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "7f1Ezwdah-cDiWhbs9MCE"
},
{
"id": "l683o1b3sH6KmVRYFxguH",
"type": "arrow"
}
],
"updated": 1766968961154,
"link": null,
"locked": false
},
{
"id": "7f1Ezwdah-cDiWhbs9MCE",
"type": "text",
"x": 2294.0157217056053,
"y": 1408.1802817684113,
"width": 53.29994201660156,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b09",
"roundness": null,
"seed": 1339211936,
"version": 81,
"versionNonce": 1971339616,
"isDeleted": false,
"boundElements": [],
"updated": 1766968782560,
"link": null,
"locked": false,
"text": "Redis",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "Gk4lySDtzn7qTXVPAVyKX",
"originalText": "Redis",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "FE6wo5QPFeZTiVIpTL6U8",
"type": "rectangle",
"x": 2490.8623970534427,
"y": 1357.6743609027058,
"width": 144.46699066132805,
"height": 70.49054808713548,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffc9c9",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b0A",
"roundness": {
"type": 3
},
"seed": 2057791840,
"version": 611,
"versionNonce": 854648992,
"isDeleted": false,
"boundElements": [
{
"type": "text",
"id": "qqJkscr-4CPf6_o6mzlTq"
},
{
"id": "l683o1b3sH6KmVRYFxguH",
"type": "arrow"
}
],
"updated": 1766969119396,
"link": null,
"locked": false
},
{
"id": "qqJkscr-4CPf6_o6mzlTq",
"type": "text",
"x": 2498.8559555554934,
"y": 1380.4196349462734,
"width": 128.47987365722656,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b0B",
"roundness": null,
"seed": 2025012576,
"version": 308,
"versionNonce": 1108006048,
"isDeleted": false,
"boundElements": [],
"updated": 1766969119396,
"link": null,
"locked": false,
"text": "Redis Replica",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "center",
"verticalAlign": "middle",
"containerId": "FE6wo5QPFeZTiVIpTL6U8",
"originalText": "Redis Replica",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "Qz_yT36R4xDXpTJ0MdQf3",
"type": "text",
"x": 2477.0207862210086,
"y": 1209.3480178046973,
"width": 120.85989379882812,
"height": 125,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b0C",
"roundness": null,
"seed": 90063008,
"version": 128,
"versionNonce": 1591434592,
"isDeleted": false,
"boundElements": [],
"updated": 1766983453425,
"link": null,
"locked": false,
"text": "x 20\n\nhash slot\n\nredis cluster",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "x 20\n\nhash slot\n\nredis cluster",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "ITJIS9P00nP4RFujDm9eD",
"type": "text",
"x": 2282.0277642640526,
"y": 1475.0511435301946,
"width": 109.65994262695312,
"height": 50,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b0D",
"roundness": null,
"seed": 1439086944,
"version": 31,
"versionNonce": 930976928,
"isDeleted": false,
"boundElements": [],
"updated": 1766969121901,
"link": null,
"locked": false,
"text": "50k rps\n1M/50k=20",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "50k rps\n1M/50k=20",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "l683o1b3sH6KmVRYFxguH",
"type": "arrow",
"x": 2394.7271411711977,
"y": 1406.3242699967843,
"width": 92.67528985196395,
"height": 4.83581323032945,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b0E",
"roundness": {
"type": 2
},
"seed": 1370340704,
"version": 110,
"versionNonce": 789004448,
"isDeleted": false,
"boundElements": [],
"updated": 1766969119396,
"link": null,
"locked": false,
"points": [
[
0,
0
],
[
92.67528985196395,
4.83581323032945
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "Gk4lySDtzn7qTXVPAVyKX",
"focus": -0.4690797636157486,
"gap": 2.0453806681403797
},
"endBinding": {
"elementId": "FE6wo5QPFeZTiVIpTL6U8",
"focus": -0.5680651655524336,
"gap": 3.8904300733218524
},
"startArrowhead": "arrow",
"endArrowhead": "arrow",
"elbowed": false
},
{
"id": "x2n843SYPxaPzuQnbjN47",
"type": "text",
"x": 2664.8624748543602,
"y": 1406.600446521865,
"width": 160.33985900878906,
"height": 25,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": "b0F",
"roundness": null,
"seed": 1041283232,
"version": 97,
"versionNonce": 728209568,
"isDeleted": false,
"boundElements": [],
"updated": 1766969119396,
"link": null,
"locked": false,
"text": "async replication",
"fontSize": 20,
"fontFamily": 5,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "async replication",
"autoResize": true,
"lineHeight": 1.25
}
],
"appState": {
"gridSize": 20,
"gridStep": 5,
"gridModeEnabled": false,
"viewBackgroundColor": "#ffffff"
},
"files": {}
}