Skip to content

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

Description

@wez

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions