What is a microservices architecture?
This software development method focuses on flexibility - but how does it work?
Microservices architecture is a form of application infrastructure that splits an app’s functions into distinct, self-contained components, which are then combined to achieve the desired outcome.
To best explain this approach, let’s take an example of an application designed to control a device’s on and off state using an SMS message. In traditional application development, every aspect of the app’s functions would be coded as part of a single codebase.
Under a microservices architecture, the three main functions of the app would be split into three separate microservices: one that’s designed to receive SMS messages and process them, one designed to interpret the content of messages, and another designed to take this interpretation and initiate a command of on or off.
The advantage of microservices architecture is that the individual components are independent of each other, meaning they can be deployed separately. They can also be swapped out for another if needed without having to recode the application. For example, if you decide you would like the app to trigger based on a tweet rather than a text.
This flexibility is typically not possible with traditional monolithic applications, where a change in function would require the entire app stack to be modified and redeployed – like baking a cake and trying to change an ingredient once it’s finished.
How do microservices work?
Microservice architectures practically go hand-in-hand with containersthese two technologies are almost always deployed together. Containers are self-contained platforms that host the minimum number of libraries required to carry out their particular functions, much like microservices, and function outside of nearby containers.
Due to their small size and the fact containers are easily configured, they’re an ideal conduit for microservers. Administrators need an orchestration layer to manage all the containers within their IT environment, however, such as Kubernetes. Kubernetes is widely considered one of the best tools for orchestrating containers, although a variety of options are available.
Although microservices can be established and run independently of the wider software application, communication is still essential between itself and other services so that the application can work as it should. Application programming interfaces (APIs) are the chief route through which this form of communication can be established, as these allow microservices to pass commands between each other as and when required. HTTP and REST (representational state transfer) is normally used for this.
Benefits of microservices
The main benefit is the stability that microservices provide, with components being easy to exchange when they need to be modified or replaced. Even the failure of one microservice not necessarily affect the performance of the wider ecosystem in any wide-reaching manner. While this depends entirely on the function of the the microservice in question, should a non-essential component fail, it should lead to the breakdown of one specific function, rather than the wider application. This structure and process also allows IT teams to identify issues in the chain.
Adopting this kind of architecture can also have benefits for the speed of development, too. Because functions within a microservices architecture are not interdependent, different teams with an IT organisation can be working on different microservices within the application at the same time. This means bug fixes and new features can be added faster, which is one of the reasons why DevOps and microservices often go hand in hand.
Containers are re-usable, too. If you have two applications that require the same function to be performed, you can create one microservice to do it and copy it across both applications. Another benefit is the fact that, because they're self-contained, microservices can be coded in any programming language.
Unlocking collaboration: Making software work better together
How to improve collaboration and agility with the right techDownload now
Four steps to field service excellence
How to thrive in the experience economyDownload now
Six things a developer should know about Postgres
Why enterprises are choosing PostgreSQLDownload now
The path to CX excellence for B2B services
The four stages to thrive in the experience economyDownload now