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
Infrastructure Testing Using Kubernetes And Gol...
Search
Ran Tavory
May 06, 2019
Technology
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Infrastructure Testing Using Kubernetes And Golang
Ran Tavory
May 06, 2019
More Decks by Ran Tavory
See All by Ran Tavory
go-grpc-channelz: a Go based UI for gRPC's channelz
rantav
0
660
Code Review (Navy Hackathon)
rantav
0
120
Infrastructure testing using Kubernetes
rantav
0
600
Interview Workshop - Technical Questions
rantav
0
380
Code Review Best Practices
rantav
0
130
Code Review @ AppsFlyer
rantav
0
110
GraphQL at Yodas
rantav
2
190
Git for champs
rantav
0
180
Code Review at Yodas
rantav
0
210
Other Decks in Technology
See All in Technology
2026TECHFRESH畢業分享會 - Lightning Talk - E起 See See : 電商推薦讀心術? 數據說了算
line_developers_tw
PRO
0
940
スキルと MCP ツール、責務をどう分けるか? AI が迷わないインターフェース設計の戦略
cdataj
1
1k
Kubernetesにおける学習基盤とLLMOpsの概要
ry
1
280
小さく始める AI 活用推進 ― 日経電子版 Web チームの事例/nikkei-tech-talk47
nikkei_engineer_recruiting
0
250
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.9k
社内 AI エージェント Synapse と セマンティックレイヤーの育て方
hiroakis
3
1.8k
2026 TECHFRESH 畢業分享會 - 開發日常大解密!從領域驅動到企業級上線
line_developers_tw
PRO
0
940
【NRUG vol.18】KubernetesにおけるNew Relicデータ取得量削減の考え方
nrug_member
0
110
AIはどのように 組織のアジリティを変えるのか?
junki
2
670
SONiC Scale-Up Working Group から探る Scale-UpやUltraEthernet機能の実装方法
ebiken
PRO
2
250
チームで進めるAI駆動アジャイル×ウォーターフォール
kumaiu
0
160
Claude Code の Sandbox 機能を Anthropic Sandbox Runtime(srt) で試そう!/lets-play-anthropic-sandbox-runtime
tomoki10
1
570
Featured
See All Featured
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Fireside Chat
paigeccino
42
3.9k
My Coaching Mixtape
mlcsv
0
140
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
130
Java REST API Framework Comparison - PWX 2021
mraible
34
9.4k
Scaling GitHub
holman
464
140k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
How to Talk to Developers About Accessibility
jct
2
230
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
240
Chasing Engaging Ingredients in Design
codingconduct
0
220
We Have a Design System, Now What?
morganepeng
55
8.2k
Transcript
Infrastructure testing using Kubernetes @rantav
OR: Testing Kafka replication over the Atlantic using Golang, Kubernetes
and friends
Hello! I am Ran Tavory I work on multi-region at
appsflyer You can find me @rantav (twitter/gmail/facebook) 3
The Goal: Test Kafka Replication ⊙ Replicate 30MB - 300MB
of traffic per second ⊙ Validate correctness ⊙ Measure latency ⊙ Run test cases (failure scenarios) ◦ Broker crash, cluster resize, packet loss... 4
Kafka ? Queueing System Stream Processing Brokers Partitions 5
HOW ? High level design 6
Kafka Replication From https://github.com/AppsFlyer/kafka-mirror-tester 7
With a home-grown producer and consumer written in golang 8
WHAT DO WE WANT? 9 DOCUMENTATION HOW DO WE DO
IT?
WHAT DO WE WANT? 10 REPRODUCIBILITY HOW DO WE DO
IT?
WHAT DO WE WANT? 11 MONITORING HOW DO WE DO
IT?
KUBERNETES 12
You keep saying this word Kubernetes What does it mean?
13
A brief introduction to Kubernetes 14
CLUSTER MANAGER Kubernetes is a 15
NODES The host running a kubelet and a set of
Pods 16 It manages
PODS Pods consist of 1 or more containers 17 Nodes
contain
DEPLOYMENTS A set of stateless pods 18 Pods run
STATEFUL SET A set of stateful pods 19 Pods also
run
KUBECTL The k8s CLI 20 You control k8s using
“
$ make k8s-all 22
What does that do? ⊙ Provision VMs in AWS ⊙
Setup VPCs, Subnets, Routing Tables ⊙ Create Security Groups ⊙ Setup Load Balancers ⊙ Install Kubernetes (etcd, masters, nodes) ⊙ Setup Monitoring (Prometheus & Grafana and install dashboard) ⊙ Install Weave Scope ⊙ Install Kafkas (and test them) ⊙ Install uReplicator (and test it) ⊙ Install test programs ⊙ And more… (ASGs, DHCP etc) 23
$ kops create cluster \ --zones us-east-1a,us-east-1b,us-east-1c \ --node-count 40
\ --node-size i3.large \ --master-size m4.large \ --master-zones us-east-1a \ --networking calico \ --cloud aws 24
What are we building? us-east-1 25 eu-west-1
What are we building? us-east-1 40 nodes k8s cluster 26
eu-west-1 48 nodes k8s cluster
What are we building? us-east-1 40 nodes k8s cluster 30
brokers kafka cluster 27 eu-west-1 48 nodes k8s cluster 30 brokers kafka cluster
What are we building? us-east-1 40 nodes k8s cluster 30
brokers kafka cluster 28 eu-west-1 48 nodes k8s cluster 30 brokers kafka cluster 8 workers uReplicator
What are we building? us-east-1 40 nodes k8s cluster 30
brokers kafka cluster 10 producers 29 eu-west-1 48 nodes k8s cluster 30 brokers kafka cluster 8 workers uReplicator 4 consumers
30 End Result
31 Grafana Dashboard
32 Prometheus
33 Weave Scope
34 Weave Scope
35 Weave Scope
36 kubectl example
TEST IT. Let’s put all this to test now 37
$ kubectl \ --context us-east-1.k8s.local \ -n kafka-source \ delete
pod kafka-source-2 38 KILL A BROKER
39 KILL A BROKER
$ kubectl \ --context us-east-1.k8s.local \ -n kafka-source \ scale
\ statefulset kafka-source \ --replicas 29 40 RESIZE KAFKA CLUSTER
41 RESIZE KAFKA CLUSTER
$ kubectl \ --context eu-west-1.k8s.local \ -n ureplicator \ scale
deployment \ ureplicator-worker \ --replicas 9 42 ADD uREPLICATOR WORKER
43 ADD uREPLICATOR WORKER
$ make k8s-redeploy-tests 44 ADD NEW TOPIC
45 ADD NEW TOPIC
$ make k8s-kafka-shell-source $ bin/kafka-topics.sh --zookeeper zookeeper:2181 --alter --topic topic5
--partitions 300 46 ADD PARTITIONS
$ kubectl --context eu-west-1.k8s.local \ -n ureplicator port-forward \ ureplicator-controller-76ff85b889-l9mzl
9000 $ curl -X DELETE http://localhost:9000/topics/topic5 $ curl -X POST -d \ '{"topic":"topic5", "numPartitions":"300"}' \ http://localhost:9000/topics 47 ADD PARTITIONS (cont)
48 PACKET LOSS
49 PACKET LOSS
CODE DEEP DIVE Golang Producer/Consumer (just a few bites) 50
51 Producer Main loop
52 Rate limit in Golang The classic gobyexample
53 Rate limit in Golang The classic gobyexample What is
the problem here?
54 Rate limit in Golang Solution: Use package rate
55 Rate limit in Golang Other solutions: Juju and Uber
56 Producer: using channels and the c library librdkafka p.ProduceChannel()
<- m
57 Consumer Main loop Loop select until: signaled || done.
Process event
58 Consumer Process message
“ Question: How can multiple consumers validate message arrival order?
59
60 Producer Sequence numbers messageKey = seq % partitions perKeySeq
= seq / partitions
CODE DEEP DIVE Kubernetes, head first (just a few bites)
61
62 Kafka kind: StatefulSet replicas: 30
Kafka Main container 63 image ports resources probes
64 Kafka config
65 Metrics sidecar container
66 Kafka anti- affinity
67 uReplicator deployment
68 Producer deployment
69 Consumer deployment
70 Service monitoring
$ make k8s-delete-all 71
72
Thanks! Any questions? You can find me at @rantav &
[email protected]
73 This presentation: https://speakerdeck.com/rantav/infrastructure-testing-using-kubernetes- and-go The project: https://github.com/AppsFlyer/kafka-mirror-tester