Microservices Architecture with Spring Cloud


What are microservices? 

Microservices is an architecture(service-oriented architecture) (SOA). In this architecture, applications are broken down into various services. The motivation behind this is separation and modularity.

Monolithic architecture and microservices are more beneficial.
We don’t need to specify all business logic into a single software module. It leads to complexity and time-consuming debugging.

Screenshot-from-2022-05-28-11-30-55 Microservices Architecture with Spring Cloud

In the above diagram, as we can see, we have only one unit of application in a monolithic architecture. In a microservices architecture, we can see three different services.

Advantages

  • Increases scalability
  • More flexibility
  • Modular architecture
  • Ease of introducing new features
  • More reliable and robust structure

Challenges

  • Cost management
  • Network latency and load balancing
  • Complexity at the end-to-end testing

Health Care Example

Let’s take an example

Screenshot-from-2022-05-28-11-39-19 Microservices Architecture with Spring Cloud

Spring Cloud 

It helps us build microservices architecture with various components it provides. Spring cloud helps us manage communication, security threats, maintenance and fault tolerance with different components. Let’s see them one by one.

Spring Cloud Components

  • Spring Cloud Config Server
  • Feign Client
  • Service Discovery and Registry with Eureka
  • Spring Cloud Gateway
  • Resillience4j
  • Spring Cloud Bus

Spring Cloud -> Config Server

Config server uses the git repo to store configurations.

  • Ease of managing configuration of multiple microservices in a single place
  • Configurations can be managed with the application.yaml / properties files within a git repo
  • Each microservice can connect to the config server and get the required configurations
Screenshot-from-2022-05-28-11-25-34 Microservices Architecture with Spring Cloud

Spring Cloud -> Feign Client

Microservices need to communicate with each other to exchange information. Feign client can be used for that

  • Used for intercommunication between microservices
Screenshot-from-2022-05-28-11-26-50 Microservices Architecture with Spring Cloud

Spring Cloud -> Eureka Server

  • Eureka Server enables you to register every microservice you built; it is a service registry.
Screenshot-from-2022-05-28-11-27-50 Microservices Architecture with Spring Cloud

Spring Cloud -> Spring Cloud Gateway

  • A single, unified API entry point across one or more internal APIs
  • One more layer of security is added via the gateway
  • Ease of handling communication protocols
Screenshot-from-2022-05-28-11-42-22 Microservices Architecture with Spring Cloud

Spring Cloud -> Resilience4j

  • Circuit Breakers
  • Retry and Fallback
  • Rate Limiting
Screenshot-from-2022-05-28-11-29-11 Microservices Architecture with Spring Cloud
  • Circuit Breaker comes in for help to handle this
  • We can specify the response to the caller in terms of failure
  • We can limit no. of requests to service w.r.t. time

For any questions and inquiries, visit us at thinkitive

Abhay Ahire

A seasoned Full Stack Developer specializing in Spring Boot and Angular. With a wealth of experience and a passion for creating high-quality web applications, Expertise shines through in insightful blog posts. Stay up to date with the latest trends and best practices in Full Stack Development by following blog. Gain valuable insights and practical tips to enhance your skills and excel in your own development projects.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button