on
Advantages & Disadvantages of Microservices
Microservices are a form of service-orientated architecture - we won’t go into too much detail on what they are, but we will discuss their pro’s and con’s here. As with all architectures, there is no right way that everyone should use so discussing their plus points with the potential issues is important.
Advantages
First a quick look at why you should use them.
Independent Technology
Using microservices to split up your infrastructure allows you to use different technology/programming languages/tools very easily. More than this, it means the languages that you do use for a single service are often easier to update and maintain as the list of dependencies and legacy code attached to them is less and with a large monolith system.
Robustness
A well designed microservice architecture has the advantage of being more robust (when built correctly). This is because non-business critical services can go offline with little impact. Compare this to a monolith and it’s possible the entire system could go offline if that system is impacted.
This is especially true of services built will async messaging queues. As a service may be able to go offline, but the ‘jobs’ don’t disappear: the orders are still taken, the emojis still received and the photos still uploaded. They just aren’t processed until that service can be brought back into action.
Scaling
Whereas with a monolith you may have to scale everything together, vertically (more power) or horizontally (more machines). With a microservice architecture you can scale independently the parts of the system which need it. So if one part of the system is constantly under high load, you can independently scale just this service.
Organizational Alignment
One of microservices greatest advantages is not a technological one, but a social one. The ability to split complicated systems into smaller parts, so each of these parts can be worked on independently by a specialist team. The boundary between microservices is a convenient way of doing this. It’s possible with monolith systems but much more ‘fuzzy’ in the team boundaries.
Deployment
Almost by definition, micro services should be independently deployable. This is an advantage because it can reduce deployment congestion when compared with large monolith systems. It also means there’s potentially less risk, a deployment which goes wrong could take down a service but is less likely to take the entire system down.
Disadvantages
Developer & Tech Overload
The development experience can become more complicated with micro services. While a single developer machine might be able to run a few services easily it might struggle with the entire system. That together with a suite of tools and knowledge which is often required to work on microservices can come with challenges.
Cost
Having many services running, can initially be more expensive to run. In the long term however they can be equal or cheaper as they become more efficient. But the initial costs should be especially noteworthy for startups.
Reporting, Monitoring & Troubleshooting
The complexities that come with microservices mean that reporting can be more complicated. You’ll need to aggregate logs across services to both understand the system and work out any performance bottlenecks. This process is more complicated with microservice architectures.
Security
That’s not to say microservices are insecure, it’s just that there’s more data that needs to be communicated between services and more chance of interception.
Testing
Testing across services can be become more complicated - do you try to mock other services? Or use testing versions of them? Or run on-production tests? These are some the questions you might have to answer when building microservices. With a single system it’s easier to re-create the entire environment to test against.
Latency
Like security and testing above, latency is necessarily a problem but perhaps needs more attention. With an increase in communication and services the latency of the application might increase. With a monolith application communicate is quick as it will often inter-process and stored in ram.