SlideShare a Scribd company logo
1 of 43
Download to read offline
Микросервисы со Spring
Boot & Spring Cloud
L e a d S o f t w a r e E n g i n e e r a t E PA M
A l e k s a n d r B a r m i n
3 0 Н О Я Б Р Я
About Myself
Lead Software Engineer at EPAM
EPAM Lab mentor
CONTACTS
Email: Aleksandr_Barmin@epam.com
Twitter: @AlexBarmin
ALEKSANDR BARMIN
2
Agenda
• Why Spring?
• Configuration for a distributed environment.
• Service Discovery using the Spring Framework.
• Client-side Load Balancing.
• Server-side Load Balancing.
• Q&A Session.
3
Why Spring?
• Spring Framework is one of the most convenient ways to start a new Java-
based application.
• Spring Boot allows configuring subsystems just by adding dependencies.
• Spring Cloud focuses on providing good out-of-the-box experience for typical
use cases and extensibility mechanism to cover others.
• Spring Cloud takes a very declarative approach, and often you get a lot of
features with just a classpath change and/or an annotation.
Main Subprojects
• Spring Cloud Config
• Spring Cloud Netflix
• Spring Cloud Zookeeper
• Spring Cloud Gateway
• Spring Cloud OpenFeign
• Spring Cloud Security
• Spring Cloud Bus
• Spring Cloud Cluster
• Spring Cloud CLI
• Spring Cloud Commons
• Spring Cloud Connectors
• Spring Cloud Contract
• Spring Cloud Functions
• Spring Cloud anything
Demo Application
8
Spring Cloud Config
Reasoning
• Centralized external configuration management.
• Different configuration for different environment and profiles.
• Server:
• HTTP, resource-based API for external configuration.
• Encryption and decryption of property values.
• Embeddable using Boot Starter.
• Client:
• Binds to an external Config Server.
• Encryption and decryption of property values.
Spring Cloud Config Server
• Configuration Storage:
• Git Backend
• SVN Backend
• File System Backend
• JDBC Backend
• Composite Environment Repositories
Spring Cloud Config
12
Cloud Config
Server
Spring Boot
Application
GIT repository
SVN repository
Configuration
Database
bootstrap.yml
name: spring-boot-application
profiles: default, db, local
application.
yml
Spring Cloud Config Demo
14
Service Discovery
Reasoning
• Client-side service discovery allows services to find and communicate with
each other without hard coding hostname and port. The only “fixed point” in
such an architecture consists of a service registry, with which each service
has to register.
• A drawback is that all clients must implement a certain logic to interact with
this fixed point. This assumes an additional network round trip before the
actual request.
• To be informed about the presence of a client, they have to send a heartbeat
signal to the registry.
EUREKA
• Open Source
• The architecture is primarily
client/server, with a set of Eureka
servers per datacenter.
• Provides a weakly consistent view of
services, using best effort replication.
• Service registrations have a short
Time-To-Live (TTL), requiring clients to
heartbeat with the servers.
• Easy cluster administration and high
scalability.
• Can use additional tools like Ribbon (a
client-side load balancer).
• Eureka does not provide similar
guarantees, and typically requires
running ZooKeeper for services that
need to perform coordination or have
stronger consistency needs.
17
https://github.com/Netflix/eureka
Spring Cloud Netflix Eureka
18
Eureka Server
Some Business
Service
name:business-service
host:host.server
I’malive!
Gateway
Service
Client like
Web App
I need a response from the
business service!
Do you know where is the
business service?
Do some job for me pls!
This is the response you’ve
asked!
Service Discovery Demos
21
Declarative REST Client
Feign Client
• Feign client is a discovery-aware RestTemplate that uses interfaces to
communication with endpoints. This interfaces will be automatically
implemented at runtime, and instead of service-URLs it is using service-
names.
• We need to create an annotation with @EnableFeignClients to use it.
• In order to create Feign Client, an interface need to be created and
annotated with @FeignCleint(“service-name”) annotation.
• Eureka Client needs to be enabled as well.
Declarative REST Client Demo
Client-side Load Balancing
with Ribbon
Netflix Ribbon
Netflix Ribbon is an Inter Process Communication (IPC) cloud library. Ribbon primarily
provides client-side load balancing algorithms.
Netflix Ribbon also provides the following features:
• Service Discovery Integration – Ribbon load balancers provide service discovery in dynamic
environments like a cloud. Integration with Eureka and Netflix service discovery
component is included in the ribbon library.
• Fault Tolerance – the Ribbon API can dynamically determine whether the servers are up
and running in a live environment and can detect those servers that are down.
• Configurable load-balancing rules – Ribbon
supports RoundRobinRule, AvailabilityFilteringRule, WeightedResponseTimeRule out of the
box and supports defining custom rules.
Netflix Ribbon
Ribbon API enables us to configure the following components of the load
balancer:
• Rule – logic component which specifies the load balancing rule we are using
in our application.
• Ping – a component which specifies the mechanism we use to determine the
server’s availability in real-time.
• ServerList – can be dynamic or static. In our case, we are using a static list of
servers; hence we are defining them in the application configuration file
directly.
Client-side Load Balancing
with Ribbon Demo
Circuit Breaker
HYSTRIX
https://github.com/Netflix/Hystrix
• Provides fault tolerance and latency
tolerance.
• Defensive Programming with
Timeout.
• Defensive Programming with Limited
Thread Pool.
• Defensive Programming with Short
Circuit Breaker Pattern.
• Real time monitoring and alerting of
command center on failures.
Circuit Breaker Demo
35
Server side load balancing
and routing
ZUUL
• Open Source
• Full support HTTP/2
• Mutual TLS
• Adaptive Retries
• Configurable concurrency
limits
• Useful tools for debugging
async requests, retries and
routing
https://github.com/Netflix/zuul/wiki
Reasoning
Zuul could be used for solving the following tasks:
• Authentication
• Insights
• Stress Testing
• Canary Testing
• Dynamic Routing
• Service Migration
• Load Shedding
• Security
• Static Response handling
• Active/Active traffic management
Server side load balancing
and routing demo
Conclusion
• https://github.com/aabarmin/epam-dsc-2019
• “Cloud Native Java” by Josh Long
• https://spring.io/projects/spring-cloud
aabarmin
AlexBarmin
ABarmin
Микросервисы со Spring Boot & Spring Cloud
Микросервисы со Spring Boot & Spring Cloud

More Related Content

What's hot

Alpha Five v10.NEW APPLICATION SERVER. CODELESS AJAX
Alpha Five v10.NEW APPLICATION SERVER. CODELESS AJAXAlpha Five v10.NEW APPLICATION SERVER. CODELESS AJAX
Alpha Five v10.NEW APPLICATION SERVER. CODELESS AJAX
Richard Rabins
 

What's hot (20)

Look how easy it is to go from events to blazing-fast analytics! | Neha Pawar...
Look how easy it is to go from events to blazing-fast analytics! | Neha Pawar...Look how easy it is to go from events to blazing-fast analytics! | Neha Pawar...
Look how easy it is to go from events to blazing-fast analytics! | Neha Pawar...
 
Better Deployments with Sub Environments Using Spring Cloud and Netflix Ribbon
Better Deployments with Sub Environments Using Spring Cloud and Netflix RibbonBetter Deployments with Sub Environments Using Spring Cloud and Netflix Ribbon
Better Deployments with Sub Environments Using Spring Cloud and Netflix Ribbon
 
Alpha Five v10.NEW APPLICATION SERVER. CODELESS AJAX
Alpha Five v10.NEW APPLICATION SERVER. CODELESS AJAXAlpha Five v10.NEW APPLICATION SERVER. CODELESS AJAX
Alpha Five v10.NEW APPLICATION SERVER. CODELESS AJAX
 
Service Discovery in Distributed Systems
Service Discovery in Distributed SystemsService Discovery in Distributed Systems
Service Discovery in Distributed Systems
 
Netflix conductor
Netflix conductorNetflix conductor
Netflix conductor
 
Service Discovery Like a Pro
Service Discovery Like a ProService Discovery Like a Pro
Service Discovery Like a Pro
 
03 spring cloud eureka service discovery
03 spring cloud eureka   service discovery03 spring cloud eureka   service discovery
03 spring cloud eureka service discovery
 
API Gateway report
API Gateway reportAPI Gateway report
API Gateway report
 
A Modern C++ Kafka API | Kenneth Jia, Morgan Stanley
A Modern C++ Kafka API | Kenneth Jia, Morgan StanleyA Modern C++ Kafka API | Kenneth Jia, Morgan Stanley
A Modern C++ Kafka API | Kenneth Jia, Morgan Stanley
 
Communication between cloud services
Communication between cloud servicesCommunication between cloud services
Communication between cloud services
 
Streaming with Spring Cloud Stream and Apache Kafka - Soby Chacko
Streaming with Spring Cloud Stream and Apache Kafka - Soby ChackoStreaming with Spring Cloud Stream and Apache Kafka - Soby Chacko
Streaming with Spring Cloud Stream and Apache Kafka - Soby Chacko
 
Confluent Operations Training for Apache Kafka
Confluent Operations Training for Apache KafkaConfluent Operations Training for Apache Kafka
Confluent Operations Training for Apache Kafka
 
Weblogic - clustering failover, and load balancing
Weblogic - clustering failover, and load balancingWeblogic - clustering failover, and load balancing
Weblogic - clustering failover, and load balancing
 
Microservices OSGi-running-with-apache-karaf
Microservices OSGi-running-with-apache-karafMicroservices OSGi-running-with-apache-karaf
Microservices OSGi-running-with-apache-karaf
 
What's new in ASP.NET vNext
What's new in ASP.NET vNextWhat's new in ASP.NET vNext
What's new in ASP.NET vNext
 
How Apache Kafka® Works
How Apache Kafka® WorksHow Apache Kafka® Works
How Apache Kafka® Works
 
Future of Apache Flink Deployments: Containers, Kubernetes and More - Flink F...
Future of Apache Flink Deployments: Containers, Kubernetes and More - Flink F...Future of Apache Flink Deployments: Containers, Kubernetes and More - Flink F...
Future of Apache Flink Deployments: Containers, Kubernetes and More - Flink F...
 
Measure() or die()
Measure() or die()Measure() or die()
Measure() or die()
 
(ATS6-PLAT09) Deploying Applications on load balanced AEP servers for high av...
(ATS6-PLAT09) Deploying Applications on load balanced AEP servers for high av...(ATS6-PLAT09) Deploying Applications on load balanced AEP servers for high av...
(ATS6-PLAT09) Deploying Applications on load balanced AEP servers for high av...
 
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
JDD 2016 - Jacek Bukowski - "Flying To Clouds" - Can It Be Easy?
 

Similar to Микросервисы со Spring Boot & Spring Cloud

Similar to Микросервисы со Spring Boot & Spring Cloud (20)

.NET microservices with Azure Service Fabric
.NET microservices with Azure Service Fabric.NET microservices with Azure Service Fabric
.NET microservices with Azure Service Fabric
 
Microservice creation using spring cloud, zipkin, ribbon, zull, eureka
Microservice creation using spring cloud, zipkin, ribbon, zull, eurekaMicroservice creation using spring cloud, zipkin, ribbon, zull, eureka
Microservice creation using spring cloud, zipkin, ribbon, zull, eureka
 
Externalized Distributed Configuration Management with Spring Cloud Config-Se...
Externalized Distributed Configuration Management with Spring Cloud Config-Se...Externalized Distributed Configuration Management with Spring Cloud Config-Se...
Externalized Distributed Configuration Management with Spring Cloud Config-Se...
 
Cloudify workshop at CCCEU 2014
Cloudify workshop at CCCEU 2014 Cloudify workshop at CCCEU 2014
Cloudify workshop at CCCEU 2014
 
SAP on Azure Web Dispatcher High Availability
SAP on Azure Web Dispatcher High AvailabilitySAP on Azure Web Dispatcher High Availability
SAP on Azure Web Dispatcher High Availability
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
Integrating Infrastructure as Code into a Continuous Delivery Pipeline | AWS ...
 
Cloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a CacheCloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a Cache
 
SpringOne Tour: An Introduction to Azure Spring Apps Enterprise
SpringOne Tour: An Introduction to Azure Spring Apps EnterpriseSpringOne Tour: An Introduction to Azure Spring Apps Enterprise
SpringOne Tour: An Introduction to Azure Spring Apps Enterprise
 
Stay productive_while_slicing_up_the_monolith
Stay productive_while_slicing_up_the_monolithStay productive_while_slicing_up_the_monolith
Stay productive_while_slicing_up_the_monolith
 
saa3_wk5.pdf
saa3_wk5.pdfsaa3_wk5.pdf
saa3_wk5.pdf
 
How to build a Neutron Plugin (stadium edition)
How to build a Neutron Plugin (stadium edition)How to build a Neutron Plugin (stadium edition)
How to build a Neutron Plugin (stadium edition)
 
How to write a Neutron plugin (stadium edition)
How to write a Neutron plugin (stadium edition)How to write a Neutron plugin (stadium edition)
How to write a Neutron plugin (stadium edition)
 
Getting to Walk with DevOps
Getting to Walk with DevOpsGetting to Walk with DevOps
Getting to Walk with DevOps
 
AWS Dev Lounge: Applying the Twelve-Factor Application Manifesto to Developin...
AWS Dev Lounge: Applying the Twelve-Factor Application Manifesto to Developin...AWS Dev Lounge: Applying the Twelve-Factor Application Manifesto to Developin...
AWS Dev Lounge: Applying the Twelve-Factor Application Manifesto to Developin...
 
Angular js 1.0-fundamentals
Angular js 1.0-fundamentalsAngular js 1.0-fundamentals
Angular js 1.0-fundamentals
 
Managing Your Cloud Assets
Managing Your Cloud AssetsManaging Your Cloud Assets
Managing Your Cloud Assets
 
Micro Services Architecture
Micro Services ArchitectureMicro Services Architecture
Micro Services Architecture
 
Service Discovery in MicroServices
Service Discovery in MicroServicesService Discovery in MicroServices
Service Discovery in MicroServices
 
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
AWS re:Invent 2016: Configuration Management in the Cloud (DEV305)
 

More from Vitebsk DSC

More from Vitebsk DSC (20)

Community-Z
Community-ZCommunity-Z
Community-Z
 
How to exceed Customer's expectations by delivery complicated ML+RPA project
How to exceed Customer's expectations by delivery complicated ML+RPA projectHow to exceed Customer's expectations by delivery complicated ML+RPA project
How to exceed Customer's expectations by delivery complicated ML+RPA project
 
Аджайл майндсет. Что разрушает вашу команду?
Аджайл майндсет. Что разрушает вашу команду?Аджайл майндсет. Что разрушает вашу команду?
Аджайл майндсет. Что разрушает вашу команду?
 
Тестирование больших данных
Тестирование больших данныхТестирование больших данных
Тестирование больших данных
 
Amazon SQS или не все костыли одинаково бесполезны
Amazon SQS или не все костыли одинаково бесполезныAmazon SQS или не все костыли одинаково бесполезны
Amazon SQS или не все костыли одинаково бесполезны
 
Amazon Athena overview
Amazon Athena overviewAmazon Athena overview
Amazon Athena overview
 
Typical BA Mistakes ​in documentation
Typical BA Mistakes ​in documentationTypical BA Mistakes ​in documentation
Typical BA Mistakes ​in documentation
 
Boring is Fun!
Boring is Fun!Boring is Fun!
Boring is Fun!
 
На пути к совершенному инжинирингу
На пути к совершенному инжинирингуНа пути к совершенному инжинирингу
На пути к совершенному инжинирингу
 
Чего же ты хочешь, человек?
Чего же ты хочешь, человек?Чего же ты хочешь, человек?
Чего же ты хочешь, человек?
 
Растем вместе с eKIDS
Растем вместе с eKIDSРастем вместе с eKIDS
Растем вместе с eKIDS
 
Технологии беспилотных автомобилей
Технологии беспилотных автомобилейТехнологии беспилотных автомобилей
Технологии беспилотных автомобилей
 
Оптимизация потребления памяти в Java - делаем уборку правильно
Оптимизация потребления памяти в Java - делаем уборку правильноОптимизация потребления памяти в Java - делаем уборку правильно
Оптимизация потребления памяти в Java - делаем уборку правильно
 
Управляем эволюцией на лету
Управляем эволюцией на летуУправляем эволюцией на лету
Управляем эволюцией на лету
 
Жизнь после promises
Жизнь после promisesЖизнь после promises
Жизнь после promises
 
Выбираем стратегию создания бранчей
Выбираем стратегию создания бранчейВыбираем стратегию создания бранчей
Выбираем стратегию создания бранчей
 
Reactive programming для успеха вашего стартапа
Reactive programming для успеха вашего стартапаReactive programming для успеха вашего стартапа
Reactive programming для успеха вашего стартапа
 
Экстремальная оптимизация производительности на примере MongoDB Java Driver
Экстремальная оптимизация производительности на примере MongoDB Java DriverЭкстремальная оптимизация производительности на примере MongoDB Java Driver
Экстремальная оптимизация производительности на примере MongoDB Java Driver
 
Проблемы с производительностью приложений на AngularJS и способы их решения
Проблемы с производительностью приложений на AngularJS и способы их решенияПроблемы с производительностью приложений на AngularJS и способы их решения
Проблемы с производительностью приложений на AngularJS и способы их решения
 
Микросервисы на практике
Микросервисы на практикеМикросервисы на практике
Микросервисы на практике
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Микросервисы со Spring Boot & Spring Cloud

  • 1. Микросервисы со Spring Boot & Spring Cloud L e a d S o f t w a r e E n g i n e e r a t E PA M A l e k s a n d r B a r m i n 3 0 Н О Я Б Р Я
  • 2. About Myself Lead Software Engineer at EPAM EPAM Lab mentor CONTACTS Email: Aleksandr_Barmin@epam.com Twitter: @AlexBarmin ALEKSANDR BARMIN 2
  • 3. Agenda • Why Spring? • Configuration for a distributed environment. • Service Discovery using the Spring Framework. • Client-side Load Balancing. • Server-side Load Balancing. • Q&A Session. 3
  • 4. Why Spring? • Spring Framework is one of the most convenient ways to start a new Java- based application. • Spring Boot allows configuring subsystems just by adding dependencies. • Spring Cloud focuses on providing good out-of-the-box experience for typical use cases and extensibility mechanism to cover others. • Spring Cloud takes a very declarative approach, and often you get a lot of features with just a classpath change and/or an annotation.
  • 5. Main Subprojects • Spring Cloud Config • Spring Cloud Netflix • Spring Cloud Zookeeper • Spring Cloud Gateway • Spring Cloud OpenFeign • Spring Cloud Security • Spring Cloud Bus • Spring Cloud Cluster • Spring Cloud CLI • Spring Cloud Commons • Spring Cloud Connectors • Spring Cloud Contract • Spring Cloud Functions • Spring Cloud anything
  • 7.
  • 8. 8
  • 10. Reasoning • Centralized external configuration management. • Different configuration for different environment and profiles. • Server: • HTTP, resource-based API for external configuration. • Encryption and decryption of property values. • Embeddable using Boot Starter. • Client: • Binds to an external Config Server. • Encryption and decryption of property values.
  • 11. Spring Cloud Config Server • Configuration Storage: • Git Backend • SVN Backend • File System Backend • JDBC Backend • Composite Environment Repositories
  • 12. Spring Cloud Config 12 Cloud Config Server Spring Boot Application GIT repository SVN repository Configuration Database bootstrap.yml name: spring-boot-application profiles: default, db, local application. yml
  • 14. 14
  • 16. Reasoning • Client-side service discovery allows services to find and communicate with each other without hard coding hostname and port. The only “fixed point” in such an architecture consists of a service registry, with which each service has to register. • A drawback is that all clients must implement a certain logic to interact with this fixed point. This assumes an additional network round trip before the actual request. • To be informed about the presence of a client, they have to send a heartbeat signal to the registry.
  • 17. EUREKA • Open Source • The architecture is primarily client/server, with a set of Eureka servers per datacenter. • Provides a weakly consistent view of services, using best effort replication. • Service registrations have a short Time-To-Live (TTL), requiring clients to heartbeat with the servers. • Easy cluster administration and high scalability. • Can use additional tools like Ribbon (a client-side load balancer). • Eureka does not provide similar guarantees, and typically requires running ZooKeeper for services that need to perform coordination or have stronger consistency needs. 17 https://github.com/Netflix/eureka
  • 18. Spring Cloud Netflix Eureka 18 Eureka Server Some Business Service name:business-service host:host.server I’malive! Gateway Service Client like Web App I need a response from the business service! Do you know where is the business service? Do some job for me pls! This is the response you’ve asked!
  • 20.
  • 21. 21
  • 23. Feign Client • Feign client is a discovery-aware RestTemplate that uses interfaces to communication with endpoints. This interfaces will be automatically implemented at runtime, and instead of service-URLs it is using service- names. • We need to create an annotation with @EnableFeignClients to use it. • In order to create Feign Client, an interface need to be created and annotated with @FeignCleint(“service-name”) annotation. • Eureka Client needs to be enabled as well.
  • 25.
  • 27. Netflix Ribbon Netflix Ribbon is an Inter Process Communication (IPC) cloud library. Ribbon primarily provides client-side load balancing algorithms. Netflix Ribbon also provides the following features: • Service Discovery Integration – Ribbon load balancers provide service discovery in dynamic environments like a cloud. Integration with Eureka and Netflix service discovery component is included in the ribbon library. • Fault Tolerance – the Ribbon API can dynamically determine whether the servers are up and running in a live environment and can detect those servers that are down. • Configurable load-balancing rules – Ribbon supports RoundRobinRule, AvailabilityFilteringRule, WeightedResponseTimeRule out of the box and supports defining custom rules.
  • 28. Netflix Ribbon Ribbon API enables us to configure the following components of the load balancer: • Rule – logic component which specifies the load balancing rule we are using in our application. • Ping – a component which specifies the mechanism we use to determine the server’s availability in real-time. • ServerList – can be dynamic or static. In our case, we are using a static list of servers; hence we are defining them in the application configuration file directly.
  • 30.
  • 32. HYSTRIX https://github.com/Netflix/Hystrix • Provides fault tolerance and latency tolerance. • Defensive Programming with Timeout. • Defensive Programming with Limited Thread Pool. • Defensive Programming with Short Circuit Breaker Pattern. • Real time monitoring and alerting of command center on failures.
  • 34.
  • 35. 35
  • 36. Server side load balancing and routing
  • 37. ZUUL • Open Source • Full support HTTP/2 • Mutual TLS • Adaptive Retries • Configurable concurrency limits • Useful tools for debugging async requests, retries and routing https://github.com/Netflix/zuul/wiki
  • 38. Reasoning Zuul could be used for solving the following tasks: • Authentication • Insights • Stress Testing • Canary Testing • Dynamic Routing • Service Migration • Load Shedding • Security • Static Response handling • Active/Active traffic management
  • 39. Server side load balancing and routing demo
  • 40.
  • 41. Conclusion • https://github.com/aabarmin/epam-dsc-2019 • “Cloud Native Java” by Josh Long • https://spring.io/projects/spring-cloud aabarmin AlexBarmin ABarmin