What is the Serverless architecture?
Thanks to the original article: https://medium.com/@raviyasas/serverless-for-beginners-cc72a41a7c9e|
Technology is rapidly growing day by day. New technologies are being introduced to simplify dev works and make applications more efficient. I think you may have heard about?Serverless Architecture. In this article, I am going to describe more Serverless. Let’s begin the story. Here I am going to explain the below points.
Can we deploy web applications without Servers?
No, we need to have physical servers somewhere else to deploy our applications. There are web servers, file servers, mail servers…etc. Nowadays we are dealing with the cloud, all cloud providers already provide those specific services on the cloud.
Monolith to serverless
Years ago we were very satisfied with Monolithic Architecture. A bulky single application contains everything. Then we came across Microservices architecture to avoid the drawbacks of the Monolithic. Microservices use separate services that are dedicated to a specific task to perform. Now we are on another level with serverless. It simplifies services even smaller with functions. The important thing is, that these functions will be managed by a cloud provider, you do not need to care about it.
What is called Serverless?
Okay, no servers. Then as developers what should we care about?
The answer is “Serverless functions”
What are Serverless functions?
Serverless infrastructure providers
Most of the common cloud providers provide serverless functions enabling serverless services and functionalities.
Let’s see the comparison of the leading Serverless infrastructure providers in the next article.
How to select a database for serverless architecture?
This is another important factor. If we are working with Serverless, we need to have Serverless databases. There are two types of databases.
I assume you all know about the difference between relational databases and NoSQL databases. So I am not going to explain this.
Relational Serverless databases
Since we are dealing with Serverless architecture I encourage you to use NoSQL Serverless databases. But sometimes it might be required to use relational databases with your requirements.
Amazon Aurora
If you are using AWS, you can use Amazon Aurora RDBMS. This is fully compatible with MySQL and PostgreSQL. According to the official page of Amazon Aurora, they offer the features mentioned below.
CockroachDB
This is another cloud-based database that is compatible with PostgreSQL. Here are some features they offered as they mentioned on their official page.
PlanetScaleDB
If you are looking for a MySQL-compatible relational serverless database,?PlanetScaleDB?would be a choice.
领英推荐
NoSQL serverless databases
NoSQL serverless databases are very popular because they can handle a large amount of data in many forms.
Amazon DynamoDB
Google Firestore
Azure Cosmos DB
Advantages of Serverless
Over-provisioning means you are paying for some sort of server capacity, but you are not using this capacity. It looks like you are expecting traffic for 1M users, but you are getting 1K users.
Under-provisioning means your expected capacity is less than the required capacity. In simple words, you are expecting traffic for 1K users, but you are getting 1M. The server doesn’t have enough capacity.
Serverless functions allow you to pay only for the usage you consume. Please take a look at the pricing section of your cloud service provider.
Serverless models will automatically scale on demand. The cloud provider is smart enough to identify the required capacity and it will automatically scale high or low on demand.
You don’t need to worry about server maintenance, software/hardware upgrades, security updates, or anything related to servers.
Cloud providers guaranteed availability because their data centers are highly available and secure in different regions all around the world.
Serverless functions can be written in many languages. So developers who are skilled in different languages can work to gather.
Disadvantages of Serverless
It will take a little bit of time to wake up and return the response. Because some serverless functions will run on demand.
It depends on your traffic. If you are getting more traffic, your cost will be high. But compared to servers, it will reduce server maintenance costs, resource costs, and other specific server-related costs.
This is one of the major factors and the most contestable. If you are using AWS Lambda, you can use the?AWS toolkit?and debuggers. If you are using GCP, you can use the?Functions framework. Anyway, this might not be easy. Because your functions are there, authentication is somewhere else, and you may have an API gateway too. It will not be easy to replicate the complete production environment locally.
Happy Learning!
Senior Software Engineer ? Full Stack ? JavaScript ? PHP ? MySQL ? AWS
2 年Serverless computing offers a number of advantages over traditional cloud-based or server-centric infrastructure. For many developers, serverless architectures offer:- ? Greater scalability. ? More flexibility. ? Quicker time to release. ? Reduced cost.