This article overviews the process for configuring automatic load shedding for an A record. Once configured, NS1 will automatically steer traffic away from an overloaded IP to a secondary IP (based on the specified threshold).
There are four steps in the configuration process:
- Create a new record on which to apply the load shedding configuration (or edit an existing record.)
- Setup a new API data feed where load data is ingested.
- Send load data updates via API.
- Configure the record to use the shed load filter.
This example uses an A Record (testexample.zone with two answers configured. The first, 1.1.1.1, is located in Buffalo, New York. The second, 2.2.2.2, is located in London, UK.)
Step 1: Create a new record.
-
In the NS1 portal, click on the Zones tab, and select the zone you will be working under.
-
Click Add Record.
-
Enter the subdomain or leave blank to apply the record at the root level.
-
Under Record Type, select "A" from the drop-down menu.
-
Enter the TTL value.
Note: We recommend 60 seconds. A lower TTL may be ignored by some DNS recursors, and a much higher one will limit the effectiveness of your failover.
-
Set the answers for this record.
-
Click Save Changes.
Step 2: Setup a new API data feed.
-
In the NS1 portal, navigate to the Integrations tab.
-
Under Data Sources, click Add a Data Source.
-
Select the NS1 API source.
-
Enter a name for the data source. (In this example, the sources are named "Buffalo-NY" and "London-UK.")
-
Select Create Data Source, and then confirm by clicking "Create a new feed with this data source."
-
Enter a name for internal reference and a label, and then click Submit.
-
Repeat this process to create data sources and feeds.
Step 3: Send load metrics to NS1 via API.
- In the NS1 portal, click the Integrations tab. Notice the "Feed URL" for each data feed listed under Incoming Feeds.
- Use the following API call to send load metrics to NS1 from each server, replacing $APIKEY with your unique key generated via the NS1 portal, and replacing the loadavg value with the actual load value:
curl -X POST -H "X-NSONE-Key: $APIKEY" -d '{"London-UK":{"loadavg":5}}' https://api.nsone.net/v1/feed/5b85d99798c5e2ba330d3b15c1595f42
Note: In this example, for the "Buffalo" server, you would just replace London-UK with the label of the Buffalo feed: Buffalo-NY. If you're testing and would like to see generate an example response, add -i to cURL command. Additional methods and examples of interacting with our API can be found at https://ns1.com/api.
Step 4: Configure the record.
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.
-
Add the Shed Load filter and make sure it is configured for Load Average.
-
Add the applicable load average data feeds created earlier to each answer's load average metadata.
-
Add a low watermark and high watermark metadata to each of your answers.
-
Add any other filters you wish to use in conjunction with Shed Load. (In this example, we added the Up and Select First N filters.)
-
Click Save.
Comments
0 comments
Article is closed for comments.