Author: Wu Song

This paper summarizes the sharing of Wu Song, r&d director of Focus Media, at aliyunyun Native Combat Summit, and tells the exploration of Serverless technology from three aspects.

Current business situation of Focus Media

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

We apply the cloud native application architecture to mobile APP and video terminal, and there are many business applications, such as employee access, CRM, video processing, picture recognition, data reporting, data analysis and video live broadcasting. 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 so on. First, let’s talk about IoT. At present, all screens are using the IoT service of Aliyun. The biggest advantage of this service is that the screen connectivity can be maintained at around 95%, which greatly improves team productivity. In the past, all our screens had to be manually inserted into cards for publication. Now, with IoT access, our business volume has increased from 50% to 95%, that is to say, 95 out of 100 devices are connected to the Internet, which can well support our business and bring great value to our technical implementation.

In addition, we have 2 million static elevator posters, which need to be published every week. After publication, there will be a process of image processing. This section currently uses automatic recognition processing. After each issue, we need to determine whether the picture is wrong or inverted. All these operations can be notified to the staff of the magazine in real time. Once there is a problem of wrong or reverse picture placement after the magazine is published, it can be timely notified to the relevant person in charge through mobile phone SMS to remind them to take measures to solve it immediately and ensure that it can be completed within one hour.

Exploration practices of Serverless

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

  • Time-consuming: the previous manual publication could not know whether the publication is correct or wrong in time, and needed to spend a lot of time to check and modify;

  • Low resource utilization: The main business of the magazine is concentrated on Saturday and Sunday, so all resources are used on Saturday and Sunday, and there is no need to use server resources in most of the time.

  • Complex operation and maintenance and high skill requirements: Common pain points are encountered by everyone. Due to the complexity of business, high skill requirements of relevant business personnel are required, and more senior personnel need to be recruited to support corresponding operation and maintenance work.

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

When choosing Serverless, we actually have some concerns. The first is a large-scale practical case, the second is the image recognition algorithm is often very large, function calculation FC can be applied? Thirdly, the maximum FC specification can only support 2C3GB, which is a great test for our business. Fourth, whether can provide CPU usage and memory usage monitoring and so on. These are some of the issues that we are very concerned about.

We can see from the above figure, if we use K8s to request cloud host, we need to build K8s by ourselves, through external API to provide requests; And the use of Serverless computing platform, we do not need to care about how many servers or how many manpower, we only need to care about each API request is correct arrival and contact, we can confirm each image recognition whether there is an exact identification of the picture, and identify the wrong things issued, notice to the journal staff.

Therefore, we finally chose functional calculation because it has the following three prominent advantages:

  • Automatic elastic shrinkage: for example, we only need to tell him that there will be two million processing capacity every Saturday and Sunday, which will be completed in two days, and the peak is from 9 to 10 in the morning or from 3 to 4 in the afternoon, so that the automatic elastic shrinkage of resources can be realized.

  • 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 ability: when we request the daily publication staff at 6:00, 7:00, 8:00 in the morning, the back can provide real-time computing power at fixed time;

We use a lot of development languages, such as PHP, C++, Python, if using K8s to change, it is very difficult. But if you use Serverless, the transformation cost is much smaller.

We have made a preliminary test in the picture recognition system, which is just mentioned that we have two million elevator posters in Focus media, and every week we need each picture to be delivered accurately. So we are on-line image recognition system, every image upload OSS, by OSS through our MNS service, then the message is sent to FC function calculation, and then the message processing, after can add watermark images, image recognition, image matching, which can accurately tell is the publication of workers, Your picture has been published successfully. It’s time for the next picture.

As you can see from this business peak graph, FC supports scaling up to 7000+ instances in a minute. If we deploy K8s ourselves, it will involve a lot of manpower and resources, so we finally choose Serverless.

All On Serverless

We upgraded Serverless at the end of 2021. In the past, the service was on NAS, which caused us to pay attention to whether THE NAS failed in real time, because if the NAS failed, FC services could not be started. For example, we found that NAS was down when we checked services over the weekend, which led to such problems as algorithm connection failure. So, we upgraded the server side, put the business in the container, and deployed it by mirroring, which improved the cache, solved the big business problems at peak times, and started the image much faster than the previous NAS mount, which was the biggest improvement for the business.

After the upgrade, Serverless provides a variety of monitoring indicators to improve monitoring efficiency, such as error statistics and CPU efficiency, and can quickly locate the current service running status based on the monitoring data. Through the practice of Serverless, we can make our development pay more attention to business development, such as image recognition developers pay more attention to image recognition rate, the more operation and maintenance work to FC to deal with, So Serverless provides us with the benefits of extreme flexibility, automatic scaling, coping with traffic surges, and making development more business-focused.

When we used Serverless, we saw an 80% improvement in the team’s development operations efficiency and a 50% reduction in computing costs. In the past, we used to deploy many servers and GPU servers to implement a piece of our image algorithm business, but now we don’t use any of them, and the elastic effect has been improved by more than ten times.

Summary and reflection

We now mainly apply Serverless to image recognition algorithms, which is CPU-intensive and has extreme requirements for elasticity. In addition, Serverless is also suitable for event-driven business models to simplify architectural complexity without the need to look behind the scenes. With K8s, there is a lot of business logic involved.

In the future, we will also consider the combination of Serverless and Kafka for big data processing, which will be more efficient and simplify the use cost of Flink. In the live video broadcasting business, we also try to use Serverless to solve the part where live streaming is pushed to the video terminal in real time.

On the microservices side, we are also considering another Serverless product, the Serverless application engine SAE, to simplify our operations and improve efficiency, which is worth looking forward to.

Click here to go to the cloud yuan Child community for more information. Release the latest information of cloud native technology, collect the most complete content of cloud native technology, hold cloud native activities and live broadcast regularly, and release ali products and user best practices. Explore the cloud native technology with you and share the cloud native content you need.

Pay attention to [Alibaba Cloud native] public account, get more cloud native real-time information!