Updated on 2024-12-10 GMT+08:00

Solution Overview

Background

More and more companies in different industries use OBS buckets to store static resource files such as images, videos, and software packages. They use the OBS buckets as the storage source for websites, forums, apps, and games. Users can directly request these static resources from OBS using URLs. OBS buckets can solve the problem of insufficient local storage. However, the response speeds for users accessing OBS buckets in other regions are different, since files are generally stored in only one region. In scenarios where frequent access is required, accessing OBS buckets to obtain files consumes a large amount of traffic.

Solution

Huawei Cloud CDN can effectively accelerate distribution of website resources to deliver a better user experience. OBS buckets can store massive numbers of files. Storing data in OBS buckets and using CDN for service acceleration can both reduce costs and improve user experience. When a user initiates an access request, CDN checks whether the content requested by the user is cached on the CDN point of presence (PoP) with the fastest response speed. If a CDN PoP has cached the content, it directly returns the content to the user. If the CDN PoP does not cache the content, it pulls the content from the origin server, returns the content to the user, and caches the content.

Resources and Costs

The following table lists the resources required for this practice.

Resource

Description

Monthly Fee

CDN

Traffic: traffic generated when users access CDN PoPs. You can purchase traffic packages to deduct it.

For billing details, see Billing.

OBS

Traffic: outgoing Internet traffic generated when CDN pulls content from OBS, billed in pay-per-use mode. If you set the origin server type to OBS bucket and select a bucket of version 3.0 or later, you can purchase pull traffic packages to deduct the traffic.

For details about OBS billing modes and standards, see Billing.

Solution Advantages

  1. Low costs
    • Content in an OBS bucket with CDN acceleration enabled will be cached on CDN PoPs. CDN PoPs do not need to pull the content from the bucket when users request the content. The cost of CDN acceleration is low. With CDN acceleration, you can reduce bandwidth costs by 50% to 57%.
    • OBS provides pull traffic packages with preferential prices for CDN to request content from OBS. For details, see OBS Billing for CDN Acceleration.

      OBS buckets for CDN acceleration cannot be accessed through the intranet.

  2. High efficiency
    • Huawei Cloud CDN has abundant acceleration resources and widely distributed PoPs. It ensures that user requests are precisely scheduled to the optimal PoP for stable acceleration.

Scenarios

  • Applications or services that provide download services via HTTP/HTTPS through OBS, for example, websites that provide download services based on HTTP or HTTPS, download tools, game clients, app stores.
  • Applications or services that provide audio on demand (AOD) or video on demand (VOD) services through OBS. On-demand services include online education, video sharing, music or video on demand, and other audiovisual content.
  • Websites or applications that provide image materials through OBS, for example, portal websites, e-commerce platforms, news apps, and user-generated content (UGC) applications.

Limitations and Constraints

  • This solution applies only to OBS buckets whose version is 3.0 or later. You can view the bucket version in the Basic Information area on OBS Console.
  • When back-to-source by mirroring is configured on OBS and range requests are enabled on CDN, if the mirror origin server does not comply with the RFC Range Requests standard, the response to range requests is not 206 and CDN fails to pull content. In this case, submit a service ticket.
  • If the origin server type is set to OBS bucket and the origin server is an OBS private bucket, file upload is not supported. To use CDN to upload files to the OBS private bucket, set the origin server type to Domain name and enter the domain name of the private bucket when adding a domain name to CDN. In addition, force clients to carry the authentication header in requests for uploading files.

    After an OBS private bucket is connected to CDN using the bucket domain name, clients cannot access the acceleration domain name because CDN does not have the permission to upload files to the bucket. Therefore, when GET or HEAD is used to request resources from the acceleration domain name, the authentication header must also be carried.

Accelerating Downloads of Files Encrypted by KMS

By default, CDN cannot read encrypted files in OBS buckets. If such files exist in your OBS bucket, enabling CDN acceleration may cause leakage of encrypted objects. If you need to accelerate downloads of files encrypted by KMS in your OBS bucket due to service requirements, pay attention to the following:
  • If your OBS bucket is a public bucket, CDN cannot read files encrypted by KMS in the bucket. As a result, the retrieval fails and users cannot access the encrypted files.

    Solution: Move the encrypted files from the bucket to a private bucket, and then configure CDN acceleration for the private bucket.

  • If your OBS bucket is a private bucket, assign the kms:cmk:get and kms:dek:crypto policies to the CDNAccessPrivateOBS agency. In this way, CDN can read and accelerate downloads of files encrypted by KMS in the bucket. For details, see OBS Authorization.