Tencent Cloud Microcomputing Practice: Starting from Serverless, Talking about the Future of Edge Computing

Welcome to the cloud + community to get more Tencent's massive technical practice dry goods~

Author: Huang Wenjun, senior product manager of Tencent Cloud, has experienced the architecture and development of enterprise-level storage, enterprise-level container platforms and other products, and has a strong interest in containers, microservices, serverless, and DevOps. Posted in Cloud+Community by Tencent Cloud serverless team

This article is compiled from the Tencent Cloud Microservice Architecture Exchange Conference on January 20.

Serverless is a relatively new concept that began to emerge in the industry in 2017, and edge computing is a newer technology. So what kind of effects, products and forms can Serverless produce in edge computing and promote it in front of everyone? Let me share it with you today.

First of all, what is Serverless?

The following picture can clearly see that Serverless can be divided into two parts in terms of architecture.

  • One is Backend as a Service, backend is a service. Tencent Cloud already provides many such products, such as COS object storage, CMQ message queue, CDN content distribution, CDB cloud database, and API gateway. These products are more for carrying storage of data.
  • The second is Function as a Service, which is also the core technical point of Serverless. Tencent Cloud Function belongs to this category.

From the point of view of serverless or cloud functions, it is more about hosting the user's computing. The user submits the code and configuration to the cloud function platform. The code here refers to a code or code package of the user, the configuration, and the configuration of the function running environment, which environment is used, and the required configuration. memory, timeout, etc.; another is the configuration of the trigger. Because the entire function-as-a-service operation is triggered, an event source is required for triggering, and the event source is generated after being associated with other Tencent Cloud products. For example, the COS object storage product, its association is in the COS storage bucket. When the user uploads an image or deletes an image, an event will be generated, and this event will trigger the operation of the cloud function; for example, with the API gateway Docking can also be used as an event source. After the user's HTTP request reaches the gateway, the API gateway will forward the request to the cloud function as an event, triggering the operation of the cloud function. After the cloud function receives the request, it processes it and generates a response to the user. .

On the left side of the above figure, the code and configuration are submitted to the cloud function platform for saving. After the real event occurs, a function instance will be pulled up for each event to realize triggered operation; when the real event comes, the user function will run, and the user The data operation and cost calculation of the cloud function code only occurs when the code is running.

Because the function itself is managed, the user cannot perceive where the instance is running. There is a large computing resource pool behind the cloud function platform. After the user instance is triggered, we will randomly select a runnable location from the resource pool, and run the user's function instance in the corresponding location. Therefore, the entire scheduling process, or the function expansion and contraction process after the event comes, is carried out by the platform. For users, the granularity of scheduling is finer, and the scheduling is also hosted on the platform.

And from the whole calculation process, why does this product appear? For the traditional data storage process, after the data is generated, the data will be cached or stored first, such as in the form of object storage files, or stored in a structured form in the database, and then analyzed and applied. With the function service product, we can have a great speedup, and we can process the data immediately when the event occurs, so it becomes a process of processing first, and then saving the result for use.

Then, can the transfer process from intermediate data generation to data processing be shortened?

For traditional applications, data is generated by the user, transmitted to the cloud for processing, and then stored accordingly. The shortening of the distance mentioned here is actually to bring the processing process closer to the user, which can be regarded as the process of edge computing. And the proximity to the user here does not mean to speed up the network speed, but to issue more calculations and place them closer to the user.

Before, whether using containers or using hosts, computing power was provided on the cloud, but what edge computing has to do is to distribute computing power outside the cloud.

The concept of edge computing is to deliver computing power closer to real users and closer to the device side.

Why does this need arise?

With the rapid development of the Internet and the Internet of Things, more and more users and devices are connected, and in this case, the amount of data generated is also increasing. Whether it is an individual user or an IoT connected device, a large amount of data is being generated every moment. With the continuous increase of data, we are also required to respond faster and faster to users and devices, and the computing power of our own devices must be stronger and stronger.

A PC from 10 years ago cannot match the processing power of a smartphone today. As the computing power of the device is getting stronger and stronger, it has realized the ability to distribute computing power to more edge locations.

The current exploration of cloud functions starts from two aspects. The first is the direction of the Internet of Things. The Internet of Things mainly deals with devices and realizes edge computing on the device. From the characteristics of the cloud function itself, it is a trigger-type operation, and the operation will be pulled after the real data is generated. Cloud functions are dispatched by the platform hosted by the platform. Cloud functions can be dispatched to user devices. Second, cloud functions can be dispatched to CDN nodes. Although CDN can be considered as a part of cloud, CDN itself is very close to users. CDN nodes are actually is already at the edge of the cloud.

Next, I will give you a demonstration of the effect related to the Internet of Things.

Let’s briefly introduce several devices. The first is the Raspberry Pi, which is generally understood by students who are familiar with the Internet of Things; the second is a light-sensing sensor, which can sense ambient light and read the lumen value of ambient light from it; The third is the LED light.

At present, this device has been running, and what it does is when the ambient light is bright enough, the LED light will be dimmed, and when the ambient light is dark enough, the LED light will be on. During the demonstration, you can see that when I cover the photoreceptor, the LED light has an action of lighting up. The current ambient light and background is bright enough that when I turn it on, the LED light goes out because the light is bright enough.

I will give an explanation for this code. First of all, you can see that a function that is currently running on the Raspberry Pi has already been run on the Raspberry Pi. What you see on the Internet is the online code. Next, I will modify the code. As you can see from the code, when the lumen value read from the sensor is large enough, the GPIO will pull up or pull down, which is normal at present.

I just completed a modification, and now I want to send the code to the instrument to run, and pull up here to see if the value is correct. What is constantly refreshed below is the lumen value from the sensor. At present, the sensor has changed, because you can see that this value has exceeded 200, and the LED light is on. When I cover the photoreceptor, the LED light is dimmed. It is a change in behavior that is reversed through code.

We will also do actual device debugging in the current debugging process. What is demonstrated here is the effect of actually putting cloud functions on physical devices for execution.

Next, I will talk about the AI ​​capabilities currently promoted by cloud functions and users. The user data only needs to use CVM, GPU server, and Tencent TML machine learning on the cloud to conduct AI training to obtain the corresponding post-training model. The imported code is packaged and put into a cloud function, or a cloud function with GPU, which can provide AI reasoning capabilities to the outside world. When users actually use AI, they send a piece of speech, text or image that the user needs to reason about, and pull up the training model in the cloud function to reason about this data.

On the surface, AI capabilities seem to have nothing to do with edge computing, but they are not. If you already have the execution capability of cloud functions in the edge design of the Internet of Things, can you further consider sending AI capabilities to the device? For example, we collect and train data in the cloud, and after generating the model, Use the model to update the function on the cloud, and then use one-click delivery to deliver this capability to the device, so that the device has stronger AI capabilities.

In this way, more devices can be connected to AI capabilities. For example, the cameras at home can directly recognize faces and know your family members, or more medical devices can directly judge the results of medical examinations and identify diseases. type, etc. These will be the process of continuing to explore with various IoT manufacturers in the later stage and moving forward.

From another perspective, why do we do CDN edge computing? CDN itself is a process of putting data to the edge, and edge computing is to put computing to the edge. In order to respond to the user's operational needs faster, the data transmitted from the edge is processed faster, which is also the exploration of the edge by the cloud function.

For edge computing, what cloud functions need to do is that users can complete the writing and management of functions in the cloud, and run and use cloud functions in various locations at the required location.

Cloud functions will have a lot of exploration opportunities in edge computing in the future. CDN manufacturers, IoT manufacturers, hardware manufacturers, etc. will have continuous cooperation and development to explore and try to combine the edge IoT capabilities, edge AI capabilities, The edge CDN capability has been implemented.

Q&A

Q: Can Tencent Cloud Serverless be deployed by itself?

A: There are two types of self-deployment. One is the ability to deploy cloud functions to devices, and the other is the deployment of agents. The Agent itself needs to be deployed by the user to the user's own device. Today's demonstration uses Raspberry Pi. Agent is not limited to Raspberry Pi. It can run on a more powerful server, such as the device's GPU, device storage, and files for analysis and calculation.

Q: We want to deploy a similar serverless internally, can Tencent Cloud support it?

A: You are talking about privatized deployment. Cloud functions are not considered. The overall management of Tencent Cloud cloud functions is on the cloud. Edge computing provides more scheduling and computing capabilities at the edge. After functions are configured on the cloud, they are scheduled to Running on the device, the cloud function itself controls all the data reading on the device itself, and the reading does not need to go through the network, because the executed code package has been sent to the device, which reflects the concept of making the calculation closer to the data.

Q: If the code is set in advance and sent to the device, can AI also disconnect from the network?

A: Yes, the code runs on your device. Two cases, one is the edge computing of the Internet of Things that I just demonstrated. After its own code package is delivered to the device, it runs on the device, and it does not matter if the network is disconnected. Cloud functions themselves also provide AI capabilities, which are provided on the cloud, so they run on the cloud. For AI, the speed of productization on the cloud will be faster. At present, Tencent Cloud is already supporting some customers, and relevant operation instructions on the cloud will be provided later, so that everyone can experience AI capabilities online.

Q: Has Tencent Cloud released the IoT?

A: This has not been released yet, and it is still being commercialized. At present, it is also working with some customers to promote this capability. There are various IoT devices, including the underlying hardware environment, such as Raspberry Pi's ARM, or X86, or mips and other platforms. , For the kernel functions in Linux, the support of the file system, and the requirements for storage, memory, and CPU are also being sorted out.

Q: Can cloud functions be used for traditional applications?

A: The characteristics of cloud functions are triggered and short-lived, so they are different from the traditional operation methods of many development units. They are more inclined to new business development, or small new business launches. Or the use of elastic application capabilities is urgently needed. The traditional ones can be transformed, but some suggestions for transformation need to be provided at that time. The efficiency improvement is more in the speed of business development. In fact, there is no need to do too much operation and maintenance actions for the business operating environment, and there is no need to consider the expansion and contraction of capacity. The ability to expand and shrink is also handed over to the platform to reduce pressure on users, how to carry services after the business usage rises, and how to ensure that the business does not collapse. Cloud functions have solved this problem, and its own expansion can be understood as unlimited capacity expansion.

Q: Are there any additional plans for serverless online capabilities? Can Serverless programs and codes access the interfaces on the cloud host?

A: There are a lot of work being done at present, including edge computing, CDN, and various cloud products of Tencent Cloud. The greatest value of Serverless itself is the performance after connecting with various cloud products, which can be considered as the glue between various cloud products. Or a union of lightweight computations. The connection with the back-end, including the direct connection of databases and CVMs, is more of a network problem. The connection with the VPC network will be launched soon, and user VPC services can be directly accessed using cloud functions.

Related Reading

Use Tencent Cloud "Custom Monitoring" to monitor GPU usage

How to implement random forest from scratch in Python

A Preliminary Study on the Neural Network Model of Natural Language Processing


This article has been authorized by the author to publish in the Yunjia community, please indicate the source of the article when reprinting

Guess you like

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