Microservices are smaller segments of an application that run independently of each other and can be deployed in various ways. A serverless microservice is deployed within a serverless architecture.
What is a microservice?
Imagine taking an application, chopping it up into pieces, and running it as a collection of smaller parts instead of one monolithic whole. That’s basically what a microservices architecture is. Each piece of the application is called a ‘microservice,’ and it performs one service only, runs independently of the other parts of the application, operates in its environment, and stores its data. Despite the name, microservices do not have to be small. What makes them ‘micro’ is that they only handle one service and are part of a larger application.
Think of an application constructed of microservices like an American football team, where each player performs a distinct role. Still, the players form a group (the whole application) that collectively accomplishes a goal. Or, think of microservices as the different systems in the human body (circulatory, respiratory, etc.), and the application as the entire body.
From the user’s perspective, an application built with microservices has a single interface and should work like an application designed as one stack. However, behind the scenes, each microservice has its database and runs separately from the rest of the application. In addition, microservices within the same application can be written in different languages and use other libraries.

Advantages of microservices
Resilience: Because the application is divided up, one part of the application breaking or crashing does not necessarily affect the rest of the application
Selective scalability: Instead of scaling the entire application, only the microservices that use much can be mounted.
Easier to add or update features: Features can be rolled out or updated one at a time instead of updating the entire application stack
Flexibility for developers: Microservices can be written in different languages, and each has their libraries
Can microservices be part of a serverless architecture?
Microservices can be deployed in various ways; they can be part of a serverless architecture, hosted in containers, developed using PaaS, or, theoretically, used to build a locally hosted application. However, the advantages of building an application out of microservices are perhaps most apparent when the application is hosted in the cloud, using containers, or in a serverless architecture.
What are serverless microservices? How does a serverless microservices architecture work?
Serverless microservices are deployed within a serverless vendor’s infrastructure and only run when the application needs them. Depending on the size of a microservice, it may also be broken up into even smaller functions. To learn more about how serverless computing works, see What is Serverless Computing?
What is the difference between a microservice and a serverless function?
The tech community is still defining this distinction, but typically, a microservice is larger and can do more than a function. A function is a relatively small bit of code that performs only one action in response to an event. Depending on how developers have divided up an application, a microservice may be equivalent to a function (meaning it performs only one action) or multiple functions.
Extending the football metaphor, consider all the duties of a quarterback: throwing passes, handing the ball off to the running back, and so on. If the quarterback is like a microservice within the context of the team (providing the service of ‘quarterbacking’), then each of these smaller activities is a function. However, the line between a microservice and a function can be blurred at times, just as certain players on a football team perform only one action, like the kicker.










