Hi! I am using the Iron web framework. It is synchronous, but this is perfectly fine by me: my
Handles don’t have any intrinsic async behavior: they just parse request, read some data from an embedded database and write the output (i.e, they are CPU bound). The only real async behavior comes from http itself: that is, if a dozen slow clients connect to my server simultaneously, they’ll saturate all threads from threadpool which will be waiting for bytes from HTTP connections to arrive. I’d like to avoid this without making my whole server async.
My understanding is that the common solution to this problem is to set-up a reverse proxy like nginx in front of my server, which would deal with slow clients in a resource efficient non-blocking manner, allowing my own server to spend time/threads only on the actual complete request processing. However this approach comes with some operational hosts: I can’t just
cargo run anymore, I need to install, configure and run nginx separately.
Is there any way to run a similar reverse-proxy directly in-process? Or am I completely misunderstanding the whole think about async, reverse proxies and stuff ?