Updated on 2024-04-25 GMT+08:00

Usage Cap

You can set a traffic or bandwidth cap for a domain name. When the usage reaches the cap, CDN acceleration will be disabled for the domain name, reduce high bills caused by traffic theft or attacks.

Scenario

If your domain name is attacked or has malicious traffic coming, there may be sudden traffic spikes that result in a bill higher than your normal expenditures. In this case, you can enable usage cap. Once the consumed bandwidth or traffic reaches the cap in a specified period, CDN acceleration will be disabled for this domain name.

Precautions

  • Statistics data has a delay of about 10 minutes. When your domain name reaches the cap, CDN acceleration will be disabled about 10 minutes later. The traffic, bandwidth, and number of requests generated during this time are charged.
  • When CDN acceleration is disabled for your domain name, the domain name cannot be accessed (status code 403 is returned). Set a proper usage cap to prevent service loss.
    • After CDN acceleration is disabled for a domain name, the CNAME record will be deleted. If the local DNS has a resolution cache or a user uses a host to forcibly resolve the domain name to a CDN PoP, CDN will refuse to provide services after receiving the request. However, traffic and request data will be generated. You need to pay for the traffic and request data.
  • Exercise caution when setting a usage cap for a wildcard domain name (for example, *.test.com). The total usage of all subdomain names, such as a.test.com, b.test.com, and c.test.com, is collected. Once the total usage reaches the cap, CDN acceleration is disabled for the wildcard domain name and all subdomain names become inaccessible.
  • You can set usage caps for up to 20 domain names. Each domain name can have only one bandwidth cap rule.
  • Domain names with special configurations do not support usage cap.
  • When a domain name reaches the usage cap and CDN is disabled, the usage cap function is not in effect during the current statistical period. For example:
    • On October 19, 2023, a customer set a traffic cap rule, that is, when the accumulated traffic usage within an hour reaches 400 GB, CDN acceleration will be disabled for 1 hour. From 20:00 to 20:35 on October 25, 2023, the traffic suddenly increased to 400 GB. Due to a delay in monitoring data, CDN acceleration was disabled for this domain name at about 20:41 on October 25, 2023. In this case, the usage cap function was not in effect from 20:41 to 20:59:59.
  • When the bandwidth or traffic cap is reached, CDN delivers the settings of returning the status code 403 to all PoPs. In this case, there is a delay between the cap being reached and the status code being returned to users.
  • Usage capping is free of charge on CDN. Simple Message Notification (SMN) charges you for alarm notifications sent to you. For details about SMN pricing, see SMN Pricing Details.

Procedure

  1. Log in to Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network.

    The CDN console is displayed.

  2. In the navigation pane, choose Domains.
  3. In the domain list, click the target domain name or click Configure in the Operation column.
  4. Click the Advanced Settings tab and enable the switch next to Usage Cap.
    Figure 1 Setting the usage cap
    Table 1 Parameters

    Parameter

    Description

    Example

    Statistics Type

    Real-time usage: Collects the traffic/bandwidth statistics every 5 minutes.
    • The start time of a statistical period is a multiple of 5 minutes. For example, if a rule is configured at a time from 00:10:01 to 00:14:59, the start time of the first statistical period is 00:10:00 (rounding down to the nearest 5 minutes).

    Accumulated usage/hour: Collects statistics on the traffic accumulated every exact hour. For example, the first statistical period on October 19, 2023 is 00:00:00 to 00:59:59.

    • After a usage cap is set, the first statistical period may be less than one hour. For example, if the usage cap is set at 00:25:00 on October 19, 2023, the usage from 00:25:00 to 00:59:59 is collected in the first statistical period.

    Accumulated usage/day: Collects statistics on the traffic accumulated every day (UTC+08:00). For example, the statistical period on Oct 19, 2023 is 00:00:00 to 23:59:59.

    Real-time usage

    Usage Cap

    For real-time usage, you can set a traffic or bandwidth cap. For accumulated usage, you can only set a traffic cap.

    Bandwidth cap: Collects bandwidth usage every 5 minutes. You can set a bandwidth cap as required.

    Traffic cap: Collects traffic usage in the specified period. You can set a traffic cap as required.

    NOTE:

    The bandwidth and traffic conversion rules for usage capping are the same as those for billing. The default conversion rules are: 1 GB = 1,024 MB and 1 Gbit/s = 1,000 Mbit/s.

    Bandwidth cap

    10 Gbit/s

    Alarm Threshold

    When the ratio of the access traffic/bandwidth to the configured cap reaches the alarm threshold, CDN sends a message to you. The alarm threshold ranges from 10% to 90%.

    80%

    Unblock After

    Duration for disabling CDN after the bandwidth or traffic cap is reached. After the specified duration expires, CDN is automatically enabled for the domain name.

    • Select 60 minutes, 12 hours, 24 hours, 3 days, or Manually. If you select Manually, you need to enable CDN for the domain name on the console if you want to use it again after it is blocked.

    12 hours

  5. Set required parameters and click OK.

Fee Description

The monitoring data has a delay of about 10 minutes. After the actual usage reaches the cap, CDN acceleration will be disabled about 10 minutes later. The traffic and bandwidth generated during this period are charged.

  • Example 1 (billing by peak bandwidth):

    Customer A is billed by peak bandwidth and adds domain name example.com to CDN. The customer enables usage cap and sets the bandwidth cap to 15 Gbit/s.

    The bandwidth suddenly increased to 15 Gbit/s from 22:00 to 22:05 on October 10, 2023. Due to the monitoring data delay, CDN acceleration was disabled at about 22:11 on the same day and the peak bandwidth reached 23 Gbit/s. In this case, 23 Gbit/s bandwidth was charged in the bill for peak bandwidth generated on October 10, 2023.

  • Example 2 (billing by traffic):

    Customer B is billed by traffic and adds domain name example.com to CDN. The customer enables usage cap and sets the traffic cap to 400 GB.

    From 22:00 to 22:05 on October 10, 2023, the traffic usage surged to 400 GB. Due to the monitoring data delay, CDN acceleration was disabled at about 22:11 on October 10, 2023. The traffic usage during this time reached 550 GB. Any traffic generated before CDN acceleration was disabled was included in the bill of 22:00 to 23:00 on October 10, 2023.