|Number of watchers on Github||3489|
|Number of open issues||3|
|Average time to close an issue||25 days|
|Average time to merge a PR||6 days|
|Open pull requests||3+|
|Closed pull requests||4+|
|Last commit||over 3 years ago|
|Repo Created||about 8 years ago|
|Repo Last Updated||about 2 years ago|
|Organization / Author||facebookgo|
|Do you use grace? Leave a review!|
|View open issues (3)|
|View grace activity|
|View on github|
|Fresh, new opensource launches 🚀🚀🚀|
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Package grace provides a library that makes it easy to build socket based servers that can be gracefully terminated & restarted (that is, without dropping any connections).
It provides a convenient API for HTTP servers including support for TLS, especially if you need to listen on multiple ports (for example a secondary internal only admin server). Additionally it is implemented using the same API as systemd providing socket activation compatibility to also provide lazy activation of the server.
Demo HTTP Server with graceful termination and restart: https://github.com/facebookgo/grace/blob/master/gracedemo/demo.go
Install the demo application
go get github.com/facebookgo/grace/gracedemo
Start it in the first terminal
This will output something like:
2013/03/25 19:07:33 Serving [::]:48567, [::]:48568, [::]:48569 with pid 14642.
In a second terminal start a slow HTTP request
In a third terminal trigger a graceful server restart (using the pid from your output):
kill -USR2 14642
Trigger another shorter request that finishes before the earlier request:
If done quickly enough, this shows the second quick request will be served by the new process (as indicated by the PID) while the slow first request will be served by the first server. It shows how the active connection was gracefully served before the server was shutdown. It is also showing that at one point both the new as well as the old server was running at the same time.
http.Server graceful termination and restart:
net.Listener graceful termination and restart: