Load Shedding

This article describes an automatic load shedding configuration for an A record, in which NS1 is configured to automatically shift traffic to a secondary IP if certain load thresholds are met.

There are four steps:

  1. Create a record that will use the load shedding configuration
  2. Setup a new API data feed where you can send your load data
  3. Send load data updates via the API
  4. Configure the record to use the Shed Load filter

This example will be illustrated using an A Record (testexample.web) with two answers configured. The first,, is located in Buffalo, New York. The second,, is located in London, UK.

Create an A record

  1. Click on the Zones tab and select the Zone you will be working under.
  2. Click on the Add Record button.
  3. Enter the domain (e.g. test.example.web)
  4. Select the record type as A
  5. Enter your desired TTL. We recommend 60 seconds. A much lower TTL will be ignored by some DNS recursors; and a much higher one will limit the effectiveness of your failover.
  6. Set the Answers for this record
  7. Click on the Save Changes button

Setup a New API Data Feed to Accept Your Load Data

  1. Go to the Integrations tab
  2. In the "Data Sources" tab select 'Add a Data Source'. 
  3. Select the NS1 API source 
  4. Enter a name for the Data Source (in our example the sources are named 'Buffalo-NY' and 'London-UK'.)

  5. Select 'Create Data Source' and then proceed to 'Create a new feed with this Data Source'. Enter a name for internal reference and a label and submit.

  6. Repeat this process to create Data Sources and Feeds for both of our answers ('Buffalo-NY' and 'London-UK').

Send NS1 Your Load Metrics

On the 'Incoming Feeds' page under the Integrations tab, you'll see there's a Feed URL for each Data Feed:

You can send us load metrics for each server with the following call, replacing the asterisks with your API key, and the example value "5" with whatever the current load is:

curl -X POST -H "X-NSONE-Key: **********************" -d '{"London-UK":{"loadavg":5}}' 

For the Buffalo server you'll just replace London-UK with the label of the Buffalo feed: Buffalo-NY. If you're testing and you'd like to see what response our API is giving you can add -i to curl.
Additional ways and examples of interacting with our API can be found at https://ns1.com/api

Configure the Record

  1. Choose which of the three metrics you'd like the Shed Load filter to act on (load average, average connections or average requests). In this example we'll use load average.
  2. Add the Shed Load filter and make sure it is configured for Load Average.
  3. Add the applicable load average datafeeds we created earlier to each answer's load average metadata. 
  4. Add low watermark and high watermark metadata to each of your answers (in this example we'll use 3 and 8, respectively)
  5. Add any other filters you wish to use in conjunction with Shed Load (in our example we have added Up and Select First N)
  6. Click the Save button

Request a Demo

Contact Us

Get Pricing