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
Kubernetesで分散処理をやってみる-Kafkaを添えて-
Search
Ogata Katsuya
September 13, 2025
0
200
Kubernetesで分散処理をやってみる-Kafkaを添えて-
Ogata Katsuya
September 13, 2025
Tweet
Share
More Decks by Ogata Katsuya
See All by Ogata Katsuya
ソフトウェアアーキテクチャ入門
ogatakatsuya
0
92
大学のサークルプラットフォームを作った話
ogatakatsuya
0
88
Go College
ogatakatsuya
0
96
文化祭で使うアプリを1人で作った話
ogatakatsuya
0
77
twitter-cloneを作った話
ogatakatsuya
0
51
Featured
See All Featured
Building Adaptive Systems
keathley
44
2.8k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
How STYLIGHT went responsive
nonsquared
100
5.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
Faster Mobile Websites
deanohume
310
31k
How to Ace a Technical Interview
jacobian
280
24k
Why Our Code Smells
bkeepers
PRO
340
57k
Navigating Team Friction
lara
190
15k
Stop Working from a Prison Cell
hatefulcrawdad
272
21k
A better future with KSS
kneath
239
18k
Music & Morning Musume
bryan
46
6.9k
Transcript
2025-09-13 / ࢄٕज़ษڧձ~Ϋϥυͱࢄٕज़ͷΑ·~ KubernetesͰࢄॲཧΛͯ͠ΈΔ Katsuya Ogata
ࣗݾհ • ໊લ: ॹํ ࠀ࠸ (͓͕ͨ ͔ͭ) • ॴଐ: େࡕେֶใֶݚڀՊ
• ࣗαʔόʔ࢝Ί·ͨ͠ • Ӄࢼظؒதʹ5kgଠΓ·ͨ͠ • X: @ogata_katsuya • ݸਓ: www.ogatakatsuya.com
ࢄॲཧλεΫͷհ
ϨΠτϨʔγϯά ޫͷࣹɾ۶ંΛܭࢉͯ͠ɺߴ࣭ͳը૾Λੜ͢Δ • ޫઢͷʹΑΔը૾ੜख๏ • ԾΧϝϥ͔ΒͷޫઢΛγϛϡϨʔγϣϯ • ޫͷࣹɾ۶ંɾӨΛ࠶ݱ͢Δ • ܭࢉίετ͕ߴ͍
• ө૾CGɺݐஙՄࢹԽʹ͓͍ͯΘΕΔ https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing/implementing-the-raytracing-algorithm.htm ޫઢͷʹΑΔը૾ੜख๏
ϨΠτϨʔγϯά ޫͷࣹɾ۶ંΛܭࢉͯ͠ɺߴ࣭ͳը૾Λੜ͢Δ • ܭࢉྔ O ( P * R *
S * D) • P: ϐΫηϧ • R: ϐΫηϧ͋ͨΓͷޫઢ • S: ΦϒδΣΫτ • D: ࣹ/۶ંਂ • ࠓճͷ߹ɺO ( 800*800 * 50 * 8 * 8 ) = O ( 2,048,000,000 ) • ͜ΕΛ100pixel͝ͱʹׂͯ͠ɺॲཧΛฒྻ࣮ߦ͢Δ
Kubernetesͷࢄॲཧ Node/PodʹॲཧΛࢄ͢Δ͜ͱʹΑ࣮ͬͯݱ͢Δ https://kubernetes.io/ja/docs/concepts/overview/components/
ߟ͑ΒΕΔΞʔΩςΫνϟ ͋ΔPod͕WorkerʹԿΒ͔ͷ௨৴खஈͰσʔλΛͯ͠ฦ͢
ߟ͑ΒΕΔΞʔΩςΫνϟ ͋ΔPod͕WorkerʹԿΒ͔ͷ௨৴खஈͰσʔλΛͯ͠ฦ͢ • σϝϦοτ • Worker PodͷΞυϨεʁʁ • Producer -
Workerؒͷ௨৴खஈʁʁ • ࠶ૹɾϦτϥΠॲཧ͕ඞཁʹͳΔʁʁ • ॲཧதʹαʔόʔ͕མͪͨΒϝοηʔδফ͑ͯ͠·͏ʁʁ • ॲཧ͕ॏ͘ͳͬͨ࣌ʹͲ͏ͬͯରԠ͢Δʁʁ
ͦ͏ͩɺKafkaΛ͓͏
KafkaΛ༻͍ͨࢄॲཧ Pub/Sub messaging model https://aws.amazon.com/jp/what-is/pub-sub-messaging/
KafkaΛ༻͍ͨࢄॲཧ Pub/Sub messaging model • ϝϦοτ • ௨৴ͱϏδωεϩδοΫ͕ૄ݁߹ʹͳΔ • PublisherͱSubscriberΛ༰қʹεέʔϧͰ͖Δ
• ඇಉظͰॲཧΛ࣮ߦͰ͖Δ • ΠϕϯτۦಈΞʔΩςΫνϟͷԠ༻ • োੑ
͜ΕΛKubernetes্Ͱ࣮ݱ͍ͨ͠
KubernetesͷΞʔΩςΫνϟ Pub/Sub messaging model
KubernetesͷΞʔΩςΫνϟ Pub/Sub messaging model
KubernetesͷΞʔΩςΫνϟ Pub/Sub messaging model
KubernetesͷΞʔΩςΫνϟ Pub/Sub messaging model
࣮ݧ
࣮ݧ༰ GKEΛ༻͍ͯɺSubscriberͷΛมԽͤ͞Δ • 3~6 Node • n2-standard-4 (4vCPU / 16GB)
• ϦιʔεͷϦΫΤετʹԠͯ͡εέʔϧ • Subscriber • 1 / 10 / 20 / 30 / 40 / 50 / 60 / 70 / 80 Pod • ֤PodͷϦιʔε • CPU: 250m ~ 500m • ϝϞϦ: 256Mi ~ 512Mi
݁Ռ
࣮ݧ݁Ռ Pod ॲ ཧ ࣌ ؒ 0 550 1100 1650
2200 1 10 20 30 40 50 60 70 80 1 pod 2105 seconds 20 pods 689 seconds 80 pods 368 seconds
·ͱΊ
• KubernetesΛ༻͍Δ͜ͱͰɺPub/SubϞσϧͰͷࢄॲཧΛखܰʹߦ͏͜ͱ ͕Ͱ͖Δ • KafkaΛ༻͍Δ͜ͱͰɺSubscriberΛεέʔϧͤͯ͞ॲཧ࣌ؒΛॖ͢Δ͜ͱ ͕Ͱ͖Δ • https://github.com/ogatakatsuya/distributed-tasks • ڵຯͷ͋Δํ͍ͯΈ͍ͯͩ͘͞
• ٞվળ͋Εڭ͍͑ͯͩ͘͞ʂ ·ͱΊ
ࢀߟจݙ • Kubernetes • KubernetesશΨΠυ ୈ2൛ • Ray-tracing • https://www.scratchapixel.com/lessons/3d-basic-rendering
• Kafka • https://speakerdeck.com/oracle4engineer/shin-kafka • https://speakerdeck.com/hashitokyo/apache-kafka-and-the-world-of- streams