Microservices X Monolithic Applications

Microservices X Monolithic Applications

What are the advantages and disadvantages of using a monolithic architecture against using micro services?

Do you know which one is better?

Everyone and their dogs nowadays want to start writing any system using microservices, and of course sometimes microservices are the way to go, but as anything in engineering there is no silver bullet, and defining the architecture for one system requires a lot more than following the tides of every other influencer on the web.

Many factors will influence the decision of what architecture to be used, for example:

  • Programming language and framework being used
  • Knowledge of the team involved
  • Previous experiences
  • Time and budget available
  • Previous systems in the company
  • Business needs (this one is usually forgotten even thou it is the most important)

For example, if you are writing a simple MVP, starting the MVP using microservices is usually a bad idea, unless you already have some of the services available and will create another one as the MVP.

Of course if your MVP is for a credit card processing product or something with similar complexity, starting as a monolithic application might also be an error.

If the development team is small, you probably want to go with a monolithic approach, because it'll be only one application to maintain instead of many.

If you have many developers that can be split in many different teams, each team handling one service, going with microservices might be a better idea since it'll be easier to work in parallel and get things done faster.

If you'll start with microservices you'll need to define exactly what data will be exposed and what will be the API entry points for each service.

If you'll start with a monolithic application those aren't initial concerns because all data is inside the same application.

Lets list a few differences of each approach:

  • Deployment: Monolithic applications are deployed as a single unit, whereas microservices are deployed independently.
  • Scalability: Monolithic applications scale as a whole, while microservices can be scaled independently.
  • Development: In a monolithic architecture, changes to one part of the application often require redeployment of the entire application. In microservices, changes to a single service can be deployed independently.
  • Technology Stack: Monolithic applications typically use a single technology stack. Microservices can use different technologies for different services.
  • Tests: Monolithic applications can reference securely other parts of the application in automated tests. Microservices have to mock services from the other parts of the application and when the other app changes these changes aren't detected in the automated tests causing connection issues and the tests not breaking due to api changes, these changes sometimes only being detected in QA or production, unless the teams have a really good communication and schedule the API changes really well, with deprecation and versioning, causing a lot more work for API changes.
  • Remote connection: this isn't exclusive to microservices but it affects this architecture a lot more, if you need to talk to a service in another application, you need a wrapper that will handle correctly when the network fails, meaning returning a default value, or returning a user friendly error due to network issues, and network issues always happens, maybe these can be handled by caching, by chain of responsibility, ... but this needs to be handled by every service you need to access in your application.

In summary:

Micro services solve a lot of problems of scalability, they help part of your application scale and when needed, for example because one part needs to be written in a specific language and other parts in another, they are a great architecture.

Not only these but they solve a lot of complex problems, but also aggregate a lot of complexity in the software deployment and development.

Monolithic applications are a lot simpler to write, and solve most problems in a really simpler way than the alternative, most people doesn't need microservices and will write better and faster software using this architecture. And if the application and company grows enough that you have the type of problem that require microservices there will be enough budget for the extra developers and extra complexity that will come with the refactoring.

Don't start anything with more complexity than what you need, remember one of the more important mantras of software development KISS (Keep it Simple Stupid!)

But again, if you have the kind of problem that really require microservices, go for it, just don't suggest that everyone do the same because every problem is different and most software don't need that complexity.

And if you've read up to here, what is your opinion on Monolithic X Microservices?


To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics