Using Microservices without a Server
A microservice is a piece of software that is responsible for making a specific task within the system. An example of this is Auth0, which provides an API to manage user authentication. Another well-known microservice is Algolia, which can index the content we want and deliver an API to search instantly.
On the other hand, we have the term serverless. But serverless microservices aren’t entirely without the server. It seems confusing, but the idea is very simple. With the rise of the microservices, people are looking to delegate certain tasks of our application to third – party services, which only need to run a script that makes such requests to third parties.
To understand this concept clearly, let’s see what is Serverless microservice, and what purpose do they serve?
What is a serverless microservice?
This software architecture allows the developer abstracting server, infrastructure, and complicated configurations, leaving the complex tasks in the hands of third parties.
You can find microservices for almost anything; some are free and mostly paid but with a layer of free use, which allows you to test some of their functionalities. An example of this is the AWS Free Tier, which can store information on their servers without paying anything, to certain limits.
Now the question is what is the difference between an architecture with the server and without the server or serverless?
Nowadays this is most commonly use in app and web services. In it through a browser the client makes a request to the server that stores your application or website; this, in turn, makes a request to the database, which may or may not be on another server.
Then, the information returned from the database to the server, it processes the information and returns the information to the customer.
It is a new form of architecture that is gaining popularity in 2016. In this, the request is intercepted by a gateway, or API Gateway, which is responsible for redirecting traffic to the corresponding microservices.
In the image example, it is forward to an authentication service (such as Auth0); then routes it to a service that gives your user access to a subset of your database. The search and purchases function are handled by Fass – Functions as a Service; we will explain it a little later. Finally, we have the Purchase database, which resides on our server.
As mentioned earlier, the FaaS or functions as a service are small scripts that perform specific tasks and limited tasks.
Some advantages of FaaS are:
- They run without complex configurations on the server.
- They weren’t written for any particular library or framework.
- The deployment of the application is different: you only need to upload the code, and the service provider does take care of the rest.
- The Horizontal scaling is automatic and handled by the provider.
There are some providers to run FaaS. One is AWS Lambda, which comes with complete documentation for you to implement it.
Benefits of Serverless Microservices
- Reduce setup time.
- Abstraction of infrastructure, configuration, server maintenance.
- Cost reduction of infrastructure and services DevOps.
The serverless software architecture allows us to launch a product or service cost effectively, and you don’t have to waste time to develop everything from scratch. Additionally, you can avoid everything related to configuration and server administration.
Despite those incredible benefits of serverless microservices has some enormous drawbacks. We will talk about it later.
You might be also interested in: Understanding Docker – Free eBook