Edge Serverless: Core Values and Applications for Global Users
The booming digital economy, coupled with the active innovation in key industries, has made digital technology a new battleground for enterprises in various sectors to enhance their competitiveness. Among them, Edge Serverless seamlessly integrates the technological advantages of edge computing and serverless architecture, shortening data transmission paths, simplifying operational complexity, and revitalizing edge computing resources. This paves a new way for the digital transformation of all industries in the context of interconnected and intelligent devices. Through this article, you will gain insights into the typical application scenarios, solutions, and principles of edge functions.
What is Edge Serverless?
Edge Serverless and edge functions have a close relationship. Edge Serverless is a cloud computing architecture that allows developers to deploy, run, and scale applications without managing servers. In the Edge Serverless architecture, developers only need to write code logic, while the underlying resource management, runtime environment, and scalability are automatically handled by the cloud service provider. Edge Serverless applies this serverless computing model to edge computing scenarios.
Edge functions and edge components together form a complete edge serverless ecosystem.
What is Edge Functions?
Edge functions refer to the execution of serverless cloud functions on devices or systems such as IoT devices, cloud servers, local virtual servers, or physical servers owned by users. They provide capabilities such as cloud function execution, message forwarding and caching, and secure communication with the cloud. The capabilities provided by cloud functions can be seamlessly migrated or extended to user devices.
The main features of edge functions are as follows:
- Deploying computing tasks close to the data source, reducing data transmission latency and improving response speed.
- Automatically scaling computing capabilities according to demand, supporting rapid iteration of devices and applications.
- Reducing the burden on cloud servers, lowering data transmission and storage costs.
- Enhancing data security, as some sensitive data can be processed locally without being transmitted to the cloud.
Edge functions can be applied to scenarios such as IoT, smart homes, smart factories, and intelligent transportation. By running serverless cloud functions on edge devices, real-time data processing, device control, and status monitoring can be achieved. Edge functions are a key component of the Edge Serverless architecture. They are lightweight, scalable computing units that can run on edge devices. Edge functions typically execute in an event-driven manner, meaning they automatically execute the corresponding code logic when specific conditions are met or specific events are triggered. This approach can effectively reduce resource consumption and improve computational efficiency.
What is Edge Components?
Edge components are modules in edge computing systems that perform specific functions. They are typically deployed closer to the data source, such as IoT devices, gateways, local servers, etc. The primary purpose of edge components is to process data in real-time where it is generated, reducing latency, decreasing data transmission volume, and increasing data processing speed. Here are some common edge components:
- Data preprocessing components: Responsible for cleaning, format conversion, aggregation, and other operations on raw data for subsequent processing and analysis. This can reduce data transmission volume and improve data quality.
- Edge storage components: Provide temporary or long-term data storage capabilities, caching data generated by edge devices to alleviate the burden on cloud servers.
- Edge computing components: Execute computing tasks on edge devices, such as image recognition, speech recognition, machine learning model inference, etc. This can reduce latency and improve computational efficiency.
- Security components: Responsible for the security management of edge devices, such as encryption, authentication, firewalls, etc. This can protect data security and prevent unauthorized access.
- Device management components: Responsible for the configuration, monitoring, and maintenance of edge devices. This helps improve device availability and reduce operational costs.
Edge components can be combined and customized according to actual needs to meet edge computing requirements in different scenarios. Through edge components, developers can achieve lower latency, higher performance, and better data security.
Use Cases of Edge Serverless
1. Edge Side Rendering: Boosting Web Performance and Experience
In the field of web development, there are two main methods for rendering web pages: Server-Side Rendering (SSR) and Client-Side Rendering (CSR). Although these two methods serve the same ultimate goal, they have different processes and advantages. Choosing the right rendering strategy when building a web application is crucial for optimizing performance, improving user experience, and enhancing SEO.
CSR:
In Client-Side Rendering (CSR), the browser downloads the minimum HTML page and the JavaScript required for the page. JavaScript is used to update the DOM and render the page.
- Advantages of CSR: Front-end and back-end separation; front-end code can be accelerated using CDN as static files;
- Disadvantages of CSR: Code is exposed on the client-side, resulting in poor security; SEO support is lacking; slow initial loading speed, resulting in a white screen;
SSR:
Server-Side Rendering (SSR) is a technology for rendering web content on the server-side. The server generates HTML and sends it to the client.
- Advantages of SSR: Good security; strong SEO support; avoids white screen caused by loading JS;
- Disadvantages of SSR: Time-consuming back-to-source requests; high server load;
ESR:
To integrate the advantages of both CSR and SSR, the industry has made many technical attempts (SSG, ISR, isomorphic rendering, etc.). The Edge Side Rendering (ESR) solution introduced in this article breaks the limitations of optimizing rendering from a technical perspective and proposes a new architecture to solve page rendering problems.
Edge Functions provide an edge node Serverless code execution environment. By writing business function code and setting trigger rules, without configuring and managing server infrastructure, code can be elastically and securely run on edge nodes close to users.
With the Serverless environment provided by edge functions, we can move the code originally running on the server to edge nodes closer to users, solving the problems of long SSR back-to-source request time and high server load while retaining the benefits of fast initial loading speed and good SEO support.
At the same time, since ESR still maintains the client-server pattern (ESR's server-side is the edge node), optimization solutions like isomorphic rendering can also be perfectly ported to the ESR scheme. Relying on global network of edge nodes and the edge function serverless environment, ESR performs page rendering on edge nodes close to users, offering the following advantages:
- Fast page loading speed: Distributed edge nodes are close to users, avoiding latency caused by back-to-source requests.
- Good user experience: Page rendering is completed on edge nodes, avoiding white screens caused by loading JS.
- Low service pressure: Distributed edge nodes balance the load, easily handling extreme situations such as surges in requests.
2. Edge Storage
Edge Cache:
Caching is a common concept in system development. By caching resources locally in memory, disks, etc., the system's throughput can be greatly improved, and the pressure on external dependencies can be reduced. In edge Serverless nodes, resources such as device memory, solid-state drives, and mechanical hard drives can be organized to form a cache cluster with different access rates, performance, and costs, exposed to developers through the edge function Runtime API. Developers do not need to worry about the form of resource storage, and only need to bind the appropriate caching medium to the Runtime according to business requirements for latency, cache level, and cost.
Edge KV Storage:
KV storage is a common type of persistent storage component in system development, used to store "key-value" data such as user information and task status. Since edge Serverless nodes themselves may experience frequent online and offline situations, it is not suitable to store persistent data in a single edge data center. For edge KV storage, a multi-location storage and global synchronization mechanism can be adopted. That is, multiple devices in multiple data centers form a storage cluster to store persistent KV data in an eventually consistent form. At the same time, when a write event occurs, KV caches of global edge Serverless nodes can be automatically pushed using message queue subscriptions, allowing users to read KV data with low access latency worldwide.
Edge File Storage:
Similarly, the system can provide edge file storage capabilities in a form similar to KV storage, allowing users to easily store or read file content.
3. Edge Image Processing
Images are a very common resource type in edge traffic. Many users need to return images with different compression formats or sizes based on factors such as terminal type, resolution, and network quality.
In the traditional central computing model, the central component of image storage usually performs secondary processing of images, caching multiple copies of content at the edge according to request information. This process often results in unnecessary central computing power and traffic waste. Processing the above process within edge Serverless nodes can naturally avoid these problems. By providing built-in image processing services, developers can complete secondary image processing within edge nodes. At the same time, edge nodes are closer to users and can more clearly perceive user network quality information, making more accurate and richer image processing decisions.
4. Edge Middleware
Scheduled Tasks:
In some application scenarios, the execution of edge functions is not triggered by actual requests but is periodically executed by themselves, such as network quality detection, information collection, and data cleaning. For these application scenarios, edge Serverless nodes can provide scheduled task capabilities, allowing users to drive several nodes to execute globally on a timed basis according to their requirements.
Message Queue:
Message queues are a common component, often used for task assignment, result notification, and component decoupling scenarios. By providing message queues and subscriber patterns for edge functions within edge Serverless nodes, developers can build more complex multi-module applications. For example, using scheduled tasks to drive edge functions that act as task controllers to publish network detection tasks, then having global message queue consumer edge functions consume these tasks, complete detection requests, and collect data through log push capabilities. Finally, drive data cleaning edge functions to aggregate data through scheduled tasks.
Edge Functions in Tencent EdgeOne
Tencent Cloud Edge Functions, part of Tencent Cloud EdgeOne, offer a serverless code execution environment on edge nodes. This allows you to concentrate on creating business function code and setting up triggering rules without dealing with infrastructure management, such as server configuration. As a result, your code can be executed securely and elastically on edge nodes nearest to users.
If you are interested in experiencing these benefits firsthand, feel free to contact us to learn more about Tencent EdgeOne and its features. You can also click here to get started free and experience its benefits firsthand.