Increasing number of routers in FastAPI #6811
-
|
Hi, I have a concern. How good of an idea is it to have separate router for each endpoint and how does it affect performance? For example, if I am going to build 100 endpoints with 100 different independent python functions, what is the best way to build architecture for HIGH PERFORMANCE. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
It's a good idea, and it only affects startup time. |
Beta Was this translation helpful? Give feedback.
-
|
The main performance hit should actually be in your code and not in how you structure the routers. If you want to squeeze performance, use async functions with async-compatible libraries, and do the output data conversion yourself (instead of having the default by FastAPI), and return an
|
Beta Was this translation helpful? Give feedback.
-
|
Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs. |
Beta Was this translation helpful? Give feedback.
It's a good idea, and it only affects startup time.