Prev Next

Spring / Spring cloud

Could not find what you were looking for? send us the question and we would be happy to answer your question.

What is Spring Cloud?

Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems such as,

  • configuration management,
  • service discovery,
  • circuit breakers,
  • intelligent routing,
  • micro-proxy,
  • control bus,
  • one-time tokens,
  • global locks,
  • leadership election,
  • distributed sessions,
  • and cluster state.

Spring Cloud builds on Spring Boot by providing a bunch of libraries that enhance the behavior of an application when added to the classpath.

Features of Spring cloud.
  • Distributed/versioned configuration,
  • Service registration and discovery,
  • Routing,
  • Service-to-service calls,
  • Load balancing,
  • Circuit Breakers,
  • Global locks,
  • Leadership election and cluster state,
  • Distributed messaging,
Explain microservices architecture.

Microservices architecture is about breaking down large silo applications into more manageable fully decoupled pieces.

Difference: SOA vs Microservices.

Microservices are components while SOA is an architecture.

Microservices related to an application architecture while SOA (Service-oriented architecture) is about enterprise service exposure, that is, integration.

How microservices principles different from SOA?

In microservices, reuse is not a goal.

Making synchronous calls such as API or web services creates real-time dependencies. Messaging is used whenever possible between microservices.

Service discovery at runtime, components are assumed to be volatile, so it is often the client's responsibility to find and even load balance across the instances.

Data duplication is embraced.

What is an API Gateway?

An API gateway sits in front of an application programming interface (API) and acts as a single point of entry for a defined group of microservices. In addition to accommodating direct requests, gateways can invoke multiple back-end services and aggregate the results.

Other advantages of Using API gateway.

  • authentication,
  • load balancing,
  • security policy enforcement, contract and service level agreement (SLA) management,
  • cache management,
  • dependency resolution.
How to implement API Gateway using Spring cloud?

Spring cloud gateway, Netflix Zuul are gateway services that provide dynamic routing, monitoring, resiliency, security, and more.

Explain the Circuit Breaker design pattern.

In the microservice architecture, when one service synchronously invokes another there is always a chance that the other service is unavailable or having high latency. This might cause resource exhaustion, which would make calling service stall and prevent servicing other requests.

Circuit breaker pattern resolve this issue by having service clients invoke a remote service via a proxy. When the number of consecutive failures is more than a threshold, the circuit breaker trips (as in an electric circuit), and for a certain duration (timeout period) all the attempts to invoke the remote service will fail immediately. After the timeout duration expires the circuit breaker performs a limited number of test requests to pass through. If those requests succeed the circuit breaker resumes normal operation, otherwise, the timeout period begins again.

Explain SpringApplicationBuilder class in Spring boot.

The SpringApplicationBuilder is a fluent builder API that lets you chain together multiple method calls and includes parent and child methods that let you create a hierarchy, as shown in the following example:

new SpringApplicationBuilder()
Spring Security

Comments & Discussions