Coder Social home page Coder Social logo

cloudflare / shellflip Goto Github PK

View Code? Open in Web Editor NEW
201.0 7.0 6.0 30 KB

Graceful process restarts in Rust

Home Page: https://blog.cloudflare.com/oxy-the-journey-of-graceful-restarts/

License: BSD 3-Clause "New" or "Revised" License

Rust 100.00%
graceful-shutdown process restart rust server systemd

shellflip's Introduction

shellflip

crates.io docs.rs

Graceful process restarts in Rust.

This crate facilitates upgrading or reconfiguring a service without disrupting existing connections. This is achieved by forking the process and communicating a small amount of state between the old and new processes; once the new process has started successfully the old process may terminate.

This crate has the following goals:

  • No old code keeps running after a successful upgrade (and inevitable shutdown of the old process)
  • The new process has a grace period for performing initialisation
  • Crashing during initialisation is OK
  • Only a single upgrade is ever run in parallel
  • It is possible for the user/process initiating the upgrade to know if the upgrade succeeded

Inspired by the tableflip go package but not a direct replacement.

Using the library

A full example is given in the restarter example service.

The main struct of interest is RestartConfig which has methods for detecting or initiating restart. For shutting down a restarted process, the ShutdownCoordinator provides the means for both signalling a shutdown event to spawned tasks, and awaiting their completion.

License

BSD licensed. See the LICENSE file for details.

πŸ¦€γƒŽ( ΒΊ _ ΒΊγƒŽ) - respect crables!

shellflip's People

Contributors

cbranch avatar chungthuang avatar inikulin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.