Microservices and Microservice Architecture Explained
If your system still runs with traditional monolithic architecture, you may have started looking to make a change. Everybody seems to be doing microservices these days, so what are the differences between a monolithic system vs microservices (or microservice architecture), and how do these differences affect your business?
Monolithic Architecture vs Microservices Architecture
What Is Monolithic Architecture?
In the good old days (not so long ago), computer systems were developed in large units of deployment – this is what is known as monolithic architecture. A web-based system may have been developed as a website with lots of code that directly read from and wrote to many databases.
Many well-known brands started out their online presence using monolithic architecture, including Netflix and Amazon.
Advantages of Monolithic Architecture
- Deploying it seemed to be pretty simple; it was a single, large web site that needed to be installed on a target server. Other systems (batch systems, mobile apps etc) were developed in the same way.
- Having all of the code in one place meant debugging is slightly easier, as it’s easier to follow a request to pinpoint a problem.
- Monolithic architecture can be scaled horizontally by simply creating copies of the code and leveraging a load balancer to ensure functionality.
Disadvantages of Monolithic Architecture
- The code powering monolithic architecture in applications tended to be tightly coupled. This means that individual pieces of code were hard to re-use elsewhere, which led to many developers having to maintain multiple redundant copies of similar code. This was frustrating and expensive.
- Testing effort was duplicated between systems that performed similar business operations. For example, a pricing system re-used (copied and pasted) between systems could only be tested as part of testing the system as a whole. So, if pricing changes were made, every system that included a variant of the pricing logic would need to be tested.
- Deployment proved to be harder than expected. Although deploying a single large system sounded easy, it meant that updates to very small parts of the overall system required the entire system to be redeployed. This meant downtime for unrelated aspects of the system, which was inconvenient for users.
- A small error in one small area of the web site programming could bring down the whole web site.
- The tight coupling of code and creation of a single, big system meant that entire business operations and capabilities were copied and pasted between applications, rather than being easily re-usable between applications.
- Code ownership was frequently unclear between software development teams. This meant that problems went unaddressed and potential improvements were overlooked.
What Is Microservices Architecture?
Microservices are independently deployable, small, business focussed services that are easy to maintain and test, loosely coupled to other systems and components and (typically) owned by a specific development team.
Instead of deploying a single large system, a microservices architecture deploys many loosely coupled components (called services). These services typically communicate via a dynamic binding mechanism such as HTTPS, Enterprise Service Bus, TCP/IP or similar mechanism.
Microservices can be used in the development of composable architecture to create a modular and flexible solution – you can learn more about the architecture of a composable eCommerce store in our blog.
Advantages of Microservices Architecture
A microservice architecture creates an eco-system in which components are loosely coupled, independently deployable, easy to test, focused on business objectives and owned by a specific team.
- A small change requires re-deploying only the affected service, thus reducing downtime and the technical impact of the change. This is a key advantage of microservices over monolithic architecture, as reduced downtime means a more efficient and effective flow of work, particularly where issues are minor.
- Microservices are focused around business operations rather than technology. This means that business functions can be re-used across different computer systems without copying and pasting code everywhere. Referring back to the example above, we could create and deploy a pricing service that other systems will access over HTTPS (e.g. a RESTful web service). When the pricing mechanism changes, ONLY this service will need to be changed.
- Testing is more streamlined. When the pricing mechanism changes, testing can be localised to only the pricing service (providing that the interface to the pricing service has not changed). This yields shorter overall lead times and lower costs.
- Individual services within a microservice architecture are frequently owned by a specific team (this is an example of Conway’s Law). This means that there is clear overall responsibility for each service and each service gets the care and attention it needs to remain robust and secure.
Disadvantages of Microservices Architecture
- Microservices architecture comes with a more complex deployment process, as tens of services may need deploying rather than just one big component.
- With more teams involved in the creation, maintenance and running of microservices, the software will require proper management, or it can become difficult to handle.
If you would like to discuss whether microservices or monothlithic architecture are the right fit for your business, or explore any of our other bespoke software development services, please get in touch with McKenna Consultants today.