Spring Boot microservices

This post will make you understand the basics of microservices and its architecture.

What you get to know :

  • What is a Monolith application?
  • What is a Microservice?
  • What are the Challenges with Microservices?
  • How does Spring Boot and Spring Cloud make developing Microservices easy?

What is a Monolith Application?

If you have ever worked in a project of this sort where

  • A team is of size say more than 20 working for it
  • Application is of hundred thousands of lines of code.
  • The application has wide range of functionalities
  • Debugging is a big challenge
  • Introducing a new technology is a big challenge or nearly impossible.
  • And you release it to production one each month

Then the application has characteristics of a Monolith application.

Challenges which are faced here :

  • Scalability one of the greatest Challenges.
  • Difficulty in new Technology Adoption/introduction.
  • Adapt new Processes – like Agile?
  • Difficult to Automate Tests.
  • Difficult to Adapt to Modern Development Practices

Microservices

To overcome the challenges faced in Monolith application came the Microservices, which are scalable and easy to adapt to new technologies.

So what are Microservices ?

As defined by some experts, Developing an application as a suite of small services Each running in its own process and communicate with light weight mechanism(often as HTTP resource APIs). These services are independently deployable by automated systems and these may use independent or different data storage technologies.

So a few important characteristics which defines a microservice can be :

  • Small units which do their job and are easily deployable.
  • They communicate via HTTP REST calls or triggered event based.
  • Which are easily scalable.

Advantages of Microservices

  • New Technology & Process Adaption becomes easier. You can try new technologies with each microservice that we create.
  • Faster Release Cycles – You can adopt agile development methods, create microservices which are easy to maintain and deploy.
  • Scaling with Cloud is really simple.
  • Easy Automation Testing because of smaller units of microservices.
spring boot monolith-architecture

Vs

spring-boot-microservices-architecture-vs-monolith-architecture

Challenges in Microservice Architectures

While developing a number of smaller components might look easy, there are a number of inherent complexities that are associated with microservices architectures.

Lets look at some of the challenges:

  • Fast Setup needed : You cannot spend a month setting up each microservice. You should be able to create microservices quickly.
  • DevOps Automation : Because there are a number of smaller components instead of a monolith application, you need to automate everything – Builds, Deployment etc.
  • Monitoring & Visibility : You now have a number of smaller components to deploy and maintain. Maybe 100, 1000 or maybe more. You should be able to monitor and identify problems automatically. You need great visibility around all the components.
  • Bounded Context : Deciding the boundaries of a microservice is not an easy task. Your understanding of the domain evolves over a period of time and so does the scope of a functionality. You need to ensure that the microservice boundaries evolve.
  • Configuration Management Solution : You need to maintain configurations for hundreds of components across environments so You would need a Configuration Management solution.
  • Configuration Management Solution : You need to maintain configurations for hundreds of components across environments so You would need a Configuration Management solution.
  • Fault Tolerance : If a microservice at the bottom of the call chain fails, it can have knock on effects on all other microservices. Microservices should be fault tolerant by Design so no other service bears its impact.
  • Debugging : When there is a problem that needs investigation, you might need to look into multiple services across different components. So the Centralized Logging and Dashboards are essential to make it easy to debug problems.

Solutions to Challenges with Microservice Architectures

One Stop solution – Spring Boot

  • Provide non-functional features
  • embedded servers (easy deployment with containers)
  • metrics (for monitoring)
  • health checks (for monitoring services)
  • externalized configuration

Summary

In this spring boot microservices tutorial you have learnt about monolithic and microservices architecture, challenges of monolithic arthictecure and how microservices overcome its challenges its uses advantages.
Hope you liked it !