Help the world stop coronavirus! Stay home!

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()
		.sources(Parent.class)
		.child(Application.class)
		.bannerMode(Banner.Mode.OFF)
		.run(args);
Mention a few spring Cloud annotations and configuration.

@EnableEurekaServer annotation allows us to register microservices to the spring cloud.

@EnableDiscoveryClient annotation also allows us to query Discovery server to find miroservices.

Spring provide smart RestTemplate for service discovery and load balancing by using @LoadBalanced annotation with RestTemplate instance.

What is Spring Cloud Netflix?

Spring Cloud Netflix provides Netflix OSS (Open Source Software) integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment. Using simple annotations, you can quickly enable and configure the common patterns inside your application and build large distributed systems with battle-tested Netflix components. The patterns provided include Service Discovery (Eureka), Circuit Breaker (Hystrix), Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon).

The features include:

  • Service Discovery: Eureka instances can be registered and clients can discover the instances using Spring-managed beans. An embedded Eureka server can be created with declarative Java configuration.
  • Circuit Breaker: Hystrix clients can be built with a simple annotation-driven method decorator. An embedded Hystrix dashboard can be created with declarative Java configuration.
  • Declarative REST Client: Feign creates a dynamic implementation of an interface decorated with JAX-RS or Spring MVC annotations.
  • Ribbon as Client Side Load Balancer.
  • External Configuration: a bridge from the Spring Environment to Archaius (enables native configuration of Netflix components using Spring Boot conventions).
  • Router and Filter: automatic registration of Zuul filters and a simple convention over configuration approach to reverse proxy creation.
What is Netflix OSS?

Netflix Open Source Software (OSS) is a set of frameworks and libraries from Netflix to solve some interesting distributed-systems problems at scale. ItÂ’s pretty synonymous with developing microservices in a cloud environment. Patterns for service discovery, load balancing, fault-tolerance, etc are incredibly important concepts for scalable distributed systems and Netflix OSS provides solutions for these.

What is Eureka in Netflix OSS bundle?

Eureka is a Service Discovery Server and Client provided in the Netflix OSS platform. Service Discovery is one of the key components of a microservice-based cloud architecture.

What is Zuul?

Zuul is an L7 application gateway that provides capabilities for dynamic routing, monitoring, resiliency, security, and more. Zuul is a JVM-based router and server-side load balancer developed by Netflix and available in the Netflix OSS package.

What is Pivotal Cloud Foundry?

Cloud Foundry is an open-source, multi-cloud application platform as a service governed by the Cloud Foundry Foundation. The software was originally developed by VMware and then transferred to Pivotal Software.

It is a service (PaaS) on which developers can build, deploy, run, and scale applications.

Many Organizations provide the cloud foundry platform separately. For example, following are some cloud foundry providers.

  • Pivotal Cloud Foundry,
  • IBM Bluemix,
  • HPE Helion Stackato 4.0,
  • Atos Canopy,
  • SAP Cloud Platform.
«
»
Spring Security

Comments & Discussions