I was thinking about running >1 processes behind a proxy/load
balancer. Then signaling 1 of the processes to stop accepting new
requests and to exit gracefully. Restarting this process and then
continue with the other one(s).
But is there a way in the http package to stop accepting new
requests? Do I need to write my own ListenAndServe?
--
Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/
<!--[if IE 6]><script>for(x in document.open);</script><![endif]-->
I did something like this in Skynet [1] but used Go as the load balancer. Rather than telling http to quit listening, I told the load balancer to quit sending traffic. It accomplished the same thing.
Brian
How would you solve the problem of a hot swap of a web app?
I was thinking about running >1 processes behind a proxy/load
balancer. Then signaling 1 of the processes to stop accepting new
requests and to exit gracefully. Restarting this process and then
continue with the other one(s).
But is there a way in the http package to stop accepting new
requests? Do I need to write my own ListenAndServe?
That was easy. And looks dirty (accessing ln in the go routine).
But it's the end of this process anyway.
Thanks.
http://golang.org/pkg/http/#Server.ListenAndServe with a small
extra. I like it.
Maybe I modify it a bit to use some OS signal via the Channel
signal.Incoming from "os/signal". os.UnixSignal(2) (SIGINT)
sounds reasonable for this.
This is huge. I'm a bit overwhelmed by it.
Is this something that has to be integrated from the very
beginning or is it easy enough to refit existing projects?
I'm definitely putting this on a list.
It's probably overkill for most web applications. Skynet is designed to scale by adding more processes, and to be tolerant to crashing or disappearing nodes. That's why the router and service engines are in different processes.
Brian