Skip to content

Instantly share code, notes, and snippets.

@almet
Forked from Natim/README.rst
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save almet/617da147645851a6c4e3 to your computer and use it in GitHub Desktop.
Save almet/617da147645851a6c4e3 to your computer and use it in GitHub Desktop.

Ramp Up

The problem

The idea of the ramp up is to have a scalable way to activate a software feature slowly so that the scale is handled.

If you have let say 10 million users and you want to launch a most wanted feature. If you activate it the same day for this amount of user it may crash.

But if you can handle the load and have the user to arrive one after the other you can handle the load an activate the right number of servers.

How does it works?

The Ramp Up system is one way to handle that.

The idea is to give a number, that will be in between 1 and 10000 for instance, and if the feature is not activated at startup choose a random number between these two values. For instance 6423

Then you get the ramp-up number and you activate the feature if the random number is below the ramp-up value.

One scalable way to do so is to use the DNS, it is scalable and free and you can configure the update time window quite easily.

I want to get 1/20 of the users to get the feature activated at startup. So I have configured my TXT field to be "rampup=500"

Test you DNS configuration

host -t txt trunat.fr

You can use the python script to get it programatically.

# pip install dnspython
import dns.resolver
answer = dns.resolver.query("trunat.fr", "TXT")
for data in answer:
key, value = data.to_text().strip('"').split("=")
if key == "rampup":
print int(value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment