×
Community Blog Guidelines for Transforming from a Monolithic Architecture to a Serverless Architecture

Guidelines for Transforming from a Monolithic Architecture to a Serverless Architecture

This explores the concept of serverless computing in detail and includes case studies for specific scenarios.

1

By Buchen, Alibaba Cloud Senior Technical Expert

User needs and cloud development are driving the emergence, growth, and wide application of cloud-native technology. This article is divided into four parts:

  • What is a cloud-native application
  • The key elements of a cloud-native application
  • What is serverless computing
  • How serverless reduces technical complexity

This article includes case studies for specific scenarios in order to help you meet fast-changing needs and provide elastic, highly available services.

Digital transformation is a hot topic in all sectors, especially new retail, media, and transportation. Digital business models have become the norm and are gradually replacing traditional business models. In some sectors, such as industrial manufacturing, enterprises have not yet adopted digital business models but have started to fully leverage data technology to optimize production and operations based on the digital twin concept.

The digital transformation of enterprises can be analyzed from four perspectives: capital goods, relations of production, strategic planning, and growth curves.

  • Means of production: Data is a key factor of production. Enterprises have to deal with the high uncertainty that arises from constantly changing needs and risks.
  • Relations of production: This is a data-centric concept that does not change with processes and rules. The network effect frees relations of production from spatiotemporal limits. Multiple connection methods drive the development of new businesses and varieties.
  • Strategic planning: Decisions are made based on data to quickly deal with uncertain business environments.
  • Growth curves: Digital technology enables us to reach a large number of users, leading to explosive growth.

Let's look at the evolution of the cloud from the perspective of cloud service providers. In the Cloud 1.0 era, the development of cloud-based infrastructure was the major trend. Elastic resources were provided at low costs by virtue of various factors, such as cloud hosting, compatibility between off-premises and on-premises applications, and direct migration of traditional applications to the cloud. The cloud provides key capabilities to help enterprises accelerate innovation by better leveraging the robust computing power provided by the infrastructure.

It is costly to develop basic applications on servers, and such applications are difficult to manage. These problems are solved in Cloud 2.0, or the cloud-native era. In the cloud-native era, cloud service providers offer a wide range of managed services to help enterprises with digital transformation and innovation. You can develop applications based on cloud services using a building block approach, which significantly reduces R&D costs.

The Key Elements of a Cloud-native Application

A cloud-native application has three key elements: microservices model, application containerization and serverless implementation, and agile software delivery.

1. Microservices Model

The following figure shows the differences between the monolithic architecture and microservices model. In short, the monolithic architecture is easy to use but difficult to maintain. The microservices model is difficult to deploy and more suitable for cloud-native applications due to its improved independence and agility.

2
Differences between the monolithic architecture and microservices model

2. Application Containerization and Serverless

Containers are the most popular tool for packaging code. Based on Kubernetes and its ecosystem capabilities, containers make infrastructure management much easier and provide flexible and portable support for applications. Therefore, containers are widely used for application packaging. Serverless computing is another approach to application development and includes extensive end-to-end consolidation and cloud service integration to significantly improve R&D efficiency. Compared with containers, serverless computing is less compatible with traditional applications but provides a cleaner architecture that allows you to focus on coding and business logic innovation.

3. Agile Application Delivery Process

An agile application delivery process is important and involves process automation, a focus on feature development, rapid problem locating, and quick release.

Serverless Computing

1. Alibaba Cloud Function Compute

Serverless is a new concept, but its basic idea has been around for a long time. The first cloud services developed by Alibaba Cloud and Amazon Web Services (AWS) were object storage services, which are essentially serverless storage services. Serverless refers to a product system instead of a single product. Today, the new features or products launched by cloud service providers are mostly serverless. The serverless product system of Alibaba Cloud includes computing services, storage services, APIs, analytics, and middleware. Our cloud product portfolio is currently evolving toward serverless.

Function Compute, a serverless computing platform developed by Alibaba Cloud, provides the following features:

  • Seamless integration with the cloud: Function Compute is seamlessly integrated with various cloud services in an event-driven manner. This means you can focus on function development because event triggering is done by service providers.
  • Real-time auto scaling: Auto scaling for Function Compute is automatically completed by the system in a short time. This capability is applicable to online applications.
  • Billing in subseconds: Resources are billed in pay-as-you-go mode at an interval of less than one second. This avoids resource waste.
  • High availability: The Function Compute platform is deeply optimized to help you build highly available applications.

The preceding features of Function Compute are empowered by the capabilities shown in the following figure. Function Compute is developed based on the Alibaba infrastructure service and the upper computing layer is extensively optimized. A large number of capabilities and tools are developed at the application layer. By virtue of these capabilities, Function Compute provides a complete set of solutions in a variety of scenarios. Function Compute is a basic cloud service of Alibaba Cloud and the foundation for many products and features provided by Alibaba Cloud. Function Compute provides services in 19 regions around the world.

3
Schematic diagram of the capabilities provided by Function Compute

2. Simple and High-availability Design: Cloud-Native Applications through Serverless

It takes a lot of time and effort to build a complete, multidimensional high-availability system for cloud-native applications. Serverless computing can help you easily design and implement cloud-native applications with high availability. The following figure shows a high-availability system, which consists of an infrastructure layer, runtime layer, data layer, and application layer. High availability at each layer takes a large amount of work to achieve. Function Compute guarantees high availability through extensive optimizations made to fault tolerance, elasticity, traffic shaping, and monitoring. In the following figure, the issues in dashed blue boxes are handled by the platform and do not require your attention. The issues in solid blue boxes are partially handled by the platform and require your attention. The issues in solid orange boxes must be manually handled. This combination of platform features and manual operations makes it much easier to build a high-availability system.

4
Schematic diagram of the high-availability capabilities provided by Function Compute

Function Compute has been extensively optimized to help you build high-availability systems. The following figure shows the capabilities that Function Compute provides for zone-based disaster recovery. Function Compute implements load balancing to significantly improve disaster recovery capabilities.

5
Schematic diagram of the multi-zone disaster recovery capabilities provided by Function Compute

The following figure is a flowchart for asynchronous event processing by Function Compute. The processing pipeline is divided into three steps: event queue, event dispatching, and event consumption. Horizontal scaling is supported at each step. Event dispatching must match downstream consumption capabilities. You can specify different quantities of computing resources for different functions to adjust the consumption speeds of different types of events in a convenient and dynamic manner. In addition, you can create a custom error retry logic and implement backpressure feedback and traffic shaping so that the next service does not quit unexpectedly when a large number of requests are initiated in a short time.

6
Flowchart of asynchronous event processing by Function Compute

In terms of observability, Function Compute provides log collection and query features. The query feature supports default simple queries and advanced queries, allowing you to conveniently analyze logs. In terms of metric collection and visualization, Function Compute provides a wide range of metric collection capabilities and a series of views to display standard metrics and general information, which makes O&M easier. The following figure shows the schematic diagram of an application delivery process. Each step must be effectively implemented to ensure delivery agility, and automation is key to the efficiency and agility of the overall delivery pipeline.

7
Schematic diagram of an agile application delivery process

The following figure shows the tasks in each step of the automated application delivery pipeline. Infrastructure as code (IaC) is the prerequisite for defining templates and automating application runtime environment setup. These two tasks are necessary for automating continuous integration.

8
Schematic diagram of an automated application delivery pipeline

Automated application delivery can significantly improve R&D efficiency. Alibaba Cloud provides a variety of tools to help you implement IaC on serverless applications. Serverless allows you to pass different parameters to the same template to generate definitions for different environments, which can be managed automatically.

Function Compute provides multiple service versions and service aliases for the delivery and phased release of different application service versions. The phased release process can be streamlined into an API call process, which significantly improves business efficiency. These capabilities provided by the serverless computing platform significantly improve the automation of the software application delivery pipeline.

Function Compute also supports compatibility with existing applications. With custom runtimes, you can use Function Compute on many popular frameworks and serverless platforms and enable compatibility between Function Compute and traditional applications. On the Function Compute console, you can create and deploy applications and manage and monitor associated resources.

You can use a descriptive language to define serverless workflows to orchestrate different application stages and functions reliably. This significantly streamlines the orchestration of complex tasks.

Case Studies

Function Compute supports several typical scenarios, including web and API backend services. Successful cases include Shimo Docs, Weibo, and Century Mart.

Function Compute is applicable to large-scale parallel data processing. For example, you can trigger Function Compute for custom processing, such as transcoding or frame capture for many images, audio files, text, and other data uploaded to Object Storage Service (OSS). Successful cases include Hupu, Focus Media, and Baijia Hulian.

Function Compute is applicable to real-time data streaming. For example, you can trigger Function Compute for the stream processing of device-generated messages and logs that are sent to Message Queue (MQ) and other quasi-pipeline services.

Function Compute is also applicable to automated O&M. O&M tasks can be completed by calling functions through scheduled triggering, event triggers in Cloud Monitor, and process orchestration. This significantly reduces the costs and complexity of O&M. A successful case is TuSimple.

TuSimple is an AI enterprise that focuses on the R&D and application of L4 self-driving truck technology. It provides large-scale commercial operation technology for self-driving trucks worldwide to empower the global logistics and transportation industry. Road tests generate large volumes of data, which must be processed in complex and variable ways. Even for the same batch of data, different business teams may have different usage and processing methods. Therefore, effectively managing different data processing procedures and reducing the frequency of human intervention can significantly improve productivity.

Road tests are conducted irregularly, which results in high uncertainty in the start times and durations of workflow orchestration tasks. As a consequence, it is difficult to maximize machine utilization by establishing an independent process management system in a local data center, which results in resource waste. TuSimple already has many local unitized business processing scripts and applications. However, due to various limitations, the company cannot migrate all of them to the cloud. This means they must find a way to use cloud services appropriately.

For this reason, TuSimple began to explore automated data processing platforms. Alibaba Cloud Serverless Workflow is billed based on the number of scheduled jobs. Serverless Workflow is easy to use and integrate and features simple O&M. Therefore, it provides an effective solution to the preceding problems and is ideal for scenarios with irregular offline tasks.

Serverless Workflow also supports task orchestration for on-premises and user-created data centers. TuSimple uses Serverless Workflow's native support for Message Service (MNS) to solve the data communication problem between on-premises and off-premises data centers. This allows the company to properly orchestrate and manage local tasks.

In addition to scheduling, Serverless Workflow maintains task states and data generated during the execution process. TuSimple uses task input and output mapping and status reporting mechanisms to efficiently manage the lifecycle of each task in the workflow and the data transmission between tasks.

To adapt to business expansion in the future, TuSimple will continue to optimize the operational efficiency and automation of offline big data processing. By exploring various methods, TuSimple will further improve the efficiency of its engineering team and invest more in business innovation.

Summary

Serverless Workflow is a key part of Alibaba Cloud's serverless product portfolio. Serverless Workflow allows you to integrate multiple Alibaba Cloud services, such as Function Compute and visual intelligence platform, and user-created services. It also allows you to build flexible and highly available cloud-native applications through simple and intuitive workflow orchestration.

Alibaba Cloud launched Function Compute in 2017. By implementing auto scaling in real time based on application load changes, this service can scale thousands of instances in or out in 1 minute, ensuring stable latency. Function Compute supports the key applications of major users, such as Weibo, Mango TV, BGI Group, TuSimple, and Shimo, allowing them to easily cope with business peaks.

0 0 0
Share on

You may also like

Comments

Related Products