Introduction to Spring Cloud Netflix

The Spring Cloud Netflix project is one of the key sub-projects of Spring Cloud. This project provides integration between Netflix OSS and the Spring Boot application using the auto-configuration behavior of Spring Boot. You can build a large, distributed application by using some annotations of Spring Cloud; these annotations enable the Netflix components for your distributed systems. Netflix OSS provides multiple components for the distributed applications for several purposes, such as Service Discovery (Eureka), Circuit Breaker (Hystrix), Intelligent Routing (Zuul), and Client-Side Load Balancing (Ribbon). In this chapter, we will explore more about client-side Service Discovery and registering services to the Discovery server via Spring Cloud Netflix Eureka.

As you know, distributed cloud-native systems are built by several services hosted at different commodity servers. Netflix provides the Eureka server for the cloud-based application and it acts as both a Discovery Service server and client. The server-side Service Discovery allows you to register your services to the Eureka cloud server, and the client-side Service Discovery allows services to find and communicate with each other without hardcoding the hostname and port. The registered services have to send a heartbeat signal to the registry to be informed about the presence of these services.

With Netflix Eureka, you can register multiple services and also register multiple instances of a service. These register instances of the service act as a server and replicate its status to the connected peer clients. Netflix Eureka manages these requests to the instances of a service using a load balancing algorithm. The client retrieves a list of all connected instances of a service registry and distributes the loads to these instances using a load-balancing algorithm, what it Client Side Load Balancing (Ribbon) does.

You could also see this process as a drawback, because all clients must implement certain logic to interact with this fixed point of Eureka and it takes an additional network round-trip before the actual request.

Let's implement this server-side service registry (Eureka Server) and also implement a REST service that registers itself at the registry (Eureka Client):

  • Implementing Service Discovery—Eureka Server
  • Implementing Service Discovery—Eureka Clients

In this chapter, we will concentrate on the microservices support, which is Service Discovery. Let's discuss, what is the need of Service Discovery in your microservices-based project?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.41.205