When you create a service, the default traffic policy is automatically created for you. This policy applies to the entire world. You can edit the default policy, but you cannot delete it.
You can create additional policies for more specific geolocations. There are three types of traffic policies:
- Static Policy – You specify the traffic weight assigned to each CDN provider.
- Dynamic Policy – The best-performing CDN is automatically selected.
- Cost-Based Policy – CDN costs and traffic commitments are taken into consideration when routing traffic.
Notes:
- Some of the policies described below require performance and availability monitoring. For more information, see Creating a Monitor.
- If only one CDN provider is selected for a policy, it will automatically be configured as a Static Policy, with 100% of the traffic routed to that CDN.
- When a traffic policy is changed, the change should become visible within a few minutes. However, the exact time depends on DNS propagation.
When you create a new policy, it will appear in the traffic policies table. From there, you can edit or delete it.
Creating a Dynamic Policy #
Dynamic Policies are useful when your service is sensitive to performance. This type of policy allows your traffic to use the best-performing CDN at any given time.
To create a Dynamic Policy:
- Navigate to your service.
- In the sidebar, under Traffic Steering, select Traffic Policies.
- Click Add Policy.
- Select the CDN providers to be used in this policy and click Next. Note: You must select more than one CDN for the following configuration steps to appear.
- Select Dynamic as the policy type.
- Specify the geolocations where this policy should apply. You can select multiple locations. Click Next.Specify the performance monitor to be used for this policy. This monitor will be used to determine the best-performing CDN. If you haven’t defined one yet, you can create one by clicking the + button. Click Next.
- Select whether to enable automatic failover between the providers. If you select Yes, you will need to specify an availability monitor. Click Next.
- Review the summary of your traffic policy and click Apply Policy to create it.
Creating a Static Policy #
A Static Policy allows you to define a specific traffic weight for each CDN provider.
To create a Static Policy:
- Navigate to your service.
- In the sidebar, under Traffic Steering, select Traffic Policies.
- Click Add Policy.
- Select the CDN providers to be used in this policy and click Next.
- Note: You must select more than one CDN for the following configuration steps to appear.
- Select Static as the policy type.
- Specify the geolocations where this policy should apply. You can select multiple locations. Optionally, you can specify a list of ASNs (Autonomous System Numbers) to make the policy more granular within the selected geolocation. Click Next.
- Select whether to enable automatic failover between the providers. If you select Yes, you will need to specify an availability monitor. Click Next.
- Specify the traffic weight, as a percentage, for each provider. The total weight must equal 100%.
- Review the summary of your traffic policy and click Apply Policy to create it.
Creating a Cost-Based Policy #
A Cost-Based Policy takes cost into consideration when routing traffic between CDN providers:
- CDN prices – You can prioritize CDNs according to their price. For example, a lower-cost CDN can be assigned a higher priority.
- Traffic Commitment – If you have a traffic commitment with one of your CDN providers, the system will take this commitment into account when routing traffic.
To create a Cost-Based Policy:
- Navigate to your service.
- In the sidebar, under Traffic Steering, select Traffic Policies.
- Click Add Policy.
- Select the CDN providers to be used in this policy and click Next.
- Note: You must select more than one CDN for the following configuration steps to appear.
- Select Cost-Based as the policy type.
- Specify the geolocations where this policy should apply. You can select multiple locations. Click Next.
- Select whether to enable automatic failover between the providers. If you select Yes, you will need to specify an availability monitor. Click Next.
- Specify whether a performance penalty should be applied. If a penalty percentage is defined, traffic will be routed to the higher-priority CDN as long as its performance is not worse than the configured penalty threshold. For example, if CDN-A has a higher priority than CDN-B and you define a 10% performance penalty, CDN-A will continue to be used as long as its performance is not more than 10% worse than CDN-B. Click Next.
- Drag and drop the CDNs to define their priority. The lowest-cost CDN should be placed first.
- Review the summary of your traffic policy and click Apply Policy to create it.