Micro-Services Stack
Spring Cloud vs. Docker
Micro-Services
• Micro-services are the current architectural trend.
• We need to deal with:
• Discovery.
• Configuration.
• Load-balancing.
• Security.
• High-Availability.
• Monitoring.
• Scheduling.
The Infrastructure
• Many of these concerns can be dealt by either the application
framework (e.g., Spring Cloud) or the infrastructure (Docker
Swarm/K8S).
• Let’s review both and compare them…
Docker
• Docker provides:
• Decent isolation.
• Evolution.
• Distribution (e.g., Swarm, Kubernetes).
• Fast start time.
• Shared resources.
Docker
• Docker is a lightweight container.
• Useful for deploying and running an application/ service/ micro-
service with its environment.
• You can run your packaged application on production server,
staging server, development machine or even a laptop.
Spring Cloud
Spring Cloud provides tools for developers to quickly
build some of the common patterns in distributed
systems (e.g., configuration management, service
discovery, circuit breakers, etc.) http://projects.spring.io/spring-cloud/
Spring Cloud
• Based on Spring Boot.
• An umbrella project for many other e.g., Spring Cloud Config,
Spring Cloud Netflix, Spring Cloud Security, Spring Cloud AWS
and more.
• Allows relatively easy implementation of distributed
architecture (micro services) design patterns and usecases.
Spring Cloud Netflix
• Netflix OSS integration:
• Eureka – Service Discovery.
• Hystrix – Circuit Breaker.
• Zuul – Routing.
• Ribbon – client-side load balancing.
Configuration Management
• Swarm provides only Secrets.
• K8S provides both Secrets and ConfigMaps.
• Spring provides Config Server.
• E.g.:
@SpringBootApplication
@EnableConfigServer
public class ConfigServer {
public static void main(String[] args) {
SpringApplication.run(ConfigServer.class, args);
}
}
Config Server
• Default backend is Git repository.
• Great for upgrades and auditing.
• Can also use the Vault project for storing secrets.
• Spring Cloud clients can easily benefit from the Config Server.
• There is also Archaius by Netflix which provides dynamic
configuration changes to be pushed to the clients.
Service Discovery
• Swarm and Kubernetes provide Service components which
serve both as load-balancers and service discovery (DNS).
• Spring Cloud provides Eureka & Consul for discovery and
Ribbon for load balancing.
Service Discovery
• Starting a Eureka service is easy:
@SpringBootApplication
@EnableEurekaServer
public class Application {
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).web(true).run(args);
}
}
Service Discovery
• On the client side (the micro-services) you just enable Eureka
client: @EnableEurekaClient (and provide configuration).
• Out-of-the-box support for health indicator (/health) and status
url (/info).
• You can also use DiscoveryClient to search for other micro-
services.
Load Balancing
• Spring Cloud provides Ribbon and Feign to get a client-side
load balancer for your services.
• K8S and Swarm provide strong support for server-side load
balancing!
• Based on health-check.
Health Check
• Sometimes something can go wrong (and it will).
• E.g.,
• VM crash (memory, disk or power).
• Application is hung (GC, bug).
• JVM crashes (OOME, Stack overflow).
• A service is unusable (can’t connect to the DB).
• First we need to know about it and then (maybe) take an action.
Possible Actions
• The most common action we’ll want to perform is some kind of
service restart.
• Sometimes we’ll just want to exclude the service from the load-
balancer (temporary problem).
• Rarely, we’ll want to invoke some specific API of the service.
Basic Mechanism
• Docker is bundled with a basic and simple mechanism, the
entrypoint.
• A special process in the container, that when exit, stops the
container.
• An easy way for errors like OOME!
• However, usually it’s not enough.
Health Check (Docker)
• Docker provides the HEALTHCHECK instruction for the
dockerfile.
• You can provide a command that will be invoked inside the
container and by its exit code (0 for success) will determine if
the container is healthy or not.
• You can control the interval, timeout and retries of the check.
Swarm
• Swarm services only load-balance to healthy containers (need
at least a single successful health-check).
• An unhealthy container will be restarted (another instance).
• There is no out-of-box support yet for other actions.
Kubernetes
• Kubernetes ignores the HEALTHCHECK instruction.
• Instead, each Pod can be configured with two kinds of probes:
• Liveness – a command or HTTP request to check if the container is
alive (dead containers will be restarted).
• Readiness – a command or HTTP request to check if the container is
ready (unready containers will not belong to the load-balancer).
Health-check in Spring Cloud
• Can use Spring Actuator (from Spring Boot) for built-in “/health”
URL.
• Combining both Spring Boot and Docker support can be very
useful!
Hystrix
• Provides a circuit breaker pattern implementation.
• What is a circuit breaker?
Circuit Breaker
• Let’s say we fail to connect to some service (request will
timeout).
• Usually the problem will take some time to fix.
• In the meanwhile our service might crash (especially when
we’re under load and there’s no pushback).
• Circuit breaker to the rescue…
Circuit Breaker
• Can be in 3 states:
• Closed – normal work.
• Open – will not forward calls to the failing service. Works with a
fallback.
• Half-Open – a single invocation will continue to the failing service to
check the status.
Hystrix
• Supports:
• Fallbacks.
• Dashboard.
Discussion
• With Docker, you have a language-independent solution!
• With Spring Cloud you only get JVM-based support.
• Docker-based solutions make deployment extremely easy.
Discussion
• Spring Cloud make client-side solutions (e.g., Hystrix & Ribbon)
extremely powerful.
• Combining both (Spring Cloud on Swarm/K8S) works great.
Discussion
• Current trends lead into K8S/Swarm cluster management.
• For managing:
• Cluster Resilience.
• Scale.
• Server-side Load Balancing.
• Secrets.
• Jobs.
Discussion
• So, where does it leave use regarding Spring services?
• We can still benefit from:
• Hystrix.
• Config Server.
• Internal application framework.
Alternatives
• Spring Cloud is not the only possible application framework
solution.
• Lightbend’s Lagom can also be considered.
• Combines:
• Akka + Play.
• Cassandra.
Akka Cluster
• Can provide:
• Client-side load-balancing.
• Scaling.
• Persistence.
• Sharding.
• Cluster-wide singleton.
• Event bus.

More Related Content

PPTX
Multi-threading in the modern era: Vertx Akka and Quasar
PPTX
What’s expected in Java 9
PPTX
Dive into spark2
PPTX
Stream processing from single node to a cluster
PPTX
What’s expected in Spring 5
PPTX
Spark real world use cases and optimizations
PPTX
JVM languages "flame wars"
PPTX
Developing distributed applications with Akka and Akka Cluster
Multi-threading in the modern era: Vertx Akka and Quasar
What’s expected in Java 9
Dive into spark2
Stream processing from single node to a cluster
What’s expected in Spring 5
Spark real world use cases and optimizations
JVM languages "flame wars"
Developing distributed applications with Akka and Akka Cluster

What's hot (20)

PDF
Scala, Akka, and Play: An Introduction on Heroku
PPTX
Developing distributed applications with Akka and Akka Cluster
PPTX
Akka Actor presentation
PDF
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
KEY
Building Distributed Systems in Scala
PDF
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
PPTX
Real-time streaming and data pipelines with Apache Kafka
PDF
Reactive Streams: Handling Data-Flow the Reactive Way
PDF
Introduction to akka actors with java 8
PDF
Akka Cluster in Production
PPTX
Zoo keeper in the wild
PDF
Akka Http , Routes, Streams with Scala
PDF
Building stateful systems with akka cluster sharding
PDF
Lightbend Lagom: Microservices Just Right
PDF
PaaSTA: Autoscaling at Yelp
PDF
Reactive Streams 1.0 and Akka Streams
PDF
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
PDF
Spring Boot Microservices vs Akka Actor Cluster
ODP
Introduction to Apache Kafka- Part 2
PDF
Reactor, Reactive streams and MicroServices
Scala, Akka, and Play: An Introduction on Heroku
Developing distributed applications with Akka and Akka Cluster
Akka Actor presentation
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Building Distributed Systems in Scala
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
Real-time streaming and data pipelines with Apache Kafka
Reactive Streams: Handling Data-Flow the Reactive Way
Introduction to akka actors with java 8
Akka Cluster in Production
Zoo keeper in the wild
Akka Http , Routes, Streams with Scala
Building stateful systems with akka cluster sharding
Lightbend Lagom: Microservices Just Right
PaaSTA: Autoscaling at Yelp
Reactive Streams 1.0 and Akka Streams
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Cl...
Spring Boot Microservices vs Akka Actor Cluster
Introduction to Apache Kafka- Part 2
Reactor, Reactive streams and MicroServices
Ad

Similar to Implementing Micro Services Tasks (service discovery, load balancing etc.) - Infrastructure (Docker) vs applicative (Spring Cloud) (20)

PPTX
Microservices deck
PPTX
The Rise of the Container: The Dev/Ops Technology That Accelerates Ops/Dev
PPTX
Power of Azure Devops
PPTX
Data harmonycloudpowerpointclientfacing
PDF
Containers, microservices and serverless for realists
PPTX
Container Orchestration
PDF
The Need of Cloud-Native Application
PPTX
ECS and Docker at Okta
PPTX
containerorchestration-221112092539-265b7f55.pptx
PPTX
UNITde II - Docker-Containerization.pptx,
PPTX
Distributed Performance testing by funkload
PDF
A curtain-raiser to the container world Docker & Kubernetes
PPTX
Kubernetes 101
PDF
VMworld 2013: Three Advantages of Running Cloud Foundry in a VMware Private C...
PDF
Spring cloud
PDF
oci-container-engine-oke-100.pdf
PPTX
E-Business suite migration to Oracle cloud
PDF
Building Efficient Parallel Testing Platforms with Docker
PDF
56k.cloud training
PPTX
Docker for the enterprise
Microservices deck
The Rise of the Container: The Dev/Ops Technology That Accelerates Ops/Dev
Power of Azure Devops
Data harmonycloudpowerpointclientfacing
Containers, microservices and serverless for realists
Container Orchestration
The Need of Cloud-Native Application
ECS and Docker at Okta
containerorchestration-221112092539-265b7f55.pptx
UNITde II - Docker-Containerization.pptx,
Distributed Performance testing by funkload
A curtain-raiser to the container world Docker & Kubernetes
Kubernetes 101
VMworld 2013: Three Advantages of Running Cloud Foundry in a VMware Private C...
Spring cloud
oci-container-engine-oke-100.pdf
E-Business suite migration to Oracle cloud
Building Efficient Parallel Testing Platforms with Docker
56k.cloud training
Docker for the enterprise
Ad

Recently uploaded (20)

PPT
ch03 data adnd signals- data communications and networks ppt
PDF
Multiverse AI Review 2025_ The Ultimate All-in-One AI Platform.pdf
PPTX
Comprehensive Guide to Digital Image Processing Concepts and Applications
PPTX
Hexagone difital twin solution in the desgining
PDF
SBOM Document Quality Guide - OpenChain SBOM Study Group
PDF
WhatsApp Chatbots The Key to Scalable Customer Support.pdf
PPTX
SQL introduction and commands, SQL joining
PDF
Science is Not Enough SPLC2009 Richard P. Gabriel
PDF
How to Write Automated Test Scripts Using Selenium.pdf
PDF
Software Development Company - swapdigit | Best Mobile App Development In India
PDF
OpenEXR Virtual Town Hall - August 2025
PPTX
HackYourBrain__UtrechtJUG__11092025.pptx
PPTX
MCP empowers AI Agents from Zero to Production
PPTX
Presentation - Summer Internship at Samatrix.io_template_2.pptx
PDF
KidsTale AI Review - Create Magical Kids’ Story Videos in 2 Minutes.pdf
PPT
chapter01_java_programming_object_oriented
PDF
Canva Desktop App With Crack Free Download 2025?
PDF
MaterialX Virtual Town Hall - August 2025
PPTX
UNIT II: Software design, software .pptx
PDF
solman-7.0-ehp1-sp21-incident-management
ch03 data adnd signals- data communications and networks ppt
Multiverse AI Review 2025_ The Ultimate All-in-One AI Platform.pdf
Comprehensive Guide to Digital Image Processing Concepts and Applications
Hexagone difital twin solution in the desgining
SBOM Document Quality Guide - OpenChain SBOM Study Group
WhatsApp Chatbots The Key to Scalable Customer Support.pdf
SQL introduction and commands, SQL joining
Science is Not Enough SPLC2009 Richard P. Gabriel
How to Write Automated Test Scripts Using Selenium.pdf
Software Development Company - swapdigit | Best Mobile App Development In India
OpenEXR Virtual Town Hall - August 2025
HackYourBrain__UtrechtJUG__11092025.pptx
MCP empowers AI Agents from Zero to Production
Presentation - Summer Internship at Samatrix.io_template_2.pptx
KidsTale AI Review - Create Magical Kids’ Story Videos in 2 Minutes.pdf
chapter01_java_programming_object_oriented
Canva Desktop App With Crack Free Download 2025?
MaterialX Virtual Town Hall - August 2025
UNIT II: Software design, software .pptx
solman-7.0-ehp1-sp21-incident-management

Implementing Micro Services Tasks (service discovery, load balancing etc.) - Infrastructure (Docker) vs applicative (Spring Cloud)

  • 2. Micro-Services • Micro-services are the current architectural trend. • We need to deal with: • Discovery. • Configuration. • Load-balancing. • Security. • High-Availability. • Monitoring. • Scheduling.
  • 3. The Infrastructure • Many of these concerns can be dealt by either the application framework (e.g., Spring Cloud) or the infrastructure (Docker Swarm/K8S). • Let’s review both and compare them…
  • 4. Docker • Docker provides: • Decent isolation. • Evolution. • Distribution (e.g., Swarm, Kubernetes). • Fast start time. • Shared resources.
  • 5. Docker • Docker is a lightweight container. • Useful for deploying and running an application/ service/ micro- service with its environment. • You can run your packaged application on production server, staging server, development machine or even a laptop.
  • 6. Spring Cloud Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g., configuration management, service discovery, circuit breakers, etc.) http://projects.spring.io/spring-cloud/
  • 7. Spring Cloud • Based on Spring Boot. • An umbrella project for many other e.g., Spring Cloud Config, Spring Cloud Netflix, Spring Cloud Security, Spring Cloud AWS and more. • Allows relatively easy implementation of distributed architecture (micro services) design patterns and usecases.
  • 8. Spring Cloud Netflix • Netflix OSS integration: • Eureka – Service Discovery. • Hystrix – Circuit Breaker. • Zuul – Routing. • Ribbon – client-side load balancing.
  • 9. Configuration Management • Swarm provides only Secrets. • K8S provides both Secrets and ConfigMaps. • Spring provides Config Server. • E.g.: @SpringBootApplication @EnableConfigServer public class ConfigServer { public static void main(String[] args) { SpringApplication.run(ConfigServer.class, args); } }
  • 10. Config Server • Default backend is Git repository. • Great for upgrades and auditing. • Can also use the Vault project for storing secrets. • Spring Cloud clients can easily benefit from the Config Server. • There is also Archaius by Netflix which provides dynamic configuration changes to be pushed to the clients.
  • 11. Service Discovery • Swarm and Kubernetes provide Service components which serve both as load-balancers and service discovery (DNS). • Spring Cloud provides Eureka & Consul for discovery and Ribbon for load balancing.
  • 12. Service Discovery • Starting a Eureka service is easy: @SpringBootApplication @EnableEurekaServer public class Application { public static void main(String[] args) { new SpringApplicationBuilder(Application.class).web(true).run(args); } }
  • 13. Service Discovery • On the client side (the micro-services) you just enable Eureka client: @EnableEurekaClient (and provide configuration). • Out-of-the-box support for health indicator (/health) and status url (/info). • You can also use DiscoveryClient to search for other micro- services.
  • 14. Load Balancing • Spring Cloud provides Ribbon and Feign to get a client-side load balancer for your services. • K8S and Swarm provide strong support for server-side load balancing! • Based on health-check.
  • 15. Health Check • Sometimes something can go wrong (and it will). • E.g., • VM crash (memory, disk or power). • Application is hung (GC, bug). • JVM crashes (OOME, Stack overflow). • A service is unusable (can’t connect to the DB). • First we need to know about it and then (maybe) take an action.
  • 16. Possible Actions • The most common action we’ll want to perform is some kind of service restart. • Sometimes we’ll just want to exclude the service from the load- balancer (temporary problem). • Rarely, we’ll want to invoke some specific API of the service.
  • 17. Basic Mechanism • Docker is bundled with a basic and simple mechanism, the entrypoint. • A special process in the container, that when exit, stops the container. • An easy way for errors like OOME! • However, usually it’s not enough.
  • 18. Health Check (Docker) • Docker provides the HEALTHCHECK instruction for the dockerfile. • You can provide a command that will be invoked inside the container and by its exit code (0 for success) will determine if the container is healthy or not. • You can control the interval, timeout and retries of the check.
  • 19. Swarm • Swarm services only load-balance to healthy containers (need at least a single successful health-check). • An unhealthy container will be restarted (another instance). • There is no out-of-box support yet for other actions.
  • 20. Kubernetes • Kubernetes ignores the HEALTHCHECK instruction. • Instead, each Pod can be configured with two kinds of probes: • Liveness – a command or HTTP request to check if the container is alive (dead containers will be restarted). • Readiness – a command or HTTP request to check if the container is ready (unready containers will not belong to the load-balancer).
  • 21. Health-check in Spring Cloud • Can use Spring Actuator (from Spring Boot) for built-in “/health” URL. • Combining both Spring Boot and Docker support can be very useful!
  • 22. Hystrix • Provides a circuit breaker pattern implementation. • What is a circuit breaker?
  • 23. Circuit Breaker • Let’s say we fail to connect to some service (request will timeout). • Usually the problem will take some time to fix. • In the meanwhile our service might crash (especially when we’re under load and there’s no pushback). • Circuit breaker to the rescue…
  • 24. Circuit Breaker • Can be in 3 states: • Closed – normal work. • Open – will not forward calls to the failing service. Works with a fallback. • Half-Open – a single invocation will continue to the failing service to check the status.
  • 26. Discussion • With Docker, you have a language-independent solution! • With Spring Cloud you only get JVM-based support. • Docker-based solutions make deployment extremely easy.
  • 27. Discussion • Spring Cloud make client-side solutions (e.g., Hystrix & Ribbon) extremely powerful. • Combining both (Spring Cloud on Swarm/K8S) works great.
  • 28. Discussion • Current trends lead into K8S/Swarm cluster management. • For managing: • Cluster Resilience. • Scale. • Server-side Load Balancing. • Secrets. • Jobs.
  • 29. Discussion • So, where does it leave use regarding Spring services? • We can still benefit from: • Hystrix. • Config Server. • Internal application framework.
  • 30. Alternatives • Spring Cloud is not the only possible application framework solution. • Lightbend’s Lagom can also be considered. • Combines: • Akka + Play. • Cassandra.
  • 31. Akka Cluster • Can provide: • Client-side load-balancing. • Scaling. • Persistence. • Sharding. • Cluster-wide singleton. • Event bus.