Connection recycler using ConnState.
Rotating clients regularly to avoid pinning
persistent clients to a single node. Especially
targetted for an ELB => [EC2, EC2...]
scenario
where hyper active clients get pinned to specific
EC2 instances.
// Recycle connections after 5 minutes.
server := &http.Server{
Addr: ":8000",
ConnState: greene.New(time.Minute * 10),
}
server.ListenAndServe()
Part of the motivation in writing greene
was to
ephemeralize the lifecycle management of servers --
which obviously includes graceful shutdown.
It should just play nice with graceful:
server := &graceful.Server{
Server: &http.Server{
Addr: ":8000",
Handler: mux,
},
Timeout: time.Second * 10,
ConnState: greene.New(time.Minute * 10),
}
server.ListenAndServe()
MIT