Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Cloud native akka and kubernetes holy grail to elasticity

101 visualizaciones

Publicado el

Akka is the most mature choice to implement the traits of the Reactive Manifesto, thanks to the Actor model. But we need to rely on some external infrastructure to automatically scale up or down our services. We found Docker & Kubernetes to be a perfect match for clustered Akka applications.

Publicado en: Tecnología
  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Cloud native akka and kubernetes holy grail to elasticity

  1. 1. CLOUD NATIVE AKKA & KUBERNETES: THE HOLY GRAIL TO ELASTICITY? 👎 👍
  2. 2. Notes • My co-speaker is on holiday • Only relevant concepts are introduced • Slides use pseudo-code. Real deal on GitHub @adamsand0r 🎡🍸
  3. 3. About me Fabio Tiriticco Software Developer / Tech Lead @ticofab
  4. 4. The Reactive Manifesto Elasticity: “use just the right amount” 2013, J. Boner, R. Kuhn, D. Farley, M. Thompson
  5. 5. Akka’s building blocks: Actors • contains state & behaviour logic Actor 1 Actor 3 Actor 2 • has an addressable mailbox to receive and send messages myActor3.getName() “Joe” “What is your name?” “My name is Joe” “Bob” “Tim”
  6. 6. My first journey in the Reactive world
  7. 7. My first journey in the Reactive world
  8. 8. My first journey in the Reactive world Phone 1 actor Phone 2 actor Matcher actor Phone 3 actor A possible architecture for CloudMatch Phone 4 actor “You matched with Phone 4, his address is xxx” “You matched with Phone 1, his address is yyy”
  9. 9. Location transparency
  10. 10. Location transparency Actor 1 Actor 2 “Bob” “Tim” // in Scala + Akka timAddress ! WhatIsYourName • Locally • Remotely
  11. 11. Elasticity test system Job source Master Worker Worker HTTP Adjust rate
  12. 12. The Worker class Worker extends Actor { // ... case job: Job => // .. simulate a CPU-intensive workload master ! JobCompleted(job.number) }
  13. 13. Elasticity test system Job source Worker Master Worker Worker Scaling controller ADD NODEREMOVE NODE TOO LITTLE POWER!TOO MUCH POWER!
  14. 14. Issue #1: how to distribute this? Job source Master Worker Worker Scaling controller
  15. 15. Node 1 Akka Cluster to the rescue! • Joining • Up • Leaving • Unreacheable • … Seed Node 1 Seed Node 2 Node 2 Node 3 NOTE: nodes need to know where the seed is
  16. 16. Moving workers to different nodes JVM 2 - worker JVM 3 - worker Job source Master Worker Worker Scaling controller Single JVM JVM 1 - seed Issue #2: how to spin up and shut down nodes?
  17. 17. Docker + Kubernetes • Node provisioning • Resilience • Mainstream adoption • Cloud providers • API
  18. 18. Kubernetes controller Scaling Controller → Kubernetes Controller Job source Master Worker Worker Scaling controller
  19. 19. Kubernetes Controller class KubernetesController extends Actor { case AddNode => // use kubernetes api to scale up case RemoveNode => // use kubernetes api to scale down }
  20. 20. How does the master asks for changes? class Master extends Actor { // to add a node kubernetesController ! AddNode // to remove a node kubernetesController ! RemoveNode }
  21. 21. Kubernetes Architecture Master Actors Kubernetes Controller Worker Worker Worker akka- master-3fw4 akka- worker-1 akka- worker-2 akka- worker-3 Pods akka-master (Deployment) akka-worker (Deployment) Controllers Services DNS HTTP Job Source JVM seed JVMJVMJVM
  22. 22. A glance at the code, then a live recorded demo 📜 📽,
  23. 23. Burndown rate pattern upon changes + - 0
  24. 24. Measurements
  25. 25. HTTP vs Remote Actor Messaging • Actor come with built-in elasticity • Async messaging gives you more control • Less complexity • Actor messages do not necessarily need a response • HTTP is ubiquitous
  26. 26. HTTP vs Remote Actor Messaging •Performance! J. Janssen
  27. 27. Biggest learning REACTIVE SYSTEM DESIGN = APPLICATION AND INFRA
  28. 28. And oh, about the holy grail ? No holy grail in software development.
  29. 29. THANKS github.com/ticofab/akka-cluster-kubernetes @ticofab @adamsand0r

×