Click here to watch the big shots share

Serverless and small program are the mainstream and popular technologies at present. Many technicians also want to develop in these two directions. Tencent Cloud University invited Tencent R&D engineer Liu Yu. Lecturer Liu Yu, as a background research and development, had almost zero experience in small program writing before. However, as the real demand for the combination of Serverless architecture and artificial intelligence technology increased, he also began to contact small program writing. The following is our compilation of liu Yu’s live lecture sharing.

At present, some people already know Serverless technology very well, but some people may still be confused. Mr. Liu first expounded Serverless in his mind through an example.

If we were to build a website, traditionally as shown in Figure 1, we would develop the project and put it on a server that might involve routing rules, authentication logic, and all sorts of other complex business code. At the same time, the development team should pay a lot of energy on the operation and maintenance of the server, including whether the server needs to be expanded when the number of customers suddenly increases; Whether scripts and business codes on the server are still running properly; Is there a hacker who is constantly attacking the server?




Add a description



However, based on the Serverless architecture, the routing module and authentication module previously maintained by the development team will be connected to the API gateway system and authentication system provided by the service provider. The development team does not need to maintain the business codes of these two parts any more, but only needs to maintain relevant rules. At the same time, business code is broken down into function granularity, with different functions representing different functions. Under this structure, we can no longer see the server.

The purpose of Serverless is to let users only focus on their own business logic, part of the security issues, resource scheduling issues (such as how to deal with the sudden increase of users, how to achieve automatic expansion and other issues) are all entrusted to cloud vendors. In traditional projects, services are running regardless of user access and costs are incurred, whereas the Serverless architecture saves costs by activating and executing functions only when the user initiates a request.

So we can see that Serverless consists of two parts, one is the surrounding infrastructure, or the underlying services; The other part is functions, which can be thought of as a function platform that can be written online and run online.

For users and developers, the Serverless architecture has the advantages of reducing labor costs and risk, reducing resource overhead, increasing scaling flexibility, and shortening innovation cycles. With the Serverless architecture, users do not need to maintain the server themselves, and do not need to worry about various performance metrics and resource utilization of the server, but can devote more time and effort to the state and logic of the application itself. At the same time, the deployment of Serverless application itself is very easy, we only need to upload the basic code, such as Python program only need to upload its logic and dependency package, C/C++, Go and other languages only need to upload its binary file, Java only need to upload its Jar package, etc. There is no need to use Puppet, Chef, Ansible, or Docker for configuration management, which greatly reduces o&M costs.

For operations, the Serverless architecture also eliminates the need to monitor the underlying data, such as disk usage, CPU usage, and so on, allowing us to focus more on monitoring the metrics of the application itself. On the Serverless architecture, the roles of operations personnel will change, deployment will be more automated, and monitoring will be more application-oriented.

Next, let’s talk about what applets are. Small programs can be cross-platform, we can achieve a similar and native cross-platform APP through simple code, whether it is Android or ios can be easily used.





We can develop an APP in a few very simple steps, even if you don’t have Android or iOS, even if you only know the front end, or you only know the back end, you can develop a little APP that is similar to the native APP experience. Behind the small program is hundreds of millions of users, as long as you are good enough, you can leverage this huge group. Applets have not only opened our eyes to a new world at the development level, they have also given us a new feel at the operational level.

What’s the spark with applets and Serverless? The instructor believes that the combination of the two makes it more focused and convenient for developers.





Lecturer Liu Yu also demonstrated how to write cloud functions and small programs in the live class. Due to time constraints, the compilation of album small program could not be realized on the spot, but the lecturer opened the open source address of album small program.

In daily life, we often encounter search images, especially when looking for pictures of the past for a long time, memory only fragmented memory, the way we retrieve photos are usually positioning to the approximate time, and then to check one by one, but it is inefficient, also often miss our target images, so this time, There is an urgent need for a software that can search pictures, that is, we can achieve quick retrieval of pictures through simple text description.

In general, with Serverless architecture, we can easily make background services, alarm monitoring services, and even combine with artificial intelligence. Serverless architecture, especially the cloud function of Tencent Cloud, can not only be used to do external background services, background services of small programs, timers and scripts, but also to do big data processing and some algorithms of artificial intelligence.

Tencent Cloud University is a one-stop learning and growth platform for cloud ecosystem users under Tencent Cloud. Tencent Cloud University big tycoon share invites internal technology big tycoon every week, to provide you with free, professional, the latest technology trends of the industry to share.