Closed CryZe closed 7 years ago
Odd, indeed. I suppose you have tried multiple requests and that it's consistent... I can't reproduce it on Linux, with cargo run --release --example hello_world
in the Rustful repo, using Firefox (dev tools reports 2-3 ms). Would you mind giving me some details? I'm, in particular, interested in your project setup and the name of that HTTP request tool, so I can try to reproduce the problem.
It's this REST client for Chrome: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo
Using curl is a bit faster, but still much slower than my larger project (~200 ms vs. instant).
I see no latencies when using that extension, either, but I suppose we can rule that out by now. Are any of the optional features disabled? Also, is keep-alive enabled in your Rustless based project? It's disabled by default in Rustful.
Keep-Alive seems to be disabled in my Rustless project (well, I never enabled it anywhere and I don't see it in the responses). I disabled all optional features of Rustful, but it happens without them disabled too.
Keep-Alive is considered default in HTTP/1.1, so it's on, unless the Connection
header says otherwise. It says close
in your screen shot, for example. I'm far from a Rustless expert, but the way I understand it is that it "piggy-backs" on Iron and it seems like Iron has keep-alive on by default. I'm reaching for whatever I can think of, right now, but perhaps the closed connection screws with something in the data transfer.
Try setting the keep_alive
field in Server
to Some(KeepAlive { ... })
with whatever timeout you find appropriate (I honestly don't know what the best timeout is) and see if there's a difference. See the docs for how to use KeepAlive
, and you can probably just set free_threads
to 0, as long as it's less than the total number of threads.
Have you had any luck with this?
Closing due to inactivity. Feel free to reopen if the problem persists.
I'm not sure what's up, but even the most basic examples take a minimum of 1 second to respond:
Rustless responds in 2 milliseconds in a much larger program (even with database lookups and stuff), so 1 second seems like a major bug.