Author: Wu Song

This article summarizes the sharing by Wu Song, R&D director of Focus Media, at the Alibaba Cloud Cloud Native Practice Summit, and describes the exploration of serverless technology from three aspects.

Business Status of Focus Media

在这里插入图片描述

The business scenario of Focus Media is very simple, that is, advertisers buy the volume, then carry out the delivery schedule and statistics, and finally display the effect. In the early stage of the business scenario, advertising design and video processing are required, and in the later stage, there is an advertisement placement and effect display, which may provide customers with various data displays. The main business forms of Focus Media include static posters (with a market share of over 73%) and 300,000 elevator screens, covering 91% of mid-to-high-end office buildings.

在这里插入图片描述

We apply the cloud native application architecture to mobile APPs and video terminals, and there are many business applications, such as employee access, CRM, video processing, image recognition, data reporting, data analysis, and live video. Among them, live video is a newly developed business, which is to push live video to the screen of Focus Media in real time.

在这里插入图片描述

Cloud services use SLB, MQDT, transcoding services, IoT, and more. Let's talk about IoT first. All of our screens now use Alibaba Cloud's IoT services. The biggest advantage of this service is that the screen connection rate can be maintained at about 95%, which greatly improves the team's work efficiency. Because we used to manually insert cards for publications on our screens, now after connecting to IoT, our business volume has increased from 50% to 95% now, that is to say, there are 95 of 100 devices outside. The equipment is connected to the Internet, which can well support our business and bring great value to our technology implementation.

In addition, we have 2 million static elevator posters, which need to be published every week, and there will be a picture processing process after the publication. This piece is currently using automatic recognition processing. After each publication, it is necessary to judge whether the picture is wrong or whether the picture is reversed. All this series of operations can now be notified to the publishing staff in real time. Once there is a problem that the pictures are placed in the wrong or reversed position after the publication, they can be notified to the relevant person in charge through the mobile phone text message in time, reminding them to take immediate measures to solve the problem to ensure that they can be solved in a timely manner. completed within hours.

Exploring Practice of Serverless

在这里插入图片描述

Traditional servers cannot meet the rapid growth of our business, and there are three main pain points. Time-consuming, low resource utilization, complex operation and maintenance, and high requirements for personnel skills.

  • Time-consuming: The previous manual publication could not know whether the publication was correct or wrong in time, and it took a lot of time to check and revise;
  • Low resource utilization: The main business of the publication is concentrated on Saturdays and Sundays, so all resources are basically used on Saturdays and Sundays, and server resources do not need to be used most of the time;
  • Complex operation and maintenance and high requirements for personnel skills: the common pain points that everyone will encounter, due to the complexity of the business, the skills of relevant business personnel are also high, and it is also necessary to recruit more senior personnel to support the corresponding operation and maintenance work.

So, for us, there are two options for going to the cloud. The first is to build a container cluster by using K8s service, and the second is to use function computing FC. So how do we choose?

在这里插入图片描述

When choosing Serverless, we actually had some concerns. The first is a large-scale practical case, and the second is that the algorithm of image recognition is often very large. Can function calculation FC be applicable? Third, the highest specification of FC can only support 2C3GB, which is a big test for our business. Fourth, is it possible to provide monitoring of CPU usage and memory usage, etc.? These are some of our concerns.

The difference between the operating principles of K8s and Serverless can be seen from the above figure. If we use K8s to request cloud hosts, we need to build K8s ourselves and provide requests through external APIs; with the serverless computing platform, we don’t need to care how much we use The server or the amount of manpower, we only need to care whether each API request arrives and touches correctly, we can confirm whether each image recognition has accurately recognized the picture, and send out the wrong recognition to notify the publication staff. .

Therefore, we finally chose function computing because it has the following 3 outstanding advantages:

  • automatic elastic contraction : For example, you only need to tell him that there are 2 million processing capacity every Saturday and Sunday, and it needs to be completed in two days, and the peak time is from 9 to 10 in the morning or from 3 to 4 in the afternoon, and the resource can be realized. Automatic elastic contraction;
  • Resource free operation and maintenance : Solve the pain point that we need to hire professionals to support operation and maintenance;
  • can provide large-scale identification capabilities : When we request the daily publication staff to publish at 6:00, 7:00 and 8:00 in the morning, the backend can provide computing power in real time at a fixed time;

We use many development languages, such as PHP, C++, and Python. It is very difficult to transform with K8s. But if Serverless is used, the cost of transformation is much lower.

在这里插入图片描述

We have conducted a preliminary test of the image recognition system, that is, as we said earlier, we have 2 million elevator posters in Focus, and every week requires accurate delivery of each image. Therefore, when we launch the image recognition system, each image will be uploaded to OSS, and our MNS service will be opened through OSS, and then the message will be sent to the function computing FC, and then the message will be processed, and then the image can be watermarked, Image recognition and pictures are matched, so that workers who are publishing can be accurately told that your picture has been successfully published, and the next picture can be published.

As you can see on this business peak graph, FC supports expansion to 7000+ instances within one minute. If we deploy K8s by ourselves, it will involve a lot of manpower and material resources, so we finally choose Serverless.

All On Serverless Simplified

At the end of 2021, we will have a business upgrade to Serverless. In the past, the service was on the NAS, which caused us to pay attention to whether the NAS was down in real time, because if the NAS was down, the FC service would not be able to start. For example, when we checked the business on the weekend, we found that the NAS was down, which caused the algorithm to fail to connect to such problems. Therefore, we upgraded the server, put the business in the container, and deployed it through the image, which can improve the cache and solve the business problem during the peak period. The image startup is much faster than the previous NAS mount. This is where the biggest boost to the business is.

The upgraded Serverless provides a wealth of monitoring indicators to improve monitoring efficiency, and improves many indicators such as error statistics and CPU efficiency, and can quickly locate the current business operation status based on monitoring data. Through the practice of serverless, we can make our development pay more attention to business development. For example, we can make image recognition developers pay more attention to the recognition rate of image recognition, and hand over more operation and maintenance work to FC. Therefore, serverless It provides us with the benefits of extreme flexibility, automatic capacity expansion, coping with sudden traffic surges, and making development more business-focused.

在这里插入图片描述

After we use Serverless, we can see that the team's development and operation efficiency has increased by 80%, and the computing cost has dropped by 50%. In the past, we would deploy a lot of servers and GPU servers to implement a piece of our image algorithm business, but now we don't use them anymore, and the elasticity effect has been improved by more than ten times.

Summarize and think

We now mainly apply serverless to image recognition algorithms, which are CPU-intensive and have extreme requirements for flexibility. In addition, Serverless is also suitable for event-driven business models to simplify the complexity of the architecture, so that you don't need to focus on what's behind it. If K8s is used, it will involve a lot of business logic.

In the future, we will also consider combining Serverless and Kafka for the processing of big data, which will be more efficient and simplify the cost of using Flink. In the video live broadcast business, the part where the live stream is pushed to the video terminal in real time is also what we try to solve by using serverless.

In terms of microservices, we are also considering another serverless product, the serverless application engine SAE, to simplify our operation and maintenance and improve efficiency, which is worth looking forward to.

Click here to go to the cloud native sub-community for more information.


阿里云云原生
1.1k 声望325 粉丝