What is a microservices architecture?
This software development method focuses on flexibility - but how does it work?
Microservices architecture is a type of application infrastructure that separates the functions of an application into smaller, self-contained parts, which can then be reused for other purposes.
To explain, take this example of an application created to control a device's on and off state with an SMS message. Within traditional application development, every aspect of its function is coded as part of one central codebase.
However, under microservices architecture, the three main functions of the app are instead split into three: one that's designed to receive SMS messages and process them, one created to interpret the content of messages, and one more built to take this interpretation and initiate a command of 'on' or 'off'.
An advantage of microservices architecture means that the individual components are independent of one another, which allows them to be deployed separately. So if need be, you can simply swap out one for another without having to recode the entire application - you can change the app to trigger based on a tweet, rather than a text, for example.
There is no such flexibility with traditional 'monolithic' applications, where a change in function would need an entire app stack to be changed and redeployed. A bit like baking a cake and then trying to change its ingredients after you'd pulled it out the oven.
How do microservices work?
Microservice architectures practically go hand-in-hand with containers; these 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 business value of Red Hat Runtimes
Challenges and opportunities of Red Hat RuntimesFree download
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.
2022 State of the multi-cloud report
What are the biggest multi-cloud motivations for decision-makers, and what are the leading challengesFree Download
The Total Economic Impact™ of IBM robotic process automation
Cost savings and business benefits enabled by robotic process automationFree Download
Multi-cloud data integration for data leaders
A holistic data-fabric approach to multi-cloud integrationFree Download
MLOps and trustworthy AI for data leaders
A data fabric approach to MLOps and trustworthy AIFree Download