[{"data":1,"prerenderedAt":446},["ShallowReactive",2],{"navigation":3,"/actix-web/performance":240,"/actix-web/performance-surround":441},[4,34,66,87,106,145,166,176,204],{"title":5,"path":6,"stem":7,"children":8,"icon":32,"defaultOpen":33},"Getting Started","/getting-started","1.getting-started/1.index",[9,12,17,22,27],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-info",{"title":13,"path":14,"stem":15,"icon":16},"Installation","/getting-started/installation","1.getting-started/2.installation","i-lucide-download",{"title":18,"path":19,"stem":20,"icon":21},"Quickstart (Local)","/getting-started/quickstart-local","1.getting-started/3.quickstart-local","i-lucide-zap",{"title":23,"path":24,"stem":25,"icon":26},"Quickstart (Redis)","/getting-started/quickstart-redis","1.getting-started/4.quickstart-redis","i-lucide-database",{"title":28,"path":29,"stem":30,"icon":31},"Quickstart (Hybrid)","/getting-started/quickstart-hybrid","1.getting-started/5.quickstart-hybrid","i-lucide-arrow-left-right","i-lucide-rocket",true,{"title":35,"icon":36,"defaultOpen":33,"path":37,"stem":38,"children":39,"page":65},"Concepts","i-lucide-lightbulb","/concepts","2.concepts",[40,45,50,55,60],{"title":41,"path":42,"stem":43,"icon":44},"Keys","/concepts/keys","2.concepts/1.keys","i-lucide-key-round",{"title":46,"path":47,"stem":48,"icon":49},"Rate Limits","/concepts/rate-limits","2.concepts/2.rate-limits","i-lucide-badge-percent",{"title":51,"path":52,"stem":53,"icon":54},"Sliding Windows","/concepts/sliding-windows","2.concepts/3.sliding-windows","i-lucide-timer-reset",{"title":56,"path":57,"stem":58,"icon":59},"Decisions","/concepts/decisions","2.concepts/4.decisions","i-lucide-check-check",{"title":61,"path":62,"stem":63,"icon":64},"Configuration Types","/concepts/configuration-types","2.concepts/5.configuration-types","i-lucide-box",false,{"title":67,"icon":68,"defaultOpen":33,"path":69,"stem":70,"children":71,"page":65},"Strategies","i-lucide-git-branch","/strategies","3.strategies",[72,77,82],{"title":73,"path":74,"stem":75,"icon":76},"Absolute","/strategies/absolute","3.strategies/1.absolute","i-lucide-shield",{"title":78,"path":79,"stem":80,"icon":81},"Suppressed","/strategies/suppressed","3.strategies/2.suppressed","i-lucide-activity",{"title":83,"path":84,"stem":85,"icon":86},"How Suppression Works","/strategies/how-suppression-works","3.strategies/3.how-suppression-works","i-lucide-function-square",{"title":88,"icon":89,"defaultOpen":33,"path":90,"stem":91,"children":92,"page":65},"Providers","i-lucide-layers","/providers","4.providers",[93,98,102],{"title":94,"path":95,"stem":96,"icon":97},"Local","/providers/local","4.providers/1.local","i-lucide-cpu",{"title":99,"path":100,"stem":101,"icon":26},"Redis","/providers/redis","4.providers/2.redis",{"title":103,"path":104,"stem":105,"icon":31},"Hybrid","/providers/hybrid","4.providers/3.hybrid",{"title":107,"path":108,"stem":109,"children":110,"icon":76,"defaultOpen":65},"Actix Web","/actix-web","5.actix-web/1.index",[111,113,118,122,127,131,136,140],{"title":112,"path":108,"stem":109,"icon":76},"Overview",{"title":114,"path":115,"stem":116,"icon":117},"Client IPs","/actix-web/client-ips","5.actix-web/2.client-ips","i-lucide-network",{"title":119,"path":120,"stem":121,"icon":44},"Keys and custom extractors","/actix-web/keys","5.actix-web/3.keys",{"title":123,"path":124,"stem":125,"icon":126},"Limits","/actix-web/limits","5.actix-web/4.limits","i-lucide-gauge",{"title":128,"path":129,"stem":130,"icon":26},"Backends","/actix-web/backends","5.actix-web/5.backends",{"title":132,"path":133,"stem":134,"icon":135},"Responses","/actix-web/responses","5.actix-web/6.responses","i-lucide-reply",{"title":137,"path":138,"stem":139,"icon":81},"Observability","/actix-web/observability","5.actix-web/7.observability",{"title":141,"path":142,"stem":143,"icon":144},"Performance","/actix-web/performance","5.actix-web/8.performance","i-lucide-timer",{"title":146,"icon":147,"defaultOpen":65,"path":148,"stem":149,"children":150,"page":65},"Guides","i-lucide-map","/guides","5.guides",[151,156,161],{"title":152,"path":153,"stem":154,"icon":155},"Configuration","/guides/configuration","5.guides/1.configuration","i-lucide-sliders-horizontal",{"title":157,"path":158,"stem":159,"icon":160},"Cleanup","/guides/cleanup","5.guides/2.cleanup","i-lucide-trash-2",{"title":162,"path":163,"stem":164,"icon":165},"Troubleshooting","/guides/troubleshooting","5.guides/4.troubleshooting","i-lucide-wrench",{"title":167,"icon":168,"defaultOpen":65,"path":169,"stem":170,"children":171,"page":65},"Reference","i-lucide-file-text","/reference","6.reference",[172],{"title":173,"path":174,"stem":175,"icon":168},"API Reference Guide","/reference/api","6.reference/1.api",{"title":177,"icon":126,"defaultOpen":65,"path":178,"stem":179,"children":180,"page":65},"Benchmarks","/benchmarks","7.benchmarks",[181,186,190],{"title":182,"path":183,"stem":184,"icon":185},"Benchmark Concepts","/benchmarks/benchmark-concepts","7.benchmarks/0.benchmark-concepts","i-lucide-book-open",{"title":187,"path":188,"stem":189,"icon":126},"Benchmarking & Load Testing","/benchmarks/benchmarking-load-testing","7.benchmarks/1.benchmarking-load-testing",{"title":191,"path":192,"stem":193,"children":194,"icon":203},"Benchmark Results","/benchmarks/benchmark-results","7.benchmarks/2.benchmark-results",[195,199],{"title":196,"path":197,"stem":198,"icon":97},"Local Benchmark Comparison","/benchmarks/benchmark-results/local-benchmark-comparison","7.benchmarks/2.benchmark-results/1.local-benchmark-comparison",{"title":200,"path":201,"stem":202,"icon":26},"Redis + Hybrid Benchmark Comparison","/benchmarks/benchmark-results/redis-benchmark-comparison","7.benchmarks/2.benchmark-results/2.redis-benchmark-comparison","i-lucide-chart-no-axes-combined",{"title":205,"path":206,"stem":207,"children":208,"icon":210,"defaultOpen":65},"Changelog","/changelog","8.changelog/0.index",[209,211,216,220,224,228,232,236],{"title":205,"path":206,"stem":207,"icon":210},"i-lucide-scroll",{"title":212,"path":213,"stem":214,"icon":215},"v2.2.1","/changelog/v2-2-1","8.changelog/1.v2-2-1","i-lucide-tag",{"title":217,"path":218,"stem":219,"icon":215},"v2.2.0","/changelog/v2-2-0","8.changelog/2.v2-2-0",{"title":221,"path":222,"stem":223,"icon":215},"v2.1.0","/changelog/v2-1-0","8.changelog/3.v2-1-0",{"title":225,"path":226,"stem":227,"icon":215},"v2.0.0","/changelog/v2-0-0","8.changelog/4.v2-0-0",{"title":229,"path":230,"stem":231,"icon":215},"v1.1.0","/changelog/v1-1-0","8.changelog/5.v1-1-0",{"title":233,"path":234,"stem":235,"icon":215},"v1.0.1","/changelog/v1-0-1","8.changelog/6.v1-0-1",{"title":237,"path":238,"stem":239,"icon":215},"v1.0.0","/changelog/v1-0-0","8.changelog/7.v1-0-0",{"id":241,"title":141,"authors":242,"badge":242,"body":243,"date":242,"description":435,"extension":436,"links":242,"meta":437,"navigation":438,"path":142,"seo":439,"stem":143,"__hash__":440},"docs/5.actix-web/8.performance.md",null,{"type":244,"value":245,"toc":427},"minimark",[246,251,260,357,374,377,393,397,412,416,419],[247,248,250],"h2",{"id":249},"cost-per-request","Cost per request",[252,253,254,255,259],"p",{},"Time per request through actix's test harness, with a no-op handler, on an Apple M2 Pro\n(",[256,257,258],"code",{},"cargo bench --bench overhead --features redis"," in the actix-trypema repository, Redis in\nDocker on the same machine):",[261,262,263,282],"table",{},[264,265,266],"thead",{},[267,268,269,273,276,279],"tr",{},[270,271,272],"th",{},"Limiter",[270,274,275],{},"Distributed",[270,277,278],{},"Time per request",[270,280,281],{},"Added over no limiter",[283,284,285,299,316,329,343],"tbody",{},[267,286,287,291,294,297],{},[288,289,290],"td",{},"no limiter",[288,292,293],{},"—",[288,295,296],{},"545 ns",[288,298,293],{},[267,300,301,304,310,313],{},[288,302,303],{},"actix-governor",[288,305,306],{},[307,308,309],"strong",{},"no",[288,311,312],{},"611 ns",[288,314,315],{},"+66 ns",[267,317,318,321,323,326],{},[288,319,320],{},"actix-trypema, local",[288,322,309],{},[288,324,325],{},"673 ns",[288,327,328],{},"+128 ns",[267,330,331,334,337,340],{},[288,332,333],{},"actix-trypema, hybrid",[288,335,336],{},"yes, eventually consistent",[288,338,339],{},"658 ns",[288,341,342],{},"+113 ns",[267,344,345,348,351,354],{},[288,346,347],{},"actix-trypema, Redis",[288,349,350],{},"yes",[288,352,353],{},"182 µs",[288,355,356],{},"one Redis round trip",[358,359,360],"callout",{"icon":11},[252,361,362,363,366,367,370,371,373],{},"actix-governor is ",[307,364,365],{},"not"," a distributed rate limiter: each process keeps its own counters, so\n",[256,368,369],{},"n"," instances admit ",[256,372,369],{}," times the limit. Compare it with the local backend; the hybrid and\nRedis backends share one limit across instances.",[252,375,376],{},"How to read the table:",[378,379,380,384,387,390],"ul",{},[381,382,383],"li",{},"The total includes building the test request and running the handler (the \"no limiter\" row);\nthe added column is the limiter's own cost.",[381,385,386],{},"Each figure is the median of three runs; between runs the added cost varied by up to 15 ns.",[381,388,389],{},"One client sends every request, the limit is never reached, and rate limit headers are off,\nso only the admit path is measured.",[381,391,392],{},"The Redis figure is dominated by the round trip to a local Docker Redis; your network sets its\nreal cost.",[247,394,396],{"id":395},"what-keeps-it-fast","What keeps it fast",[378,398,399,406,409],{},[381,400,401,402,405],{},"With headers off and without the ",[256,403,404],{},"metrics"," feature, the local and hybrid admit paths allocate\nnothing; tests in the repository enforce it.",[381,407,408],{},"Keys are built in a fixed 256-byte buffer, and IPv4 addresses are formatted without the\nstandard formatting machinery.",[381,410,411],{},"The hybrid backend decides most requests from local state without awaiting, so it skips the\nboxed future and timeout that requests needing Redis use.",[247,413,415],{"id":414},"accuracy-under-load","Accuracy under load",[252,417,418],{},"Speed is only half of a rate limiter. In Trypema's stress harness (16 threads for 30 seconds on\none hot key, limited to 1,000 requests per second over a 10-second window), governor admitted\n40,000 requests and trypema admitted 30,008. Governor's GCRA bucket starts full, so it allows a\nburst of a whole window on top of the rate; trypema's sliding window holds the rate from the first\nrequest.",[252,420,421,422,426],{},"For provider-level throughput across many keys, including redis-cell, see\n",[423,424,425],"a",{"href":192},"Benchmark results",".",{"title":428,"searchDepth":429,"depth":430,"links":431},"",1,2,[432,433,434],{"id":249,"depth":430,"text":250},{"id":395,"depth":430,"text":396},{"id":414,"depth":430,"text":415},"What actix-trypema adds to each request, compared with actix-governor, and how it was measured.","md",{},{"icon":144},{"title":141,"description":435},"3jJqgbKUzaYzyTq_WLM_lF7KbtXQm5R5E0GHk3ZC09Q",[442,444],{"title":137,"path":138,"stem":139,"description":443,"icon":81,"children":-1},"Try limits in shadow mode, read each limiter's decision in handlers, export metrics, and reset or change individual keys.",{"title":152,"path":153,"stem":154,"description":445,"icon":155,"children":-1},"Validated settings controlling windows, grouping, suppression, cleanup, and synchronization.",1791663191626]