Parthenon Software Group


Exploring the Differences of Monoliths and Microservices

Posted by: Jessica Wilson 4 years, 9 months ago

When it comes to building architecture plays an extremely important role. Not only does it form a framework for things to comes, it also provides stability. And of course there are multiple architectural methods. From a development standpoint, that includes monoliths and microsevices.

Monoliths vs Microservices

As with most everything, there are benefits and disadvantages to both. Let’s take a look at some basics.

What all does Monolithic Architecture entail?

As the name implies, monolithic architecture refers to a single unit. Aside from being tried and tested to work well, the appeal of monoliths stems from the seemingly simple setup. Since all tasks are handled within one system, there’s no need to worry about about having to separate everything out. Moreover, request handling runs on a single process so programming is easier.

Need some examples? A good example of a monolithic application is a server-side application. This application handles all tasks from HTTP requests to retrieving and updating data on so on. In other words it’s an all-in-one. There’s also Microsoft Word. Big emphasis is put on feature routines, business rules and UI. All of these components are then rolled up into one program and distributed that way.

Monolith Benefits

  • Easy to develop

    • It’s one entity so you don’t have to account for additional pieces.

  • Simple to test

    • Since all tasks run on a single process, it makes things much easier to test.

  • Simple to deploy

    • Things aren’t as complicated so there’s less to worry about in deployment.

Monolith Disadvantages

  • Best used with smaller applications

    • Monoliths don’t have the capacity to handle the complexity of larger applications.

  • Applications can become unwieldy and more difficult to deploy if they become too large and complicated.

    • If anything becomes too large in and of itself, there can be problems.

  • Scaling can be an issue has applications increase in size.

    • The entire application needs to be scaled as a whole. This means consumption of resources as an application gets bigger.

  • Even the smallest change requires that the entire system be rebuilt and redeployed.

    • Everything is linked together and requires that everything be changed even if it’s just a small change.

What about Microservices?

Seemingly the opposite of monoliths, microservices are based off of distributed systems. The key process of distributed systems is dividing things up into tasks, which are then solved by different processes with message passing occurring between all of them. In the case of microservices, those tasks are addressed by services. These services are generally small and form service sets which aid in the overall goal of the application.

Because the tasks are broken up in a microservce, and each service has one and only one responsibility, resources aren’t depleted as quickly. Just keep in mind that there is a minimum of centralized management of the services. This leads into longer-lived applications. At the same time, it also means that larger applications are possible since the tasks have been allocated separately.

As for examples, think along the lines of the eBay, Netflix and Amazon sites. While these websites started out as monolithic applications, they have since made the transition to microservice applications.

Microservice Benefits

  • Code is easier to understand

    • You don’t have to wade through a giant mass of code to find what you’re looking for.

  • Greater productivity and speed

    • Less code is needed, which means it doesn’t slow down IDEs.

  • Independent deployment

    • Since the services are separate from each other, they can function on their own.

  • Scalability is easier.

    • There are more resources from which to draw, so there’s greater capacity for larger scalability.

Microservice Disadvantages

  • Complexity of creating distributed systems

    • While handling the complexity that monoliths can’t, microservices carry their own complexity as there are more pieces to consider.

  • Writing and running automated tests can be challenging

    • The extra parts much be accommodated in order of things to work correctly.

  • Elaborate distributed architecture can still slow things down.

    • Microservices can handle more complexity because they are more complex themselves, however this can create issues.

  • Greater expense

    • Services aren’t cheap.

After all of that, which is better?

Various ideas have been presented about the suitability of each approach. For the most part, people seem to be more pro microservice and anti-monolith given that scalability is a huge thing, Moreover, complexity can make a huge difference in the decision. That being said, they do have their issues and shouldn’t be considered a walk in the park. On the other hand, monolith proponents have said that monoliths can be the better option provided there is proper software  engineering to address and work through issues. Still, there’s another solution that involves a kind of combination of the two. While a monolith application remains at the core, new features can be creating using microservices.  

How do you decide? You could easily use either monoliths or microservices to address your situation, but the deciding factors come down to a number of things:

  • Which one aligns with what you want the best.

  • Are there specific features that you're looking for and if so, which pattern is going to best address that?

  • Which is going to be easier to maintain with the resources you have available?

  • Are you more willing to deal with the drawbacks (should they occur) of one pattern as opposed to the other?

Conclusion

While monoliths have been the norm for some time, microservices have emerged as an alternative to combat certain limitation in monoliths. However, that doesn’t mean that monoliths are completely obsolete. Just because others are gravitating to one more than the other, doesn’t mean that it’s going to be best decision for you. As always, it’s important to look at advantages and disadvantages of each and as much information as possible to make an informed decision.


Share this post: