poem icon indicating copy to clipboard operation
poem copied to clipboard

how to optimize Poem's performance (Req/sec)?

Open rxdiscovery opened this issue 1 year ago • 3 comments

Hello,

I find Poem a very ergonomic framework, I've even migrated several projects to Poem, mainly because it offers very good support for OpenAPI 3, but there is one small point that bothers me, it can be optimized to rival the TOP 3 web frameworks (Req/sec performance) that dominate the Rust universe. it's in the TOP 10, which is already a very good ranking, but the difference with the TOP 3 is approximately ~15,000 Req/sec.

https://web-frameworks-benchmark.netlify.app/result?asc=0&l=rust&order_by=level512

my question is, how to optimize Poem to gain a little performance :

  • doesn't poem use all threads?
  • should we add the possibility of tuning the Tokio runtime?
  • is it related to the code? due to the use of Arc and Mutex?

I'd like to participate in the optimization of this beautiful framework, the first thing I notice is that Poem doesn't let you configure the number of Workers, like ActixWeb for example. Is there any way of adding this feature?

in any case, you've done a great job, and the beauty of this framework fills the small performance gap.

rxdiscovery avatar Jul 25 '23 17:07 rxdiscovery

I believe the gap comes from the async-trait, which requires boxing every call to an async method.

sunli829 avatar Jul 28 '23 15:07 sunli829

I believe the gap comes from the async-trait, which requires boxing every call to an async method.

do you think rust "1.74" with native support for async traits will have a positive impact on performance?

rxdiscovery avatar Aug 02 '23 21:08 rxdiscovery

absolute😁

sunli829 avatar Aug 02 '23 22:08 sunli829