chris-morgan / rust-http

Completely OBSOLETE Rust HTTP library (server and client)
Other
390 stars 110 forks source link

Poor performance when HTTP keep-alive is disabled #160

Open bnoordhuis opened 10 years ago

bnoordhuis commented 10 years ago

I observe that throughput for a simple 'Hello, world' server drops by about 10x when the client does not use or support HTTP keep-alive. My 8-core i7 manages about ~28k req/s with keep-alive and ~2.4k req/s without.

I expected some TCP setup/teardown overhead but, according to perf record, most CPU time can be traced back to the spawn() call in src/http/server/mod.rs. I see expensive system calls to clone(), mmap(), mprotect(), and so on, all originating from imp::thread::create() from the standard library. A thread pool would probably help alleviate that.