[Fighting Cloud Native] Advantages and Disadvantages of Serverless Architecture

insert image description here
Serverless computing is an execution model where cloud service providers are responsible for executing portions of code through dynamic allocation of resources. In this model, customers only pay for the amount of resources they actually use.

Code typically runs in stateless containers and can be triggered by various events, including HTTP requests, database events, queue services, monitoring alerts, file uploads, and more.

1. So why choose a serverless model?

Also known as "Function as a Service" or FaaS, the serverless model can be an ideal solution to several problems that IT teams have traditionally encountered. When an application runs on a dedicated server and the company is responsible for provisioning and managing the underlying resources, it finds itself:

  • You have to pay for the server to run, even if no requests are actually being served.
  • Responsible for uptime and maintenance of the server and all underlying resources.
  • Server security updates must be managed.
  • As usage increases or decreases, the server must be resized accordingly.
    In small companies without an operations team dedicated to managing servers, and in larger companies with dedicated resources, performing these operations takes time away from the core activity: building and maintaining applications. This is where serverless computing comes in.

2. The benefits of enabling a serverless architecture

Serverless architectures are becoming more and more popular. In fact, according to research conducted by MarketsandMarkets, the industry's revenue is expected to increase from an estimated $7.6 billion in 2020 to an estimated $21.1 billion in 2025, at a compound annual growth rate (CAGR) of 22.7%. This growth in the adoption of serverless architectures is attributed to a series of advantages brought by the new development model. Here they come!

1. Pay as you go

Unlike infrastructure as a service (IaaS) models, which require renting hardware resources regardless of their actual usage, function as a service (FaaS) models are based on pay-as-you-go rates: when an event calls a function, it is strictly necessary to execute the function. Assets are paid within time.

Paying only for the value of the services actually used allows the team to focus on the development of the product and its unique features, rather than on the cost or implementation of the services that are really only integrated to support the main functionality.

2. Scalability

Scalability is a key factor for fast-growing companies as vertical or horizontal infrastructure expansion is required. A challenging task that often requires a lot of time and effort, with a corresponding increase in operating costs.

A serverless environment removes these limitations, allowing companies to start small and then support their growth over time without service disruption or costly unplanned changes.

3. Flexibility and adaptability

As the provisioning and management of computing resources is shifted to cloud providers, companies are able to rapidly adopt new technologies, allowing them to respond quickly and efficiently to business and market demands without worrying about infrastructure upgrades and all associated costs.

4. High availability and fault tolerance

In today's companies, it is well known that business relies heavily on IT: this is exactly why IT services must guarantee high availability. Cloud providers offer a well-designed global infrastructure that guarantees the availability and resiliency of customers' workloads.

5. Business Continuity and Disaster Recovery

Business continuity is a critical aspect of a company today, so activities must be supported by a solid disaster recovery strategy and plan. Cloud providers of serverless solutions offer advanced capabilities that help automate recovery of applications and underlying systems in response to any type of disaster (natural disaster, cyber attack, hardware defect, etc.).

3. Serverless Architecture: Key Aspects to Consider

While the advantages of adopting a serverless architecture are obvious and numerous, there is one disadvantage to consider. So let's take a look at the challenges and key aspects to keep in mind when deciding to adopt this new development model.

1. Supplier lock-in

For serverless architectures, vendor lock-in must be considered during the design and migration phases. Often, these types of architectures are easier to develop in the "walled gardens" of individual vendors.

This is exactly why the key issues that can arise when transitioning from one supplier to another must be clearly understood from the outset:

  • Not all vendors have uniform runtime and programming language support, even if they are slowly adjusting
  • Lack of standardized format for describing events that trigger serverless code execution
  • Some platforms are packaged and deployed using proprietary or in-house developed tools.
    To mitigate these issues, the Cloud Native Computing Foundation, responsible for promoting the spread of open standards for cloud-native implementations, maintains an observatory to track serverless offerings organized by category. CNCF supports the development of open standards and solutions such as CloudEvents (a standardized format for event data) and open products such as Knative for implementing FaaS services in the cloud and on-premises.

2. The challenge of estimating costs

Because the pricing model of FaaS services is purely pay-per-use, it is difficult to estimate costs. With no fixed fees, resources need to be paid when necessary, so companies often experience nasty surprises when applications are implemented into production.

It's a good idea to analyze quotes from different suppliers. From time to time, you may actually encounter significant differences in cost and the number of free tiers available.

An interesting estimation tool is the Serverless Cost Calculator, which allows you to simulate the cost of the most popular platforms, such as AWS Lambda, Azure Functions, Google Cloud Functions, and IBM OpenWhisk.

3. Cold start

In the serverless paradigm, we have seen that resources are only paid for when they are actually used. This is why cloud providers decommission resources when they are not actually being used in order to make this model economically sustainable.

The downside of this is that sometimes there may be an activation delay (cold start). A cold start is the delay between calling a function and the time it takes for an instance to activate and respond to a request.

Several factors can affect cold-start problems, including:

  • programming language used
  • Allocated and available resources
  • The number of dependencies and overall application complexity
    Therefore, it is important to work with each parameter to optimize the function's startup time, using the specific technology recommended by the vendor, such as AWS for Lambda functions or Google Cloud Platform for Cloud Run function.

4. Security risks

While all cloud providers offer advanced security systems, it should be remembered that servers serving multiple customers are naturally more susceptible to security issues than dedicated on-premises servers.

This is due to the larger set of event sources, which in turn increases the potential attack surface. Some of the most common risks are risks due to reliance on serverless functionality obtained from third-party software, such as open source packages and libraries, and distributed denial of service (DDoS) attacks.

4. Conclusion

While various challenges can be encountered when adopting a serverless architecture, in most cases the benefits gained outweigh the risks of critical issues.

In addition, some problems are obvious and easy to fix by carefully choosing vendor technology to avoid lock-in or implementing measures such as the options described earlier to mitigate cold starts.

Pay attention to the public number: Nezha programming

Nezha programming updates high-quality articles every week. After paying attention, reply to [CSDN] to receive Java mind maps, Java learning materials, and massive interview materials.

 

Add me WeChat: 18525351592

Pull you into the technical exchange group, there are many technical bigwigs in the group, exchange technology together, advance together, enter the big factory together, and you can buy technical books for free~~

Guess you like

Origin blog.csdn.net/guorui_java/article/details/124160172