Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to cause each new request to run in a new task/thread? #158

Open
wez opened this issue Nov 24, 2024 · 0 comments
Open

How to cause each new request to run in a new task/thread? #158

wez opened this issue Nov 24, 2024 · 0 comments

Comments

@wez
Copy link

wez commented Nov 24, 2024

I've been looking through axum, tower and axum-server docs this evening, but I couldn't find anything concrete: there's a lot of abstractions and I'm going cross eyed!

My goal is to go beyond saturating a single core when processing requests. I have a very hot route that uses the Json extractor and that seems to be causing the acceptor thread/task to bear the cost of that json parsing before it calls into my implementation. I'd like to push the request out to another thread before the extractors are invoked so that I can make better use of the available cores on my system.

I think I want to wrap my Router up in a tokio::spawn somehow, I just don't have a good sense of specifically what to do, or where to put it.

What do you recommend as a way to achieve this with axum-server?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant