Tiens Group Cloud Function Practice: Customize business logic to realize cross-border e-commerce global live broadcast


The business covers more than 190 countries and regions around the world, serving more than 40 million users worldwide, and the business areas span biotechnology, health management, hotel tourism, education and training, financial investment... to operate the global business of such a multinational group , How many IT management centers need to be deployed globally?

As such a multinational company, Tiens Group has given three answers.

01. A "small goal": to accelerate the realization of global live broadcast

Tiens' global business is mainly in charge of three streamlined IT teams located in Tianjin, Beijing and Hangzhou. actively promotes business development efficiency through technological innovation , continuously outputting business power for Tiens globally.

In 2021, Tiens will quickly realize the improvement of live broadcast services at home and abroad as a strategic goal:

  1. Apply live broadcast to global e-commerce live broadcast to bring goods, covering more than 190 overseas markets around the world;
  2. Apply live broadcast to internal training, gold medal lecturers, educational presentations and other fields to serve the group's global collaborative management;

Global live broadcast is not only related to the group's global sales interests, but also affects the efficiency of transnational operations within the group.

(Tiens live broadcast demand data stream)

Features and requirements of Tiens Global Live Broadcasting:

Custom business logic

The real-time live broadcast of the group's internal conferences requires the use of professional equipment to push multi-language video streams such as Chinese, Spanish, Indonesian, Russian, French, and English, and the content needs to be live and broadcasted in more than 190 countries and regions around the world.

Server cost

Unscheduled e-commerce operations around the world, the cost of setting up a separate server is high, and the underlying service deployment cycle is long.

Uncontrollable concurrency

The exporting countries of cross-border e-commerce have different time zones. For companies headquartered in China, it is difficult to carry out 24-hour operation and maintenance management based on the global time zone.

(Tianshi Serverless cloud function live broadcast architecture diagram)

02. Cloud function online video retweeting

Push the host’s recorded video or RTMP live stream to the real-time audio and video TRTC room for live broadcast. At the same time, choose to use Redis to enable the real-time recording of the push live broadcast, and the API gateway will write the progress to Redis in real time. The complete live broadcast process of Tiens Group includes comprehensive functions such as live streaming, transcoding, recording, pornography, CDN bypass acceleration, etc., and it is quickly constructed through Tencent Cloud Serverless cloud functions to remotely call function services to realize playback of live video services and shorten the development cycle.

Performance improvement: 1000+ instances can be played in 1 second;

Stability improvement: availability 99.99;

Improved network quality: All components have mutual access to the intranet, with a delay of less than 5ms;

Cost optimization: Introduce cloud function asynchronous Invoke API to save message queue fees;

The programmability of cloud functions can be based on different programming languages (Python / Node / PHP / Java / Go), write custom business logic , integrate other cloud services and third-party services, expand business boundaries, efficient and innovative gameplay . In Tiens' global live broadcast service, through Tencent Cloud TRTC audio and video services, SCF cloud functions, IM instant messaging, VOD cloud live broadcast, cloud storage and other related services, it integrates and docks third-party real-time speech recognition and AI text translation to realize overseas live subtitles The translation function solves the needs of global e-commerce live broadcast delivery, global conference broadcast and real-time interaction, and achieves the group's strategic goals.

(Implementation renderings of Tiens global conferences and e-commerce live broadcast services)

Custom business logic

Docking with third-party real-time speech recognition and AI text translation, realizing the translation function of overseas live broadcast multilingual subtitles.


Professional equipment pushes the stream, and one video stream meets multiple App live interactions at the same time; for the sales attributes of e-commerce, the anchor end guarantees the smooth use of sales assistance functions such as merchandise on the shelves and interactive connection of wheat.

Mass concurrent processing

It supports up to 100,000 concurrent requests per second. In the face of uncontrollable burst traffic during live broadcast, the high concurrent carrying capacity can stably support the peak of intensive business.

Streaming media processing

The working method of streaming source video files and streaming upload of transcoded files is adopted, with object storage to build an automated transcoding process with one click; during the live broadcast, screenshots of the live content are recorded to meet the needs of playback and review of illegal content .

market, and achieve the group's strategic goals with faster and better project deliverables."

-Yu Zhen, senior manager of Tiens Group.

03. Typical application scenarios of cloud functions in e-commerce business

1. CPU-intensive services such as e-commerce live broadcast

Live delivery of goods has become a standard feature of online e-commerce platforms. In e-commerce live broadcasts, professional and stable live streaming, transcoding, distribution, and playback services are required to meet the requirements of ultra-low latency, ultra-high image quality, and ultra-large concurrent visits. After the live broadcast ends, it is usually necessary to process the playback video, such as audio and video transcoding and mixing, and secondary distribution and storage of the playback video. Compared with the self-built transcoding server, the cloud function SCF does not need to consider the utilization efficiency of the transcoding server's idle time and server operation and maintenance.

(Cloud function e-commerce live broadcast program)

Smooth migration and quick launch

It supports user-defined configuration of FFmpeg command parameters and deployment of self-built FFmpeg. The transcoding method is flexible, and it can also be easily transplanted from physical machines, cloud hosts or containers to cloud functions.

Solve the computing power bottleneck

Large-format instances support up to 128GB/64C for 4K high-definition video transcoding, combined with resource elastic scalability, effectively ensuring transcoding efficiency.

Cost advantage of pay-as-you-go

Video transcoding is a CPU-intensive service with a high computational load. It requires full decoding of the input video stream, video filtering/image processing, and full encoding of the output format. The 1 millisecond granularity of cloud functions is billed according to usage, which has significant cost advantages.

2. E-commerce big promotion and other peak and valley business

During the e-commerce promotion period of 11.11 and 618 each year, the online channels of the e-commerce industry face historical-level traffic challenges. The peak call volume of medium and large e-commerce platforms can reach tens of millions per minute, which is 10 to 20 times higher than daily In daily operation activities, such as boutique spikes and limited time purchases, e-commerce platforms are also facing typical scenarios of large traffic, high concurrency, and peak and trough user traffic. The cloud function SCF provides flexible and scalable infrastructure and escort services to help e-commerce customers grasp business growth opportunities and calmly deal with challenges.

(Schematic diagram of e-commerce elasticity promotion)

Instant cold start

The bottom layer of the cloud function SCF adopts self-developed lightweight virtualization technology. The startup time of Micro Vm is as short as 90 milliseconds, the cold start of the function is reduced to 200 milliseconds, and it supports simultaneous expansion of tens of thousands of computing nodes.

Real-time scaling

Based on the mode of function request real-time calculation, dynamic expansion and contraction of function examples, optimization of the experience of function cold start, and control of the resource cost of function calculation.

Preset concurrency

In scenarios such as spikes and snap-ups, massive computing resources are needed instantly. Cloud function preset concurrency can support concurrent instances to be pre-started according to the configuration and "warm up" the function in advance to prepare computing resources in advance for business peaks, eliminate cold start, and reduce the time consumption caused by the initialization of the operating environment and the initialization of business codes.

3. Event-driven services such as smart image processing

On the e-commerce platform, there are a large number of query requests and update requests for product pictures every day. In peak conditions, there are tens of millions or even hundreds of millions of image processing needs every day. The cloud function SCF provides multiple processing capabilities such as image cropping and adding watermarks to meet the image processing demands of e-commerce businesses. At the same time, in view of the high availability requirements of image processing and storage, it can support the cross-regional high availability deployment of object storage.

Traditional solutions need to build an online server and deploy a web application for image processing, and the program triggers events regularly according to certain rules. In the traditional scheme, there are three main problems: when there is no request, the vacancy rate is high; a set of running processing code needs to be maintained; concurrency and timer execution methods need to be considered to ensure the timeliness of image processing.

In the serverless architecture, users only need to set a trigger + function on the cloud function SCF. When the user uploads a picture to the object storage, the function code will be triggered to process the picture and transfer the picture to a new storage bucket. In the whole process, there is no need to build a web server, no need to write trigger conditions, and no need to pay attention to business operation and maintenance.

(Cloud function image processing solution)

GitHub: github.com/serverless
Official website: cloud.tencent.com/product/serverless-catalog

about us

For more cases and knowledge about cloud native, please follow the public account of the same name [Tencent Cloud Native]~


   ②公众号后台回复【系列】,可获得《15个系列100+篇超实用云原生原创干货合集》,包含Kubernetes 降本增效、K8s 性能优化实践、最佳实践等系列。

[Tencent Cloud Native] Yunshuo new products, Yunyan new technology, Yunyou Xinhuo, Yunxiang information, scan the QR code to follow the public account of the same name, and get more dry goods in time! !
阅读 331


321 声望
954 粉丝
0 条评论


321 声望
954 粉丝