Architecting Serverless Applications with Function Compute

Introduction and Background

Despite having logical modularity and segmentation in our monolith applications, the overall maintainability of microservices could be quite challenging. Moreover, there is a caveat, the deployment of single large application or package (which couples multiple modules) introduces multiple issues; complexity, finding out the problem area in the case of any exception or dependency conflict, resource consumption etc. That way, continuous deployment becomes a nightmare of epic proportion, because, these applications need some time to boot, setup caching and logging services etc., frequent deployment will kill the optimal performance.

Microservices Solve the Scalability Issue

Embracing microservices to deal with scalability issues in a monolith architecture is a prevalent business concern. Because, microservices solve the problems of scalability in a monolith application quite vigorously. Fundamentally, that means, we are splitting our monolith application into intractably divisible sub services which support their own architectural flow and business logic. For instance, think about scaling certain components for specialized features related to some specific tasks. Unlike monolith architecture, microservices come with scaling only the required components (individual and autonomous services). This way, we can scale technology, aspects, and architecture refactoring without disturbing or risking the overall performance of our solution.

But How Do We Handle Scalability in Microservices?

Ironically, scaling your application from monolith to microservices is not the end of the problematic world. At the larger scale while working on microservices-based architecture requirement comes when we strongly need to concern about the scalability in those applications too. However, the process of scaling microservices application is entirely different than that of scaling monolith application, moreover, it demands highly capable and skilled engineers and is a super-challenging phase for any application.

From Microservices to Serverless

The major benchmark associated with the serverless approach is that we must execute only the functions without caring about the overall infrastructure, and obviously all the headache of maintainability, tooling, scaling etc. One should opt for serverless computing mainly if your application requires the execution of code only when some certain event triggers, and obviously you do not want to pay unnecessarily for the resources which you are not using or using less. Though, moving to serverless makes things oversimplified but significantly beneficial for overall business development.

Operational Overhead

Alibaba Cloud Function Compute takes the operational load from your hands entirely. And everything seems magical because the management is entirely abstracted away from you. However, under the hood, you know the underlying steps which are being taken to support the all the operational overhead of your system. All you need to do is write code for the standalone functions to get triggered and manage a code repository for your code.

Event-based Architecture

As discussed, it supports an event-based architecture which means you get flexible resource-consumption, expeditious development and deployment process which automatically scale up your business productivity.

Lower Cost

Serverless approach can cut the functions cost which are not being used frequently. Eventually, it helps you to balance your cost in the seasonal occasions as well because you can better recognize the most accessed functions which cuts the unnecessary cost.

Lifting-and-Shifting a Web API

Now, let us discuss a simple scenario where we might have to lift and shift an existing Web API to Alibaba Cloud Function Compute platform. A common API will have several HTTP endpoints configured for itself, so a typical catalogue microservice will have several HTTP endpoints set up, some of them will be returning a complete list of items in the database, some will show the categories that are available, some will show the most recently viewed items and some might just show an item itself. If you see a pattern here, then you can study that every user, and in most cases, majority of the users will not be viewing these pages in any time of day. They will at maximum, visit the home page, sometimes they will review the categories and hardly they will visit the recently viewed pages as they might have already found the product, or they will move away to other services — such as a search service in our solution.

Original Source

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com