There is hope in the never-ending challenge of delivering new applications rapidly, efficiently, and without errors: serverless architecture. It's 2024, and we're sure you've seriously considered adopting the serverless paradigm at least once in the past two years. If you're not yet convinced that this is the new way of working you should adopt, Nimród Földvári, IT Consultant, helps us provide some arguments.
Let's remember where we started...
Like almost everyone who has gained experience working in IT, Nimród began his career developing information systems with a monolithic architecture. "As the project progressed, the code accumulated more and more within the monolith, making it difficult to maintain a detailed overview of the architecture, even though it was layered. Additionally, debugging was challenging, requiring considerable time to identify a minor bug in a vast system," Nimród reminds us.
In addition to code complexity, major issues included scalability and deployment duration. Scaling the entire system was necessary, even if only one service was overloaded. Deployment was a slow process; even if a bug was fixed in 10 minutes, it took at least another half hour for the client to see the fix in production.
Microservices - more efficient. But sufficient?
Architecture based on microservices has greatly aided system development. Simplifying matters, programmers had the chance to see those monolithic "boulders" shattered into smaller, polished, and independent pebbles. Not without struggle, of course, as Nimród explains: "Though defining the context of each microservice was a challenge, delimiting the context was essential for an efficient architecture. Communication between microservices posed another challenge, requiring special attention to protocols and error handling."
However, once implemented correctly, efficient communication allows for optimal collaboration between microservices. Scalability has significantly improved, allowing for the independent scaling of each microservice. However, one problem remains: if one microservice is overloaded, the entire microservice needs to be scaled, even if the overload stems from just one overloaded function. Deployment has seen a significant improvement, but the same problem remains with scalability: the deployment unit is the microservice, not the function.
It's time to replace the server with code
Nimród discovered the serverless paradigm in 2022, and there was no turning back. Unlike microservices, which utilize more complex software components, serverless focuses on small and granular functions. These functions are orchestrated to perform complex workflows. Functions are triggered when specific events, such as HTTP requests, SNS messages, changes in DynamoDB tables, etc, occur. This triggering model leads to an event-driven development approach. Being independent and granular, serverless functions significantly differentiate themselves from microservices.
"Unlike microservices, where delimiting the context of each microservice is essential, the serverless paradigm completely eliminates this need. This greatly simplifies the architecture and eases the implementation process," explains Nimród Földvári.
And the advantages of the serverless paradigm continue...
Flexibility is another major advantage of serverless functions. Unlike microservices, which can be limited to certain programming languages, serverless functions can be written in various languages. This gives development teams increased freedom to choose the most suitable language for each function, considering factors such as performance, scalability, and ease of use.
Another key advantage of serverless is automatic scalability. Functions scale automatically (on demand), eliminating the need for manual configuration of server resources. Deployment speed is significantly higher, only being performed for the function affected by the change, reducing the required time and saving resources. If we fix a bug in a function, only that function will be deployed, taking only a few milliseconds.
However, the payment model represents the greatest benefit of serverless architecture. The traditional programming paradigm involves purchasing physical servers requiring pre-configuration and setup or renting virtual servers for a fixed monthly fee. In both cases, payment is made for resources regardless of usage. The serverless paradigm is based on a pay-as-you-go model. Only the resources used by functions during execution are billed, thus minimizing costs. A function is charged only if it is invoked, and the cost depends on the frequency of invocation, execution duration, and consumed resources.
A conclusion for programmers? Focus on the app, not on hardware.
The major benefit of serverless architecture is minimal costs for infrequently used functions. Unlike a fixed 24/7 physical server, a serverless function invoked only a few times daily will generate significantly lower costs. This model also contributes to a more sustainable environment, as reduced resource consumption diminishes the carbon footprint of serverless applications. Another advantage is eliminating server configuration and management operations (no-ops). Unlike self-owned or virtual servers, which require specific operational knowledge, serverless architecture completely relieves developers of this responsibility. The cloud provider handles all server-related aspects, providing a ready-to-use platform. Programmers can focus exclusively on software development activities, having more time to create and implement new functionalities. This leads to significantly higher productivity than a traditional DevOps developer juggling development (dev) and operations (ops) activities.
Of course, the serverless world is not perfect. Some challenges and difficulties need to be managed. But, for now, the positives far outweigh the negatives, so muster up your courage and try it.