About the Shed Load filter
Part of the NS1 Filter Chain, the Shed Load filter allows users to distribute traffic intelligently across multiple endpoints (represented by answers within the record) based on the latest load-related data for each endpoint. After configuring a record and its associated answers, users can apply the Shed Load filter to their Filter Chain configuration and then modify the answer metadata to fine-tune traffic steering behavior. Upon each query, if the record’s Filter Chain configuration includes the Shed Load filter, the latest load metric reported for each answer is considered to determine the most available endpoint.
The Shed Load filter is used for DNS traffic steering strategies, such as automatic load shedding. Users can configure a data feed to dynamically update the load metric value stored within the answer metadata. When configuring the Shed Load filter, you must select one of the load metric types below to push to the NS1 platform. It is important to note that the metric type label is nominal and the actual definition depends on the user-defined script that pushes data to the NS1 platform.
-
Load average (
loadavg
)
This is the default setting.. Generally, this distributes traffic to the endpoint with the lowest load average. -
Active connections (
connections
)
Generally, this distributes traffic to the endpoint with the least number of active connections. -
Active requests (
requests
)
Generally, this distributes traffic to the endpoint with the least number of active requests.
During configuration, you’ll create a data feed and apply it via the answer metadata so that the data source automatically updates whichever metric type you selected. Additionally, in the metadata for each (or at least one) answer, you must define a low and high watermark. The low watermark value indicates the threshold at which the NS1 platform should slow traffic distribution to that endpoint, favoring alternative answers (endpoints) instead. The high watermark value indicates the threshold at which the NS1 platform should completely stop traffic distribution to that specific endpoint.
Note: The low and high watermark can be applied to an individual answer, an answer group, or to the record as a whole.
data source: The original source of a data feed, typically ingested via an API integration from a variety of different third-party monitoring applications. The stream updates contain key-value pairs and labels that correspond to updates for the status of a particular endpoint.
data feed: Created from a data source, feeds provide a method to integrate metadata into the Filter Chain to facilitate active (automatic) failover and load shedding use cases.
How it works
The Shed Load filter evaluates each answer using the following logic:
- Does the answer have the relevant metadata? If not, the filter will not take any action on that answer. Note that unlike the Up filter, answers without the relevant metadata are not removed from the answer pool.
- Does the answer have all three necessary metadata values set?
- If the load metric is below or equal to the low watermark, the Shed Load filter does not remove the answer from the answer set.
- If the load metric is above or equal to the high watermark, the Shed Load filter removes the answer from the answer set entirely.
- If the load metric is between the low watermark and high watermark, the Shed Load filter removes the answer at a frequency equivalent to the distance it is between those two points. For example, if the low watermark is set to a value of 80, the high watermark is set to 90, and the calculated load metric value is 82, that particular endpoint would be removed from the list of available answers 20% of the time. If the calculated load metric value is 88, that particular endpoint would be removed from the list of available answers 80% of the time.
Note: After each answer is evaluated, if none of the answers meet the criteria (low/high watermark), all answers are returned. In other words, despite under-performing or overloaded endpoints, the Filter Chain will effectively skip the Shed Load filter. This is the same behavior as the UP filter.
Implementation instructions
The Shed Load filter is configured to reference one key load-related metric for each answer (endpoint) within the record. In order for the filter to behave as intended, the metric must be updated dynamically to reflect the most up-to-date information. Users can configure automatic load shedding using data feeds.
Step 1: Create a data source & data feeds
-
Log into the NS1 portal, and navigate to the Integrations tab.
- Under the Data Sources tab, click Add a Data Source.
- Select the data source type. This can be the native NS1 API source or any of the third-party integrations displayed.
- Enter a name for this data source to be used for internal reference only.
- Click Create Data Source, and then confirm by clicking Create a new feed with this data source? (same button).
-
Enter a name for internal reference and a label, and then click Submit.
- Repeat this process to create data sources and feeds. To do this, navigate to the Incoming Feeds tab and click the data source icon to create additional feeds from the same data source.
Step 2: Send load metrics to NS1 via API
- Click the Integrations tab. Under Incoming Feeds, note the “Feed URL” for each data feed.
- Use the API call below to push load metrics to NS1 from each server, replacing
$API_KEY
with your unique key generated via the NS1 portal,London-UK
with the label associated with your data feed, and theloadavg
field and value (ex.5
) with your chosen metric (loadavg,
connections
, orrequests
) and corresponding value.curl -X POST -H "X-NSONE-Key: $API_KEY" -d '{"London-UK":{"loadavg":5}}' https://api.nsone.net/v1/feed/5b85d99798c5e2ba330d3b15c1595f42
Step 3: Configure the Filter Chain
- Create a new record or navigate to an existing one via the Zones tab. Click into the record to view record details—including answers, answer metadata, and any existing Filter Chain configurations.
- Click Create (or Edit) Filter Chain.
- Configure the Filter Chain by clicking the + button next to the Shed Load filter or drag-and-drop the filter to the Active Filters section. Add any other filters you want to include in the configuration.
Note: The order of the filters as they appear (top to bottom) determines the order in which they are applied to each query. - Click the Shed Load filter under Active Filters to show the filter description and suboptions. Scroll down in the pane until you see a drop-down menu.
- From the drop-down menu, select the key load-related metric you’d like the Shed Load filter to reference when selecting the best-available endpoint: load average, active connections, or active requests. Ensure the metric selected in the answer metadata is the same as that selected here in the filter configuration settings.
- Once configured, click Save Filter Chain to return to the record details.
- Under Filter Chain, click the Shed Load filter from the list. This reveals several metadata options labeled underneath each of the answers displayed on the right.
- For each answer, click the metric label you selected when setting up the Filter Chain in step 5—either loadavg, connections, or requests—to reveal the answer metadata screen.
- In the Feed column, click the “data feed” icon next to the metric you would like to set (ex. loadavg).
-
Click Ok to save and return to the previous screen.
- Under each answer, click the low_watermark label to view answer metadata, and enter a low watermark threshold.
-
Click Ok to save.
- Similarly, under each answer, click the high_watermark label, and enter a high watermark threshold.
-
Click Ok to save.
-
Add and configure any additional filters you want to use in conjunction with Shed Load. We used the "Up" and "Select First N" filters in this example.
-
Click Save.
Note: 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 are found at https://ns1.com/api.