actix / actix-web

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.
https://actix.rs
Apache License 2.0
21.44k stars 1.66k forks source link

actix-http: play with allowing bytes passthrough in the h1 encoder #3368

Open asonix opened 4 months ago

asonix commented 4 months ago

PR Type

?????Bug?????? (reduces memory use)

PR Checklist

Overview

This is just me playing around with how to possibly avoid growing a persistent buffer to incredibly large sizes by allowing already-allocated Bytes types to pass through directly to IO in the h1 dispatcher

Comments very welcome

relates to https://github.com/actix/actix-web/issues/3367

asonix commented 4 months ago

I added a couple additional endpoints to the actix-web example in actix-http so I could run wrk against it

CPU: 12th Gen Intel(R) Core(TM) i5-12400 system: Linux firestar 6.9.1 #1-NixOS SMP PREEMPT_DYNAMIC Fri May 17 10:18:09 UTC 2024 x86_64 GNU/Linux

command: wrk -t12 -c400 -d30s $endpoint

for / and /medium performance is similar to the master branch for /large performance is significantly improved

note that this isn't testing streaming bodies