Cached routes significantly decrease throughput #2558
Unanswered
InstantlyMoist
asked this question in
Q&A
Replies: 2 comments 4 replies
0 replies
|
Hi dear @InstantlyMoist. You should use caching when the computation cost is more than cache retrieval like when making a costly database query or long-time fetch. In the In the We can improve Nitro DX though to show some info in about it ~> #2559 |
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Environment
Node v22.2.0
Nitro latest (as of posting)
Reproduction
https://github.com/InstantlyMoist/nitro-throughput
Describe the bug
Currently it appears that using a cached event handler reduces the throughput of a route by around 40% this is tested with
https://github.com/fomalhaut88/winrk but can also be tested with wrk for linux.
My findings (based on reproduction)
For all endpoints I used the same settings (t = 4, d = 10, c = 200), tested 3 times
/simple = ~16k requests per second
/simple_cached = ~11k requests per second
/big_payload = ~100 requests per second
/big_payload_cached = ~60 request per second
While nitro's throughput seems to significantly decrease with a higher payload, it seems to decrease even further with the use of a cached event route.
Additional context
No response
Logs
No response
All reactions