Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
akka-cluster-etcd
Search
Maciej Biłas
April 16, 2016
Programming
0
250
akka-cluster-etcd
Presented at Scalar conference 2016
Maciej Biłas
April 16, 2016
Tweet
Share
More Decks by Maciej Biłas
See All by Maciej Biłas
Testing with Docker
maciejb
1
100
ArchieML
maciejb
0
140
I code for Warsaw
maciejb
0
190
Warsaw JUG: Listen to the sounds of your application
maciejb
0
150
Poznań JUG: Listen to the sounds of your application
maciejb
0
78
JVM GCs and why should I care?
maciejb
0
67
Other Decks in Programming
See All in Programming
英語文法から学ぶ、クリーンな設計の秘訣
newnomad
1
290
The Weight of Data: Rethinking Cloud-Native Systems for the Age of AI
hollycummins
0
260
PHPバージョンアップから始めるOSSコントリビュート / how2oss-contribute
dmnlk
1
870
Building Scalable Mobile Projects: Fast Builds, High Reusability and Clear Ownership
cyrilmottier
2
240
エンジニア未経験が最短で戦力になるためのTips
gokana
0
260
複数ドメインに散らばってしまった画像…! 運用中のPHPアプリに後からCDNを導入する…!
suguruooki
0
460
OpenTelemetryを活用したObservability入門 / Introduction to Observability with OpenTelemetry
seike460
PRO
1
420
AI Agents with JavaScript
slobodan
0
210
Building a macOS screen saver with Kotlin (Android Makers 2025)
zsmb
1
140
Kamal 2 – Get Out of the Cloud
aleksandrov
1
170
Qiita Bash
mercury_dev0517
1
180
AHC 044 混合整数計画ソルバー解法
kiri8128
0
320
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
GitHub's CSS Performance
jonrohan
1030
460k
Optimizing for Happiness
mojombo
377
70k
Done Done
chrislema
183
16k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.4k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.4k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.3k
Docker and Python
trallard
44
3.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.3k
Making Projects Easy
brettharned
116
6.1k
Transcript
akka-cluster-etcd Maciej Biłas
Who am I? • Maciej Biłas • Software engineer at
Adform • much data, some plumbing • Scala for ~4 years
Agenda • Application deployment • Akka Cluster construction • Deployment
demo
Application deployment a subjective point of view
A long time ago in a galaxy far, far away…
ftp://
A couple of years later…
The Old Way • Servers, VMs • Chefs, Ansibles, …
• System libraries, packages, … • logging, monitoring, … • Host-centric infrastructure
None
Forget about docker running on your host for a moment
… forget about hosts
think about containers
None
The New Way
+
Mesos + Marathon Kubernetes Docker Swarm +
Kubernetes • Resource utilisation • Self-healing • Horizontal scaling
Kubernetes • Where do my containers live? • What are
the IP addresses of their machines?
What about Akka Cluster?
What is Akka Cluster anyway? actors over the network
akka-cluster • fault-tolerant • decentralized • peer-to-peer
akka-cluster • fault-tolerant • decentralized • peer-to-peer
Seed nodes akka.cluster.seed-nodes = [ "akka.tcp://ClusterSystem@host1:2552", “akka.tcp://ClusterSystem@host2:2552" ]
akka-cluster-etcd • Service discovery • Akka Extension • github.com/rkrzewski/akka-cluster-etcd
Cluster discovery import pl.caltha.akka.cluster.ClusterDiscovery ClusterDiscovery(system).start()
etcd • /etc distributed • distributed key-value store • strongly-consistent
• Raft consensus protocol
akka.cluster { discovery.etcd { host = etcd port = 2379
} }
Deployment demo cluster-monitor application
+ Running an Akka Cluster on Kubernetes
None
Kubernetes • Replication controller • Service
gcloud container clusters create “hello-scalar” \ --machine-type=$MACHINE_TYPE \ --num-nodes=3
Deployment • etcd • cloud-monitor frontend • cloud-monitor backend
Deployment kubectl create -f etcd-rc.yml \ -f etcd-srv.yml \
-f frontend-rc.yml \ -f frontend-srv.yml \ -f backend-rc.yml
Deployment kubectl create -f etcd-rc.yml \ -f etcd-srv.yml \
-f frontend-rc.yml \ -f frontend-srv.yml \ -f backend-rc.yml
frontend-rc.yml apiVersion: v1 kind: ReplicationController metadata: name: cluster-monitor-frontend spec: replicas:
1 selector: app: cluster-monitor-frontend template: metadata: labels: app: cluster-monitor-frontend spec: containers: - name: cluster-monitor image: eu.gcr.io/sandbox-maciejb/akka-cluster-etcd/monitor:latest imagePullPolicy: IfNotPresent env: - name: CLUSTER_ROLE value: frontend
frontend-srv.yml apiVersion: v1 kind: Service metadata: name: cluster-monitor-frontend spec: ports:
- port: 8080 selector: app: cluster-monitor-frontend type: LoadBalancer
DEMO
DEMO BACKUP
None
Horizonal scaling
➜ kubectl get rc NAME DESIRED CURRENT AGE cloud-monitor-backend 1
1 9m cloud-monitor-frontend 1 1 9m etcd 1 1 15m ➜ kubectl scale rc/cloud-monitor-backend --replicas=3 replicationcontroller "cloud-monitor-backend" scaled
➜ kubectl get rc NAME DESIRED CURRENT AGE cloud-monitor-backend 1
1 9m cloud-monitor-frontend 1 1 9m etcd 1 1 15m ➜ kubectl scale rc/cloud-monitor-backend --replicas=3 replicationcontroller "cloud-monitor-backend" scaled
None
➜ kubectl scale rc/cloud-monitor-backend --replicas=2
None
Self-healing
➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-2zpds
1/1 Running 0 2m cloud-monitor-backend-cxj7r 1/1 Running 0 4m cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 23m ➜ kubectl delete pods/cloud-monitor-backend-2zpds pod "cloud-monitor-backend-2zpds" deleted ➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-cxj7r 1/1 Running 0 5m cloud-monitor-backend-dqpvd 1/1 Running 0 20s cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 24m
➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-2zpds
1/1 Running 0 2m cloud-monitor-backend-cxj7r 1/1 Running 0 4m cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 23m ➜ kubectl delete pods/cloud-monitor-backend-2zpds pod "cloud-monitor-backend-2zpds" deleted ➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-cxj7r 1/1 Running 0 5m cloud-monitor-backend-dqpvd 1/1 Running 0 20s cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 24m
➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-2zpds
1/1 Running 0 2m cloud-monitor-backend-cxj7r 1/1 Running 0 4m cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 23m ➜ kubectl delete pods/cloud-monitor-backend-2zpds pod "cloud-monitor-backend-2zpds" deleted ➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-cxj7r 1/1 Running 0 5m cloud-monitor-backend-dqpvd 1/1 Running 0 20s cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 24m
➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-2zpds
1/1 Running 0 2m cloud-monitor-backend-cxj7r 1/1 Running 0 4m cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 23m ➜ kubectl delete pods/cloud-monitor-backend-2zpds pod "cloud-monitor-backend-2zpds" deleted ➜ kubectl get pods NAME READY STATUS RESTARTS AGE cloud-monitor-backend-cxj7r 1/1 Running 0 5m cloud-monitor-backend-dqpvd 1/1 Running 0 20s cloud-monitor-frontend-biw43 1/1 Running 0 3m etcd-tmpz6 1/1 Running 0 24m
Recap • Application deployment • akka-cluster + etcd • Kubernetes
Q&A
Thank you!