百度智能云

All Product Document

          Object Storage

          Acceleration of BOS by CDN

          Application Scenarios

          In content distribution scenario, BOS is used for storing static images and video files of websites, and downloads of applications. The content distribution scenario usually has the following characteristics:

          • Large amount of access to static files, high access frequency and high server load.
          • The user base of static files is huge, the concurrent access is intensive, and the network environment is extremely complex.
          • High-speed and centralized download is required in certain time period, and the concurrent downloads is huge, such as application update packages, patches etc.

          Using CDN to accelerate BOS. The acceleration of distribution through CDN services can help users get the files stored in BOS storage services nearby, greatly improving user experience.

          CDN-BOS_66d696e.png

          Advantages

          Using CDN to accelerate BOS so as to build content distribution scenario has the following advantages:

          • Massive storage space, unlimited number of storage objects;
          • Very low storage fee. The storage fee of BOS is much lower than that of cloud disk, and it supports multiple access types such as standard storage and infrequent storage.
          • Greatly reducing the load of Web server, and the accesses to static files are supported by CDN;
          • The distribution through CDN nodes spread all over the country by Baidu can greatly reduce the delay of contents read by users, increase the response speed and availability of the website accessed by users, and solve small network bandwidth, large user access, uneven network distribution and other problems.

          Configuration Guidance

          Taking creating a certain website as an example, generally, websites consist of master station, static and dynamic files and program code. The content distribution scheme of using CDN to accelerate BOS can optimize the network architecture, and improve user’s access experience with a limited increase of costs. The specific solution and steps are as follows:

          1.Sort out the web program in BCC or arbitrary places, differentiate dynamic files from static resources and store static files in BOS.

          • Create a resources directory to hold the directory of static resources of all websites;
          • Create a Bucket in BOS to store static resources of websites.

          Note: Anonymous access to resources by outer networks is not allowed unless the "read/write privileges" of bucket is set as "public read/write" or above. If the bucket is created, it can be changed in "bucket Settings"

          If hotlink protection by limiting access privilege is needed, Referer fields or signatures calculated by AK/SK can be used for access. Please refer to Hotlink Protection for details.

          2.Enable CDN

          There are two ways of registering a domain name for CDN acceleration: "using the official default acceleration domain name" and "using the registered domain name applied by individual/company".

          • Using the official default acceleration domain name

            • At the time of creating bucket, set the official CDN acceleration option as ON, and you will obtain the official CDN acceleration domain name directly.
            • If the bucket is created, you can Enable CDN acceleration in the "Data Release" page of the bucket. Please refer to CDN Accelerating Distribution for details.
          • Using self-defined acceleration domain name

            Self-defined acceleration domain name refers to the Register domain name which has been applied by the user in personal or company's name. 
            
            Select the bucket to be accelerated and enter "Data Release" page, click "add self-defined acceleration domain name". The domain name needs to be resolved successfully before it can be used for CDN acceleration. 

            3.Upload files and experience CDN acceleration

          BOS provides users with several schemes for uploading files, you can choose to Upload through Console, Use API or SDK to Upload, Use BOS CLI to Upload, etc.

          We will make an example of uploading a file through console.

          • After uploading, enter the "data management" page of "bucket management" to check if there is the uploaded file. If it exists, the CDN acceleration access address of the file is usually "self-defined acceleration domain name or official CDN acceleration domain name +'/'+' file name'.

            If you have multiple CDN acceleration domain names bound with the bucket, they are all effective.

          • In the application system, the original URL for access to static resources will be replaced by the address to accelerated access (your self-defined acceleration domain name or official CDN acceleration domain name +'/'+' file name'), then the access will be accelerated through CDN.

            After the change, accesses to static files in websites would be in the form of BOS+CDN, which not only reduces the wastage of your devices, but also improves user's access speed, improving user experience.

            4.Testing CDN acceleration

          Use browser to access resources in BOS by your self-defined acceleration domain name or official CDN acceleration domain name +'/'+' file name'.

          • CDN preloading

            • Enabling the preload function enables users to experience CDN acceleration (preheated to CDN) at the first visit. For specific operations, see CDN Preload.
          • CDN Configuration Rules

            • CDN does not cache data if that expiration time is not configured in the CDN and the source station does not display a control header providing http cache.
            • The expiration time can be configured in CDN to automatically update the cache. For specific operations, please refer to Configure Cache Expiration Time.
          Previous
          Hotlink Protection
          Next
          Web Direct Transmission Practice