Actix Web
Performance
What actix-trypema adds to each request, compared with actix-governor, and how it was measured.
Cost per request
Time per request through actix's test harness, with a no-op handler, on an Apple M2 Pro
(cargo bench --bench overhead --features redis in the actix-trypema repository, Redis in
Docker on the same machine):
| Limiter | Distributed | Time per request | Added over no limiter |
|---|---|---|---|
| no limiter | — | 545 ns | — |
| actix-governor | no | 611 ns | +66 ns |
| actix-trypema, local | no | 673 ns | +128 ns |
| actix-trypema, hybrid | yes, eventually consistent | 658 ns | +113 ns |
| actix-trypema, Redis | yes | 182 µs | one Redis round trip |
actix-governor is not a distributed rate limiter: each process keeps its own counters, so
n instances admit n times the limit. Compare it with the local backend; the hybrid and
Redis backends share one limit across instances.How to read the table:
- The total includes building the test request and running the handler (the "no limiter" row); the added column is the limiter's own cost.
- Each figure is the median of three runs; between runs the added cost varied by up to 15 ns.
- One client sends every request, the limit is never reached, and rate limit headers are off, so only the admit path is measured.
- The Redis figure is dominated by the round trip to a local Docker Redis; your network sets its real cost.
What keeps it fast
- With headers off and without the
metricsfeature, the local and hybrid admit paths allocate nothing; tests in the repository enforce it. - Keys are built in a fixed 256-byte buffer, and IPv4 addresses are formatted without the standard formatting machinery.
- The hybrid backend decides most requests from local state without awaiting, so it skips the boxed future and timeout that requests needing Redis use.
Accuracy under load
Speed is only half of a rate limiter. In Trypema's stress harness (16 threads for 30 seconds on one hot key, limited to 1,000 requests per second over a 10-second window), governor admitted 40,000 requests and trypema admitted 30,008. Governor's GCRA bucket starts full, so it allows a burst of a whole window on top of the rate; trypema's sliding window holds the rate from the first request.
For provider-level throughput across many keys, including redis-cell, see Benchmark results.

