Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

grace

Graceful restart & zero downtime deploy for Go servers.

Subscribe to updates I use grace


Statistics on grace

Number of watchers on Github 3489
Number of open issues 3
Average time to close an issue 25 days
Main language Go
Average time to merge a PR 6 days
Open pull requests 3+
Closed pull requests 4+
Last commit over 2 years ago
Repo Created over 7 years ago
Repo Last Updated over 1 year ago
Size 85 KB
Homepage https://godoc.org...
Organization / Authorfacebookgo
Contributors3
Page Updated
Do you use grace? Leave a review!
View open issues (3)
View grace activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating grace for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

grace Build Status

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.

Usage

Demo HTTP Server with graceful termination and restart: https://github.com/facebookgo/grace/blob/master/gracedemo/demo.go

  1. Install the demo application

    go get github.com/facebookgo/grace/gracedemo
    
  2. Start it in the first terminal

    gracedemo
    

This will output something like:

    2013/03/25 19:07:33 Serving [::]:48567, [::]:48568, [::]:48569 with pid 14642.
  1. In a second terminal start a slow HTTP request

    curl 'http://localhost:48567/sleep/?duration=20s'
    
  2. In a third terminal trigger a graceful server restart (using the pid from your output):

    kill -USR2 14642
    
  3. Trigger another shorter request that finishes before the earlier request:

    curl 'http://localhost:48567/sleep/?duration=0s'
    

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.

Documentation

http.Server graceful termination and restart: https://godoc.org/github.com/facebookgo/grace/gracehttp

net.Listener graceful termination and restart: https://godoc.org/github.com/facebookgo/grace/gracenet

grace open issues Ask a question     (View All Issues)
  • about 4 years go get on windows failed
  • over 4 years Expose logger
grace open pull requests (View All Pulls)
  • handle closed listeners
  • Implement a Windows fallback
  • Expose logger
grace questions on Stackoverflow (View All Questions)
  • OCILogon during Grace Period - ORA-28002
  • JIRA: Send issue comment notifications after grace period for edits
  • varnish 4 grace time depending on backend health
  • Oracle password expiry and grace period handling using C# client
  • Grace Period? - AWS EC2 Container Service and Elastic Load Balancers
  • AWS autoscale ELB status checks grace period
  • Effective grace period with usage counter and LVL
  • Boost grace period on varnish when error 500 ocurred
  • Inapp Billing - Trial and grace period for test purchases
  • JPanel API: Perhaps the stupidest to ever grace Stackoverflow
  • When will the YouTube v2 (comments) deprecation grace period end?
  • change Oracle user account status from EXPIRE(GRACE) to OPEN
  • What happens to the api calls that v2 comments require during the grace period?
  • Oracle password expiry and grace period handling using Java, Oracle JDBC
  • partitioned(grace) hash-join - number of buckets
  • Trying to decipher this varnish vcl block (pertaining to grace)
  • Grace period slider in a high-frequency live card?
  • Command line plotting of xvg using grace
  • disable compaction and gc grace on cassandra
  • Stop Terminal Server Grace Period
  • Grace period on signal
  • Trial version grace period
  • How to compute the time difference with grace period using php codeigniter
  • Set oracle user password expiry/grace period
  • How to affect the "grace margin" of map.fitBounds()
  • Dynamically allocate a data.frame with grace
  • checking for a grace period of 30days in dates yii
  • google glass- How to implement grace period when option is selected?
  • How to manage R extension / package documentation with grace (or at least without pain)
  • ADFS 2.0 Token-Signing certificate grace period
grace list of languages used
Other projects in Go