Git Product home page Git Product logo

rollout's Introduction

Rollout

Rollout allows you to flip features quickly and easily. It relies on distributed erlang and uses LWW-Register and Hybrid-logical clocks to provide maximum availability. Rollout has no dependency on an external service such as redis which means rollout feature flags can be used in the critical path of a request with minimal latency increase.

Installation

def deps do
  [
    {:rollout, "~> 0.2"}
  ]
end

Usage

Rollout provides a simple api for enabling and disabling feature flags across your cluster. A feature flag can be any term.

# Check if a feature is active
Rollout.active?(:blog_post_comments)
# => false

# Activate the feature
Rollout.activate(:blog_post_comments)

# De-activate the feature
Rollout.deactivate(:blog_post_comments)

You can also activate a feature a certain percentage of the time.

Rollout.activate_percentage(:blog_post_comments, 20)

You can run this function on one node in your cluster and the updates will be propogated across the system. This means that updates to feature flags may not be instantaneous across the cluster but under normal conditions should propogate quickly. This is a tradeoff I've made in order to maintain the low latency when checking if a flag is enabled.

How does Rollout work?

Rollout utilizes Groot for replicating flags across your cluster. Please look at the groot docs for implementation details.

Caveats

Rollout relies on your nodes being connected through distributed erlang. If you are running your application on more than one node and you are not clustering than your changes won't propogate. You will need to run the command on all nodes but in practice you'll probably just want to look for an alternative solution.

Flags are not maintained in between node restarts. New nodes added to your cluster will be caught up on the current state. But if you bring up an entirely new cluster your flags will revert to their default states. You can mitigate this problem by setting defaults for each flag in your Application.start/2 callback.

Changes made on one node will take time to replicate to other nodes in the cluster. But, its a safe operation to run the same command on multiple nodes. Feature flags will merge cleanly and always default to the latest change seen.

Should I use this?

If you're already running a clustered application then this should be a reasonable solution if you need feature flags.

Future work

I'd like to implement an alternative storage engine for use in non-clustered environments, preferably using a fast storage engine such as redis. If anyone wants to submit that PR I'd love to take a look at it.

rollout's People

Contributors

keathley avatar dependabot-preview[bot] avatar dependabot[bot] 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.