Zhou Zhe, senior technical expert of CDN: In-depth analysis of user experience optimization technical points in the process of short video distribution

The Shenzhen Yunqi Conference has come to a successful conclusion. In the special session of Feitian Technology Exchange - Elastic Computing, Network and CDN on March 29, Zhou Zhe, senior technical expert of Alibaba Cloud CDN, brought us the theme sharing of "Extremely Fast Distribution of Massive Short Videos". Lead us to introduce the overall solution from the perspective of video content collection, upload, storage and distribution, and focus on the precautions for short video acceleration and user experience optimization points.

The explanation starts from three parts: short video application scenarios, Alibaba Cloud short video solutions, and Alibaba Cloud's optimization of short video user experience.

Short video application scenarios

Short videos contain more information than pictures and text. Today, with the popularity of the mobile Internet, short videos have a wide range of application scenarios.

1. Community sharing scene

Users can record videos, edit special effects, upload them to the server, and share them with friends through the community.

image

2. E-commerce scenarios

Merchants can quickly shoot and make short videos of products, and send product introduction videos to consumers, which can improve the conversion rate of purchases.

3. IM chat scene

In the process of communication, users can express their opinions more vividly and convey their emotions more realistically through the short videos that are shot and passed along with them.

4. New Media Scenarios

Different from the traditional, single graphic display form, short videos can quickly collect and publish news, presenting the world with one click

5. Sports event scene

After integrating the short video SDK, users can shoot and edit on-site in real time, generate short videos with dissemination value, and synchronize events across the network through sharing

Alibaba Cloud provides a complete set of technical solutions for short video business scenarios. On the host side, it provides a video upload SDK and short video SDK, on ​​the viewer side a video playback SDK, and on the server side, it provides on-demand services, OSS storage and CDN acceleration.

image

For developers, the use process of the short video solution is as follows: first, the anchor uses the short video SDK to record, special effect and edit the user's video, and then upload the video to the server through the upload SDK. First perform transcoding and video processing through the on-demand service, and then store the processed video on OSS for persistent storage. Integrate the player SDK on the player side, the player will request resources from the CDN, and if the CDN has a cache, it will send the cached data to the client. If there is no data in the CDN cache, the data will be pulled from the OSS, returned to the client, and the data will be cached on the CDN. Using these technical components, developers can quickly develop short video services.

image

Below, we introduce the capabilities and features of the solution one by one.

The video SDK in the solution includes short video, upload and playback. The short video SDK includes the functions of face mapping and advanced beauty. After the user records the video, the user performs local beauty first and then uploads it. It also provides professional filters, MV special effects, cropping and compression, and adding music functions to popularize video editing. ;Upload SDK can transfer the video to the server through the fast channel, support breakpoint resuming, background upload, multi-file management and other functions; Player SDK supports Android, IOS, flash, H5 and other platforms, encrypted playback and secure download Wait.

On-demand and storage services, on-demand services provide video management-related functions, such as video transcoding, narrow-band HD can save 30% of bandwidth under the same user experience; cloud editing function can edit and process videos online; at the same time, on-demand services Provides rich data statistics, and developers use the API provided by Alibaba Cloud to access real-time data.

image

At the same time, Alibaba Cloud has also opened up AI technologies in the video field, including content auditing to reduce the risk of violations; smart cover, which selects the optimal video frame as the video cover for structured video processing and algorithms; tag prediction, which uses AI to identify text in videos , images, people and other information, automatically generate video tags, etc.

Based on the massive data generated by short video services, Alibaba Cloud also provides storage services with high reliability, strong security, and low cost.

In order to meet the large-scale business needs of short videos, Alibaba Cloud CDN has built a large amount of infrastructure.

image

First of all, Alibaba Cloud CDN has more than 1,200 nodes around the world, which are distributed in various countries and regions around the world. They are deployed close to users, allowing users to access video content more quickly and make the video experience better. At the same time, in order to face the sudden traffic flow of the business, Alibaba Cloud has provided a bandwidth reserve of more than 80TB to escort the continuous growth of the business. In addition, the cache capacity of a single node exceeds 1PB, which improves user access speed by providing larger cache space.

After introducing the solution, Mr. Zhou Zhe introduced some optimization technologies of Alibaba Cloud in the field of short video.

The key indicators of short video user experience are time above the fold, playback freezes, and playback errors.

1. Time above the fold refers to the time difference between when the user clicks to play and when the video starts to play during the stable playback of the video. The longer the above-the-fold time is, the more users will end the playback early.

2. Stuttering in playback refers to the unsmooth situation in the playback process, which will seriously affect the user experience.

3. Playback error means that the user fails to play the video successfully, or an exception occurs, which leads to an early interruption.

User experience optimization analysis

To address these issues, we dissect the entire architecture.

First, the end user uses the video SDK provided by Alibaba Cloud to request the scheduling server, the scheduling server returns the corresponding node IP, and then the player requests resources through the CDN node IP. If the CDN edge node has a cache, it can be sent to the local player for playback If there is no cache, go to the second-level node for access. If the second-level node does not have a cache, it will go to the OSS or the user origin site to pull data.

image

Alibaba Cloud CDN has the cache of the first-level node and the second-level node. The role of the second-level node is the
first, for resource convergence, avoiding the same request back to the source at the same time, reducing the pressure on the origin site
. Second, it is close to the edge node, and the edge node is not hit. At the same time, the data can be obtained from the secondary node faster
, providing more storage space and improving hits.

At the same time, Alibaba Cloud conducts some user experience-related data management for the entire playback process, and analyzes these data to obtain some optimization points.

The first is the player

Whether the player is optimized or not determines the viewing quality of the end user. First of all, we have optimized the player SDK. For example, by reducing the first buffering time, it can be set to start decoding and playing after receiving the first I frame of the video; provide dynamic buffer size, when network jitter occurs, you can dynamically Increase the cache size and preload the data to reduce the stall rate; for playback errors, the player SDK implements a network retry mechanism to provide playback success rates.

The second optimization is for the scheduling system

When a user accesses an edge node, he accesses the scheduling server, and whether the IP address returned by the scheduling server is the optimal network link greatly affects the user's video download speed. Alibaba Cloud has developed an intelligent scheduling system, which can select the optimal link from the user to the edge node to feed back to the client.

The third is that Alibaba Cloud provides a lot of network node coverage

It can make edge nodes closer to users to improve user access speed.

The fourth optimization point is protocol stack optimization

When a user obtains data from the CDN server, when network jitter occurs, the download speed will decrease. Alibaba Cloud CDN optimizes the TCP protocol stack and uses a more efficient protocol stack algorithm to improve the download speed.

The fifth optimization point is narrowband HD

Developers can use the narrowband HD function provided by Alibaba Cloud to reduce the bandwidth for playing videos.

The sixth is cache server optimization

When a user accesses an edge node, if the request is sent to the edge node, MISS will go back to the source directly, and the response time will be slower. If the edge node is hit, the user's download speed is strongly correlated with the performance of the edge node cache server. Alibaba The cloud has optimized the performance of the cache server a lot, and increased the access rate by increasing the space and intelligent optimization of the edge server.

The seventh is full link monitoring

Alibaba Cloud also supports full-link monitoring to detect problems early, optimize them in a targeted manner, and ensure stable services

Intelligent scheduling system optimization

Here, we will introduce the optimization of intelligent scheduling in detail. For the scheduling system, Alibaba Cloud has optimized five aspects.

The first is that the accurate IP database will be continuously updated

Based on the third-party IP database data, the whois platform and some latitude and longitude information of Taobao mobile phone users when accessing the data, the IP database will be actively detected, and based on the data of these dimensions, the calculation and generation will be performed. The accuracy of the IP database data will provide data support for the scheduling system.

The second is to provide HTTPDNS service

When a user requests the scheduling server through localdns, the first problem they will encounter is: there is a mismatch between the localdns and the user's ip location. When scheduling based on localdns, the client ip seen by the scheduling system is inconsistent with the user's real ip, resulting in inconsistent scheduling. precise. The second problem is: when the user queries the dns server, the dns result will be changed by string during the query process

Through the httpdns service, the problem of mismatching localdns and ip addresses can be solved, and at the same time, the dns results can be prevented from being changed, making the scheduling more accurate.

The player preloads dns queries based on httpdns, and caches the results to reduce the slow first screen time caused by dns queries.

The third point is automatic scheduling based on user experience

It will calculate based on the user's client IP, the network status of the user to each node, and the current status of each node, and use some machine learning methods to predict which node the network link from the user to is the best. This ensures that the optimal network link is returned to the user's IP address.

The fourth is big data analysis, selecting the optimal node.

Based on the current node coverage and user access traffic trends, make data predictions, choose where to build points, and calculate which users covered by these nodes have the best network quality, providing data support for the scheduling system.

The last point is based on content scheduling to improve the hit rate.

Schedule content granularity through 302, schedule the same URL to the same machine, and improve the hit rate.

Cache performance optimization

Alibaba Cloud CDN has also made many optimizations for the caching system.

Through the self-developed cache system, develop a cache system based on bare disk. Using the memory, SSD, and SATA three-level cache architecture, the hottest resources are stored in the memory, the second-hot resources are stored in the SSD, and the cold resources are stored in the SATA. The resources are migrated to the memory and SSD, and then the cold resources in the memory and SSD are eliminated to the SATA disk through the elimination algorithm. In this way, the hit rate of memory and SSD is improved, the IO read and write conditions of SATA disks are reduced, more cold resources are stored, and the utilization rate of edge nodes is improved.

At the same time, the self-developed file system has made many optimizations for IO operations, such as merging the IP-aligned write function to avoid serious IO performance degradation caused by memory fragmentation and disk fragmentation. Store large files in slices and store them in different disks to avoid disk performance degradation due to overheating of a single video file.

Through the above optimization measures, the average cache hit rate is above 95%, and the average first byte time is less than 10ms.

image

Optimization of TCP protocol stack based on user experience

The first optimization point is the time-series-based packet loss discovery mechanism, which mainly analyzes the time series of TCP packets sent in the TCP protocol stack, and then can identify which packets are lost, and quickly discover packet loss and fast retransmission.

The second optimization point is the active packet loss discovery mechanism, which means that we actively detect when packets are found, avoid packet loss through timeout, reduce the time for packet loss discovery, and improve retransmission.
The third is adaptive Initialize the window and use different initialization window sizes for different business scenarios.

The fourth is a more aggressive congestion avoidance algorithm. In response to poor network conditions, it identifies the status in the protocol stack and uses a more aggressive packet sending strategy to solve the problem of slow download speeds.

The fifth optimization point is to use a smaller link timeout to detect packet loss earlier.

Based on the above optimizations, we used a third-party testing platform to compare the performance of a short video service with 1.2M files with other CDN vendors. In terms of the content download time for the same file size, using Alibaba Cloud CDN accounts for 2%-6% of the time. performance improvement. The rest of the data also performed well.

image

You are welcome to use Alibaba Cloud's on-demand service, CDN and OSS storage to build short video applications.

read the original

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324373910&siteId=291194637