You can use Alibaba Cloud CDN to accelerate the delivery of images in Object Storage Service (OSS). This speeds up access and reduces data transmission costs. If you want to analyze user access behavior, you can use features that are provided by Alibaba Cloud CDN, such as monitoring, usage analytics, and operations reports, to help you modify operation policies based on your business requirements.
Scenario

When you operate an e-commerce website, you need to upload and download a large number of product images, and ensure seamless access for all users to the website. In this case, you can store images in OSS and use Alibaba Cloud CDN to accelerate image delivery. This speeds up access, improves server stability, and reduces traffic costs. Alibaba Cloud CDN caches images from OSS to the points of presence (POPs) that are nearest to clients. When a client accesses an image, the image is retrieved from the nearest POP instead of the OSS bucket. This reduces latency and improves resource access efficiency.
Benefits
Cost saving
The unit price of Alibaba Cloud CDN traffic is lower than the unit price of outbound traffic over the Internet from OSS. For example, you use Alibaba Cloud CDN to accelerate the delivery of images in OSS, the origin fetch fee is ignored, and the monthly traffic is 1 TB. In this case, if you purchase a CDN resource plan, the cost is reduced by approximately 78.6% from USD 70 to USD 15 compared to using OSS outbound traffic.
You may incur fees for CDN outbound traffic and for origin traffic from OSS to CDN. For more information, see Billing of OSS content acceleration.
User experience improvement
Alibaba Cloud CDN caches images from OSS to the POPs that are nearest to clients. Clients can retrieve images from the nearest POP. This reduces page loading time.
Alibaba Cloud CDN also provides features, such as image editing, to optimize image access performance. For example, you can enable the image compression feature on POPs. After an image is compressed, the size of the image is reduced, and access to the image is accelerated. If you enable the image compression feature and set the compression rate to 90% for an image whose size is 516 KB, the image is compressed without changing the resolution, size, or format, and its loading time is reduced by 50% from 50 ms to 25 ms. For more information, see Step 4: Optimize image access performance.
User access behavior analytics
Alibaba Cloud CDN provides features, such as monitoring, usage analytics, and operations reports, to analyze page views (PVs), unique visitors (UVs), and user distribution by region of your website, such as an e-commerce website. This helps you analyze traffic trends and sources, and modify operation policies based on your business requirements.
For example, you can use the Popular Referer Headers metric in operations reports to evaluate advertising effects. If the reports show that a large number of requests are redirected from specific advertising channels, the advertising channels work as expected. Otherwise, you can stop advertising in the channels.

Prerequisites
An Alibaba Cloud account is created, and real-name verification is completed for the account. For more information, visit the Sign up to Alibaba Cloud and Real-name Registration pages.
OSS is activated, an OSS bucket is created, and resources are uploaded to the bucket. For more information about how to activate OSS, see Activate OSS.
Configure Alibaba Cloud CDN to accelerate the delivery of images in OSS
Step 1: Activate Alibaba Cloud CDN and add a domain name to accelerate
Log on to the Alibaba Cloud CDN console.
In the left-side navigation pane, click Domain Names. On the Domain Names page, click Add Domain Name and configure the following parameters:
Domain Name to Accelerate: the domain name that is used by users to access your website. In this example, enter
image.example.com.Business Type: We recommend that you select Image and Small File.
Region: the region in which you want to accelerate the delivery of images in OSS, such as Chinese Mainland Only.
NoteThe first time you add a domain name to Alibaba Cloud CDN, the system verifies the ownership of the domain name before you can add the domain name. Follow the on-screen instructions to complete the verification. For more information, see Verify the ownership of a domain name.
Click Add Origin Server and configure the parameters. Set the Origin Info parameter to OSS Domain and select the OSS bucket that you want to accelerate from the Domain Name drop-down list. Retain the default values for other parameters and click OK.
After you add an origin server, read and select the compliance commitment, click Next, and then wait for manual review.
NoteIf your accelerated domain name does not require manual review, you can proceed to the next step. You can configure the cache expiration, bandwidth cap, and HTML optimization features in the Recommended Features step based on your business requirements. The features improve the cache hit ratio, security, and access performance of Alibaba Cloud CDN.
When the Status of the domain name is Enabled, obtain the CNAME of the accelerated domain name. In this example, the CNAME is
image.example.com.w.kunlunsl.com.
Step 2: Add a CNAME record
After you add a domain name to Alibaba Cloud CDN, the system assigns a CNAME to the domain name. Before you can redirect requests to POPs, you must add a CNAME record in the system of your DNS service provider to map the domain name to the CNAME.
In the following example, Alibaba Cloud DNS is used to show how to add a CNAME record. For more information, see Configure a CNAME record.
Log on to the Alibaba Cloud DNS console with the Alibaba Cloud account to which the accelerated domain name belongs.
In the left-side navigation pane, click Public Zone. Find the domain name for which you want to add a CNAME and click DNS Settings in the Actions column.
Click Add DNS Record and add a CNAME record.
Record Type: Select CNAME.
Hostname: Enter
image.Record Value: Enter the CNAME assigned by Alibaba Cloud CDN to your accelerated domain name, such as
image.example.com.w.kunlunsl.com.Retain the default values for other parameters.
Click OK.
Step 3: Configure cache rules
POPs determine whether to cache the image that is requested by the client based on the cache rule that you configure, such as the cache time-to-live (TTL). After POPs cache the image, when other users request the image, POPs can return the image to the users. This reduces latency and improves resource access efficiency. If the image requested by users does not exist on POPs or has expired, POPs initiate an origin request to OSS to retrieve the most recent image. You can create a cache rule for static resources based on file directories or file name extensions.
If you have configured the TTL in the Recommended Features step when you add a domain name to Alibaba Cloud CDN, the TTL of resources in the directory is one month. You can determine whether to change the TTL based on your business requirements.
Log on to the CDN console.
In the left-side navigation pane, click Domain Names.
On the Domain Names page, find the target domain name and click Manage in the Actions column.
In the left-side navigation tree of the domain name, click Cache.
On the Cache Expiration tab, click Create Rule.
In the Create Expiration Rule dialog box, configure the following parameters:
Type: Select File Extension.
File Extension: Enter the extensions of files that you want to cache. In this example, enter jpg.
Expire In: Specify a value of one month or longer for static files that are infrequently updated, such as images and application packages. This can reduce origin traffic.
NoteIf a POP retrieves a static file from an origin server, the POP processes the file based on the priorities of the cache rules. For more information, see Default Alibaba Cloud CDN cache rules and priorities.
Weight: Enter 99.
Click OK.
Step 4: Optimize image access performance
You can use the image editing and ignore parameters features provided by Alibaba Cloud CDN to accelerate response when users request images.
Step 5: (Optional) Analyze user access behavior by using the operations reports and monitoring features
Create an operations report
You can create a custom operations report and a tracking task to analyze access to your e-commerce website, such as PVs, UVs, user regions, and popular URLs. For example, you can use the Popular Referer Headers metric in operations reports to evaluate advertising effects. If the reports show that a large number of requests are redirected from specific advertising channels, the advertising channels work as expected. Otherwise, you can stop advertising in the channels.
You need to create a custom operations report to generate statistical data for analysis.

Alibaba Cloud CDN monitoring and usage analytics
The resource monitoring feature allows you to view statistics such as access traffic and bandwidth, origin traffic and bandwidth, the number of requests, and the hit ratio. You can also export reports.
On the Data Transfer/Bandwidth of Requests tab, you can compare data transfer between two different time ranges. This helps you monitor the advertising and operations of your website.




