actix-web: multipart upload is very slow
I have compiled https://github.com/actix/examples/blob/master/multipart/src/main.rs as is (without any changes) and issues:
$ time curl localhost:8080 -F upload=@src/main.rs
[3380]
real 0m1.022s
user 0m0.006s
sys 0m0.005s
It took over a second to process pretty small file. What could be the reason?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 34 (14 by maintainers)
Commits related to this issue
- Send HTTP/1.1 100 Continue if request contains expect: continue header #634 — committed to actix/actix-web by invalid-email-address 6 years ago
- Optimize multipart handling #634, #769 — committed to actix/actix-web by fafhrd91 5 years ago
fixed in master
i found inefficiencies in implementation, i will update impl in next version.
@z0mbie42 you can use
web::block
for blocking operation.Hi,
@fafhrd91 is totally right, using the multipart example code is wrong because it use synchronous IO.
Using a
Vec
shows far better performances (~2.5 sec for a235MB
.mp3
vs ~15sec using sync IO, in release mode).But, I wasn’t able to find a good way to handle a multipart upload because
tokio::fs
does not work with actix (actix/actix#181) and all in memory is not manageable in real life.On the other hand the other points raised are still valid.
fixed.
@Dowwie you should do proper performance checks before post any results
2018-12-23T18:22:19Z INFO actix_web::middleware::logger] 127.0.0.1:9760 “POST / HTTP/1.1” 200 6 “-” “curl/7.54.0” 0.000731****