-
SummaryIn the Axum framework, if an asynchronous task takes a long time to execute, it directly blocks user requests and causes timeouts. What is the best optimization solution for this? I tried using a queue, but the optimization improvement is limited—even after dequeuing, the asynchronous task still takes too long and ends up blocking user requests. axum version0.8.4 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
That really depends on what exactly you're doing. If you're blocking the Tokio thread in your handlers, the solution is to use asynchronous alternatives instead or to use If you're not blocking the thread, timeouts like you're describing shouldn't happen. If you can minimize an example, we can take a closer look. |
Beta Was this translation helpful? Give feedback.
-
If I replace it with a CPU that has more cores and higher frequency, the performance will be better and it can handle 100 concurrent requests without timeouts. |
Beta Was this translation helpful? Give feedback.
The conclusions drawn from a week of stress testing:
thanks.