SlideShare a Scribd company logo
Microservices with Spring
Carlos Cavero Barca
Monolithic is not the evil
Esta foto de Autor desconocido está bajo licencia CC BY-NC
Microservices versus Monolithic
Microservices
 Loosely couple services
 Distributed architecture and multiple
failure points
 DevOps and Agile cultures easing the
use of the hype technologies
 Easy and quick deployment of new
versions
 More implementation to integrate
the services
 Async and sync communication
 More configuration and automation
Monolithic
 One big service
 Multiple functionalities
 Unique failure point
 Hard to apply novel technologies due
to restrictions
 Hard and slow deployment of new
versions
 Simple implementation because of
simple integration
 Less configuration
(*) https://articles.microservices.com/monolithic-vs-microservices-architecture-5c4848858f59
Monolithic is not the evil…
it is just another alternative architecture to start with
Esta foto de Autor desconocido está bajo licencia CC BY-NC
Microservices patterns and antipatterns
Patterns
 Discovery
 Load Balancing
 Circuit Breaker
 Database per service
 Observability (health, metrics…)
 Multiple service per host
 Externalized configuration
 API Gateway
 Access Token
 Service Decomposition
Antipatterns
 Avoid making microservice the goal
 Why not start with a monolit?
 Inefficient processes and practices - waterfall
process, manual testing, manual deployment
 Silo’d organization - e.g. development hands
off code to QA for testing.
 Poor software quality - the application is a
big ball of mud, the code is anything but
clean, etc
(*) https://microservices.io/patterns/microservices.html
(*) https://chrisrichardson.net/post/antipatterns/2019/01/14/antipattern-microservices-are-the-goal.html
Spring Boot Actuator
Benefits
 Provide multiple endpoints with
metrics and health information about
the Spring service
 Monitor the status of the application
 Always add the dependency to your
Project (using spring initalizr for
instance)
 Mandatory for service Discovery,
traceback, load balancing and circuit
breaker
 Dependency spring-boot-starter-
actuator
Endpoints
Service
/health
/info
/metrics
/trace
/beans
/configprops
/env
/refresh
Service Discovery
Benefits
 Solve the ephemeral condition of the
microservices
 Dinamyc configuration of the services
 Discovering instead of static configuration
 Discover the host and port by using names
instead of Ips or DNS
 Register when launching the application,
the name, host name and available port
 Consult the /health endpoint of the
service (from the dependency actuator)
Service Discovery
Service1
Service
Discovery
Service2
register
register
/health /health
Service Discovery with Eureka
Benefits
 Client-side Discovery
 @EnableEurekaServer annotation
 Cluster configuration recommended
 En caso de caída se elige uno nuevo y este
cambio es transparente para las aplicaciones
cliente (si tienen su propio agente Consul cliente
configurado correctamente). Eureka, en cambio,
si un servidor se cae, son las aplicaciones cliente
las que activamente comunican con el siguiente
servidor Eureka configurado en ellas.
 Además, ofrece interfaz DNS para comunicarse,
algo que Eureka no por lo que no estamos atados
a comunicación REST y además incluye
almacenamiento KV, lo que permite centralizar
la configuración en el mismo sistema.
Netflix Eureka
Service Discovery with Consul
Benefits
 Client-side Discovery
 Fault tolerance and load balancing at server
side
 Simple key/value storage for configuration
and feature flagging
 @EnableDiscoveryClient and the dependency
spring-cloud-starter-consul-all
 It can substitute Eureka and Cloud Config
 Start Consul Agent in local workstation at
http://localhost:8500
 Download the binary
consul agent -server -bootstrap-expect=1 -data-
dir=consul-data -ui -bind=<your IP>
Consul
Service1
Service
Discovery
Service2
register
register
/health /health
API Gateway and intelligent routing with
Zuul
Benefits
 Proxy that centralizes all the
requests and routes them to the
proper microservice
 Authentication and authorization
interceptors
 Implement Circuit Breaker (Hystrix)
 Zuul provides Load Balancing in the
server side (with Ribbon) and not in
the client side like Ribbon
 Canary testing
API Gateway and Routing
Zuul
Service1
Service
Discovery
Service2
Client
Cloud Config Server
Benefits
 Configuration is independent of the artefact
 Configuration parameters are externalized
and it is possible to get the latest version
easily
 Different environments (test, staging and
production) can be separated
 It is language agnostic because it publishes
an API REST
 Refresh automatically the configuration with
http://localhost:8090/monitor
 Encrypt the configuration values at the
server side and decrypt at client side with
/encrypt and /decrypt endpoints
 @EnableConfigServer
Cloud Config Server
Cloud Config
Zuul
Service1
Service
Discovery
Service2
Client
Circuit Breaker with Hystrix
Benefits
 Break the circuit in case of failure or latency
(like an electric one) providing valid
alternatives instead
 If the number of errors is above the threshold
the circuit is open and no more requests can
be done
 Automatic checking of the /health endpoint
until the service is available again
 Provides resilience and fault tolerance
avoiding the propagation of failures,
unlimited time-response and isolation of
point of access
 Two possible solutions to return a default
value: no availability or failure and timeout
 @HystrixCommand with a valid fallback
Hystrix
Service1
Service
Discovery
Service2
register
discover
/health /health
Hystrix fallback
Client-side Load Balancing with Ribbon
Benefits
 Load Balancing at client level
 Multiple instances of the same
service
 Distribution of workloads
 Get the information from the
Discovery service and select the right
instance
 If a instance is not available and
Eureka is no updated then some
Fallback could be sent. To solve this
you can use a proxy (Zuul)
 Choose and round-robin
Ribbon
Client
Service
Discovery
Service2
register
discover
/health
Replica1
Replica2
round-robin
Pub/Sub with RabbitMQ
Benefits
 Message Broker
 Producers send to the queues
 Consumers read from the queues
 Async communication
 Distributed (micro)services
 AMQP protocol
Message Broker – Spring Cloud Bus
Event Producer
Consumer1 Consumer2 Consumer3
Client
resource.updated
resource.created
(*) https://reflectoring.io/event-messaging-with-spring-boot-and-rabbitmq/
(*) http://cloud.spring.io/spring-cloud-static/spring-cloud-bus/2.0.0.RELEASE/single/spring-cloud-bus.html#_quick_start
(*) http://cloud.spring.io/spring-cloud-static/spring-cloud-config/2.0.1.RELEASE/single/spring-cloud-
config.html#_push_notifications_and_spring_cloud_bus
OpenFeign
Benefits
 Reduce the complexity of binding
API HTTP REST calls
 Takes care of Load Balancing and
Discovery if Ribbon and Eureka are
included as dependency
 @FeignClient(name=“spring-
service-name")
Spring Security OAuth
Benefits
 Provides Oauth 2.0 authentication
 It can also connect with other IdM
tools (such as Keycloak)
Project Lombok
Benefits
 Java library that automatically
plugs into your editor and build
tools with less programming
 Fully integrated with Spring
 Getters, setters or equals methods
automatically embedded in the
data model
 With annotations obtain a fully
featured builder
 Automate your logging variables
How to make it works in
Eclipse IDE
Esta foto de Autor desconocido está bajo licencia CC BY-SA
 When starting a fresh Eclipse
installation Lombok needs to be
configured:
 Go where your jar is, run it:
java –jar lombok-1.18.8.jar
 Click on Install/Update
 Launch Eclipse and update project
configuration
And much more
 Distributed tracing with Zipkin and Sleuth

More Related Content

What's hot

A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
HostedbyConfluent
 
Taming a massive fleet of Python-based Kafka apps at Robinhood | Chandra Kuch...
Taming a massive fleet of Python-based Kafka apps at Robinhood | Chandra Kuch...Taming a massive fleet of Python-based Kafka apps at Robinhood | Chandra Kuch...
Taming a massive fleet of Python-based Kafka apps at Robinhood | Chandra Kuch...
HostedbyConfluent
 
Dual write strategies for microservices
Dual write strategies for microservicesDual write strategies for microservices
Dual write strategies for microservices
Bilgin Ibryam
 
Orchestration Patterns for Microservices with Messaging by RabbitMQ
Orchestration Patterns for Microservices with Messaging by RabbitMQOrchestration Patterns for Microservices with Messaging by RabbitMQ
Orchestration Patterns for Microservices with Messaging by RabbitMQ
VMware Tanzu
 
Making your Life Easier with MongoDB and Kafka (Robert Walters, MongoDB) Kafk...
Making your Life Easier with MongoDB and Kafka (Robert Walters, MongoDB) Kafk...Making your Life Easier with MongoDB and Kafka (Robert Walters, MongoDB) Kafk...
Making your Life Easier with MongoDB and Kafka (Robert Walters, MongoDB) Kafk...
HostedbyConfluent
 
Lessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, Cloudera
Lessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, ClouderaLessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, Cloudera
Lessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, Cloudera
HostedbyConfluent
 
Cloud native Kafka | Sascha Holtbruegge and Margaretha Erber, HiveMQ
Cloud native Kafka | Sascha Holtbruegge and Margaretha Erber, HiveMQCloud native Kafka | Sascha Holtbruegge and Margaretha Erber, HiveMQ
Cloud native Kafka | Sascha Holtbruegge and Margaretha Erber, HiveMQ
HostedbyConfluent
 
Leveraging Microservices and Apache Kafka to Scale Developer Productivity
Leveraging Microservices and Apache Kafka to Scale Developer ProductivityLeveraging Microservices and Apache Kafka to Scale Developer Productivity
Leveraging Microservices and Apache Kafka to Scale Developer Productivity
confluent
 
Asynchronous Microservices in nodejs
Asynchronous Microservices in nodejsAsynchronous Microservices in nodejs
Asynchronous Microservices in nodejs
Bruno Pedro
 
Stream Processing with Kafka and KSQL in Jupiter | Namit Mahuvakar, Jupiter
Stream Processing with Kafka and KSQL in Jupiter | Namit Mahuvakar, JupiterStream Processing with Kafka and KSQL in Jupiter | Namit Mahuvakar, Jupiter
Stream Processing with Kafka and KSQL in Jupiter | Namit Mahuvakar, Jupiter
HostedbyConfluent
 
Microservices with Node and Docker
Microservices with Node and DockerMicroservices with Node and Docker
Microservices with Node and Docker
Tony Pujals
 
Kafka Excellence at Scale – Cloud, Kubernetes, Infrastructure as Code (Vik Wa...
Kafka Excellence at Scale – Cloud, Kubernetes, Infrastructure as Code (Vik Wa...Kafka Excellence at Scale – Cloud, Kubernetes, Infrastructure as Code (Vik Wa...
Kafka Excellence at Scale – Cloud, Kubernetes, Infrastructure as Code (Vik Wa...
HostedbyConfluent
 
The New Way of Configuring Grace Periods for Windowed Operations in Kafka Str...
The New Way of Configuring Grace Periods for Windowed Operations in Kafka Str...The New Way of Configuring Grace Periods for Windowed Operations in Kafka Str...
The New Way of Configuring Grace Periods for Windowed Operations in Kafka Str...
HostedbyConfluent
 
Building adaptive user experiences using Contextual Multi-Armed Bandits with...
Building adaptive user experiences using Contextual Multi-Armed Bandits  with...Building adaptive user experiences using Contextual Multi-Armed Bandits  with...
Building adaptive user experiences using Contextual Multi-Armed Bandits with...
HostedbyConfluent
 
KrakenD API Gateway
KrakenD API GatewayKrakenD API Gateway
KrakenD API Gateway
Albert Lombarte
 
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
HostedbyConfluent
 
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
HostedbyConfluent
 
Exposing and Controlling Kafka Event Streaming with Kong Konnect Enterprise |...
Exposing and Controlling Kafka Event Streaming with Kong Konnect Enterprise |...Exposing and Controlling Kafka Event Streaming with Kong Konnect Enterprise |...
Exposing and Controlling Kafka Event Streaming with Kong Konnect Enterprise |...
HostedbyConfluent
 
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
HostedbyConfluent
 
Demystifying Event-Driven Architectures with Apache Kafka | Bogdan Sucaciu, P...
Demystifying Event-Driven Architectures with Apache Kafka | Bogdan Sucaciu, P...Demystifying Event-Driven Architectures with Apache Kafka | Bogdan Sucaciu, P...
Demystifying Event-Driven Architectures with Apache Kafka | Bogdan Sucaciu, P...
HostedbyConfluent
 

What's hot (20)

A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
 
Taming a massive fleet of Python-based Kafka apps at Robinhood | Chandra Kuch...
Taming a massive fleet of Python-based Kafka apps at Robinhood | Chandra Kuch...Taming a massive fleet of Python-based Kafka apps at Robinhood | Chandra Kuch...
Taming a massive fleet of Python-based Kafka apps at Robinhood | Chandra Kuch...
 
Dual write strategies for microservices
Dual write strategies for microservicesDual write strategies for microservices
Dual write strategies for microservices
 
Orchestration Patterns for Microservices with Messaging by RabbitMQ
Orchestration Patterns for Microservices with Messaging by RabbitMQOrchestration Patterns for Microservices with Messaging by RabbitMQ
Orchestration Patterns for Microservices with Messaging by RabbitMQ
 
Making your Life Easier with MongoDB and Kafka (Robert Walters, MongoDB) Kafk...
Making your Life Easier with MongoDB and Kafka (Robert Walters, MongoDB) Kafk...Making your Life Easier with MongoDB and Kafka (Robert Walters, MongoDB) Kafk...
Making your Life Easier with MongoDB and Kafka (Robert Walters, MongoDB) Kafk...
 
Lessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, Cloudera
Lessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, ClouderaLessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, Cloudera
Lessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, Cloudera
 
Cloud native Kafka | Sascha Holtbruegge and Margaretha Erber, HiveMQ
Cloud native Kafka | Sascha Holtbruegge and Margaretha Erber, HiveMQCloud native Kafka | Sascha Holtbruegge and Margaretha Erber, HiveMQ
Cloud native Kafka | Sascha Holtbruegge and Margaretha Erber, HiveMQ
 
Leveraging Microservices and Apache Kafka to Scale Developer Productivity
Leveraging Microservices and Apache Kafka to Scale Developer ProductivityLeveraging Microservices and Apache Kafka to Scale Developer Productivity
Leveraging Microservices and Apache Kafka to Scale Developer Productivity
 
Asynchronous Microservices in nodejs
Asynchronous Microservices in nodejsAsynchronous Microservices in nodejs
Asynchronous Microservices in nodejs
 
Stream Processing with Kafka and KSQL in Jupiter | Namit Mahuvakar, Jupiter
Stream Processing with Kafka and KSQL in Jupiter | Namit Mahuvakar, JupiterStream Processing with Kafka and KSQL in Jupiter | Namit Mahuvakar, Jupiter
Stream Processing with Kafka and KSQL in Jupiter | Namit Mahuvakar, Jupiter
 
Microservices with Node and Docker
Microservices with Node and DockerMicroservices with Node and Docker
Microservices with Node and Docker
 
Kafka Excellence at Scale – Cloud, Kubernetes, Infrastructure as Code (Vik Wa...
Kafka Excellence at Scale – Cloud, Kubernetes, Infrastructure as Code (Vik Wa...Kafka Excellence at Scale – Cloud, Kubernetes, Infrastructure as Code (Vik Wa...
Kafka Excellence at Scale – Cloud, Kubernetes, Infrastructure as Code (Vik Wa...
 
The New Way of Configuring Grace Periods for Windowed Operations in Kafka Str...
The New Way of Configuring Grace Periods for Windowed Operations in Kafka Str...The New Way of Configuring Grace Periods for Windowed Operations in Kafka Str...
The New Way of Configuring Grace Periods for Windowed Operations in Kafka Str...
 
Building adaptive user experiences using Contextual Multi-Armed Bandits with...
Building adaptive user experiences using Contextual Multi-Armed Bandits  with...Building adaptive user experiences using Contextual Multi-Armed Bandits  with...
Building adaptive user experiences using Contextual Multi-Armed Bandits with...
 
KrakenD API Gateway
KrakenD API GatewayKrakenD API Gateway
KrakenD API Gateway
 
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
 
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
Testing Event Driven Architectures: How to Broker the Complexity | Frank Kilc...
 
Exposing and Controlling Kafka Event Streaming with Kong Konnect Enterprise |...
Exposing and Controlling Kafka Event Streaming with Kong Konnect Enterprise |...Exposing and Controlling Kafka Event Streaming with Kong Konnect Enterprise |...
Exposing and Controlling Kafka Event Streaming with Kong Konnect Enterprise |...
 
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
 
Demystifying Event-Driven Architectures with Apache Kafka | Bogdan Sucaciu, P...
Demystifying Event-Driven Architectures with Apache Kafka | Bogdan Sucaciu, P...Demystifying Event-Driven Architectures with Apache Kafka | Bogdan Sucaciu, P...
Demystifying Event-Driven Architectures with Apache Kafka | Bogdan Sucaciu, P...
 

Similar to Microservices with Spring

Microservices
MicroservicesMicroservices
Microservices
Ramesh (@Mavuluri)
 
20240
2024020240
Spring boot microservice metrics monitoring
Spring boot   microservice metrics monitoringSpring boot   microservice metrics monitoring
Spring boot microservice metrics monitoring
Oracle Korea
 
Spring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics MonitoringSpring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics Monitoring
DonghuKIM2
 
Debugging Microservices - QCON 2017
Debugging Microservices - QCON 2017Debugging Microservices - QCON 2017
Debugging Microservices - QCON 2017
Idit Levine
 
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with K...
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with K...Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with K...
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with K...
confluent
 
Technology Primer: Software-Defined Networking and Its Impact on Infrastructu...
Technology Primer: Software-Defined Networking and Its Impact on Infrastructu...Technology Primer: Software-Defined Networking and Its Impact on Infrastructu...
Technology Primer: Software-Defined Networking and Its Impact on Infrastructu...
CA Technologies
 
Server Farms and XML Web Services
Server Farms and XML Web ServicesServer Farms and XML Web Services
Server Farms and XML Web Services
Jorgen Thelin
 
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with A...
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with A...Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with A...
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with A...
confluent
 
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
Binit Pathak
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
Sistek Yazılım
 
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-orsCharacterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
Lee Calcote
 
Service mesh from linkerd to conduit (cloud native taiwan meetup)
Service mesh from linkerd to conduit (cloud native taiwan meetup)Service mesh from linkerd to conduit (cloud native taiwan meetup)
Service mesh from linkerd to conduit (cloud native taiwan meetup)
Chia-Chun Shih
 
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 PreviewCloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
Chip Childers
 
Zuul_Intro.pdf
Zuul_Intro.pdfZuul_Intro.pdf
Zuul_Intro.pdf
SRINIVAS KOLAPARTHI
 
Introduction To Cloud Computing
Introduction To Cloud ComputingIntroduction To Cloud Computing
Introduction To Cloud Computing
Rinat Shagisultanov
 
ISTIO Deep Dive
ISTIO Deep DiveISTIO Deep Dive
ISTIO Deep Dive
Yong Feng
 
Simplify and Scale Enterprise Spring Apps in the Cloud | March 23, 2023
Simplify and Scale Enterprise Spring Apps in the Cloud | March 23, 2023Simplify and Scale Enterprise Spring Apps in the Cloud | March 23, 2023
Simplify and Scale Enterprise Spring Apps in the Cloud | March 23, 2023
VMware Tanzu
 
Harbour IT & VMware - vForum 2010 Wrap
Harbour IT & VMware - vForum 2010 WrapHarbour IT & VMware - vForum 2010 Wrap
Harbour IT & VMware - vForum 2010 Wrap
HarbourIT
 
Sumo Logic Cert Jam - Advanced Metrics with Kubernetes
Sumo Logic Cert Jam - Advanced Metrics with KubernetesSumo Logic Cert Jam - Advanced Metrics with Kubernetes
Sumo Logic Cert Jam - Advanced Metrics with Kubernetes
Sumo Logic
 

Similar to Microservices with Spring (20)

Microservices
MicroservicesMicroservices
Microservices
 
20240
2024020240
20240
 
Spring boot microservice metrics monitoring
Spring boot   microservice metrics monitoringSpring boot   microservice metrics monitoring
Spring boot microservice metrics monitoring
 
Spring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics MonitoringSpring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics Monitoring
 
Debugging Microservices - QCON 2017
Debugging Microservices - QCON 2017Debugging Microservices - QCON 2017
Debugging Microservices - QCON 2017
 
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with K...
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with K...Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with K...
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with K...
 
Technology Primer: Software-Defined Networking and Its Impact on Infrastructu...
Technology Primer: Software-Defined Networking and Its Impact on Infrastructu...Technology Primer: Software-Defined Networking and Its Impact on Infrastructu...
Technology Primer: Software-Defined Networking and Its Impact on Infrastructu...
 
Server Farms and XML Web Services
Server Farms and XML Web ServicesServer Farms and XML Web Services
Server Farms and XML Web Services
 
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with A...
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with A...Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with A...
Modern Cloud-Native Streaming Platforms: Event Streaming Microservices with A...
 
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
 
Event Driven Architecture
Event Driven ArchitectureEvent Driven Architecture
Event Driven Architecture
 
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-orsCharacterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
Characterizing and contrasting kuhn tey-ner awr-kuh-streyt-ors
 
Service mesh from linkerd to conduit (cloud native taiwan meetup)
Service mesh from linkerd to conduit (cloud native taiwan meetup)Service mesh from linkerd to conduit (cloud native taiwan meetup)
Service mesh from linkerd to conduit (cloud native taiwan meetup)
 
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 PreviewCloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
CloudStack DC Meetup - Apache CloudStack Overview and 4.1/4.2 Preview
 
Zuul_Intro.pdf
Zuul_Intro.pdfZuul_Intro.pdf
Zuul_Intro.pdf
 
Introduction To Cloud Computing
Introduction To Cloud ComputingIntroduction To Cloud Computing
Introduction To Cloud Computing
 
ISTIO Deep Dive
ISTIO Deep DiveISTIO Deep Dive
ISTIO Deep Dive
 
Simplify and Scale Enterprise Spring Apps in the Cloud | March 23, 2023
Simplify and Scale Enterprise Spring Apps in the Cloud | March 23, 2023Simplify and Scale Enterprise Spring Apps in the Cloud | March 23, 2023
Simplify and Scale Enterprise Spring Apps in the Cloud | March 23, 2023
 
Harbour IT & VMware - vForum 2010 Wrap
Harbour IT & VMware - vForum 2010 WrapHarbour IT & VMware - vForum 2010 Wrap
Harbour IT & VMware - vForum 2010 Wrap
 
Sumo Logic Cert Jam - Advanced Metrics with Kubernetes
Sumo Logic Cert Jam - Advanced Metrics with KubernetesSumo Logic Cert Jam - Advanced Metrics with Kubernetes
Sumo Logic Cert Jam - Advanced Metrics with Kubernetes
 

Recently uploaded

All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
Karya Keeper
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabhQuarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
aisafed42
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 

Recently uploaded (20)

All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabhQuarter 3 SLRP grade 9.. gshajsbhhaheabh
Quarter 3 SLRP grade 9.. gshajsbhhaheabh
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 

Microservices with Spring

  • 2. Monolithic is not the evil Esta foto de Autor desconocido está bajo licencia CC BY-NC
  • 3. Microservices versus Monolithic Microservices  Loosely couple services  Distributed architecture and multiple failure points  DevOps and Agile cultures easing the use of the hype technologies  Easy and quick deployment of new versions  More implementation to integrate the services  Async and sync communication  More configuration and automation Monolithic  One big service  Multiple functionalities  Unique failure point  Hard to apply novel technologies due to restrictions  Hard and slow deployment of new versions  Simple implementation because of simple integration  Less configuration (*) https://articles.microservices.com/monolithic-vs-microservices-architecture-5c4848858f59
  • 4. Monolithic is not the evil… it is just another alternative architecture to start with Esta foto de Autor desconocido está bajo licencia CC BY-NC
  • 5. Microservices patterns and antipatterns Patterns  Discovery  Load Balancing  Circuit Breaker  Database per service  Observability (health, metrics…)  Multiple service per host  Externalized configuration  API Gateway  Access Token  Service Decomposition Antipatterns  Avoid making microservice the goal  Why not start with a monolit?  Inefficient processes and practices - waterfall process, manual testing, manual deployment  Silo’d organization - e.g. development hands off code to QA for testing.  Poor software quality - the application is a big ball of mud, the code is anything but clean, etc (*) https://microservices.io/patterns/microservices.html (*) https://chrisrichardson.net/post/antipatterns/2019/01/14/antipattern-microservices-are-the-goal.html
  • 6. Spring Boot Actuator Benefits  Provide multiple endpoints with metrics and health information about the Spring service  Monitor the status of the application  Always add the dependency to your Project (using spring initalizr for instance)  Mandatory for service Discovery, traceback, load balancing and circuit breaker  Dependency spring-boot-starter- actuator Endpoints Service /health /info /metrics /trace /beans /configprops /env /refresh
  • 7. Service Discovery Benefits  Solve the ephemeral condition of the microservices  Dinamyc configuration of the services  Discovering instead of static configuration  Discover the host and port by using names instead of Ips or DNS  Register when launching the application, the name, host name and available port  Consult the /health endpoint of the service (from the dependency actuator) Service Discovery Service1 Service Discovery Service2 register register /health /health
  • 8. Service Discovery with Eureka Benefits  Client-side Discovery  @EnableEurekaServer annotation  Cluster configuration recommended  En caso de caída se elige uno nuevo y este cambio es transparente para las aplicaciones cliente (si tienen su propio agente Consul cliente configurado correctamente). Eureka, en cambio, si un servidor se cae, son las aplicaciones cliente las que activamente comunican con el siguiente servidor Eureka configurado en ellas.  Además, ofrece interfaz DNS para comunicarse, algo que Eureka no por lo que no estamos atados a comunicación REST y además incluye almacenamiento KV, lo que permite centralizar la configuración en el mismo sistema. Netflix Eureka
  • 9. Service Discovery with Consul Benefits  Client-side Discovery  Fault tolerance and load balancing at server side  Simple key/value storage for configuration and feature flagging  @EnableDiscoveryClient and the dependency spring-cloud-starter-consul-all  It can substitute Eureka and Cloud Config  Start Consul Agent in local workstation at http://localhost:8500  Download the binary consul agent -server -bootstrap-expect=1 -data- dir=consul-data -ui -bind=<your IP> Consul Service1 Service Discovery Service2 register register /health /health
  • 10. API Gateway and intelligent routing with Zuul Benefits  Proxy that centralizes all the requests and routes them to the proper microservice  Authentication and authorization interceptors  Implement Circuit Breaker (Hystrix)  Zuul provides Load Balancing in the server side (with Ribbon) and not in the client side like Ribbon  Canary testing API Gateway and Routing Zuul Service1 Service Discovery Service2 Client
  • 11. Cloud Config Server Benefits  Configuration is independent of the artefact  Configuration parameters are externalized and it is possible to get the latest version easily  Different environments (test, staging and production) can be separated  It is language agnostic because it publishes an API REST  Refresh automatically the configuration with http://localhost:8090/monitor  Encrypt the configuration values at the server side and decrypt at client side with /encrypt and /decrypt endpoints  @EnableConfigServer Cloud Config Server Cloud Config Zuul Service1 Service Discovery Service2 Client
  • 12. Circuit Breaker with Hystrix Benefits  Break the circuit in case of failure or latency (like an electric one) providing valid alternatives instead  If the number of errors is above the threshold the circuit is open and no more requests can be done  Automatic checking of the /health endpoint until the service is available again  Provides resilience and fault tolerance avoiding the propagation of failures, unlimited time-response and isolation of point of access  Two possible solutions to return a default value: no availability or failure and timeout  @HystrixCommand with a valid fallback Hystrix Service1 Service Discovery Service2 register discover /health /health Hystrix fallback
  • 13. Client-side Load Balancing with Ribbon Benefits  Load Balancing at client level  Multiple instances of the same service  Distribution of workloads  Get the information from the Discovery service and select the right instance  If a instance is not available and Eureka is no updated then some Fallback could be sent. To solve this you can use a proxy (Zuul)  Choose and round-robin Ribbon Client Service Discovery Service2 register discover /health Replica1 Replica2 round-robin
  • 14. Pub/Sub with RabbitMQ Benefits  Message Broker  Producers send to the queues  Consumers read from the queues  Async communication  Distributed (micro)services  AMQP protocol Message Broker – Spring Cloud Bus Event Producer Consumer1 Consumer2 Consumer3 Client resource.updated resource.created (*) https://reflectoring.io/event-messaging-with-spring-boot-and-rabbitmq/ (*) http://cloud.spring.io/spring-cloud-static/spring-cloud-bus/2.0.0.RELEASE/single/spring-cloud-bus.html#_quick_start (*) http://cloud.spring.io/spring-cloud-static/spring-cloud-config/2.0.1.RELEASE/single/spring-cloud- config.html#_push_notifications_and_spring_cloud_bus
  • 15. OpenFeign Benefits  Reduce the complexity of binding API HTTP REST calls  Takes care of Load Balancing and Discovery if Ribbon and Eureka are included as dependency  @FeignClient(name=“spring- service-name")
  • 16. Spring Security OAuth Benefits  Provides Oauth 2.0 authentication  It can also connect with other IdM tools (such as Keycloak)
  • 17. Project Lombok Benefits  Java library that automatically plugs into your editor and build tools with less programming  Fully integrated with Spring  Getters, setters or equals methods automatically embedded in the data model  With annotations obtain a fully featured builder  Automate your logging variables How to make it works in Eclipse IDE Esta foto de Autor desconocido está bajo licencia CC BY-SA  When starting a fresh Eclipse installation Lombok needs to be configured:  Go where your jar is, run it: java –jar lombok-1.18.8.jar  Click on Install/Update  Launch Eclipse and update project configuration
  • 18. And much more  Distributed tracing with Zipkin and Sleuth