Consider avoiding BaseHTTPMiddleware as parent of SlowAPIMiddleware
Describe the bug Thanks for your package, really useful. I made a collection of performance optimisations based on my real word examples. You can see them here: https://kisspeter.github.io/fastapi-performance-optimization/
One of the most impactful (negative on performance) item was the usage of BaseHTTPMiddleware the parent of your SlowAPIMiddleware. Therefore the global rate limiter impacts the app performance negatively.
To Reproduce
https://kisspeter.github.io/fastapi-performance-optimization/middleware
Expected behavior SlowAPIMiddleware with minimal or no overall performance impact
Screenshots If applicable, add screenshots to help explain your problem.
Your app (please complete the following information):
- fastapi or starlette - irrelevant here
- slowapi version - latest impacted
Additional context Add any other context about the problem here.
Hi @KissPeter thanks for sharing this! Did you do any checks specifically on slowapi?
@KissPeter did you have a look at the ASGI middleware that doesn't inherit from BaseHTTPMiddleware ? see docs here: https://github.com/laurentS/slowapi/blob/master/docs/examples.md#wsgi-vs-asgi-middleware