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
Vibe-Coding で作ったアプリを 文化祭で運用した話 / The story of running an app I built with Vibe-Coding at a school festival
ogatakatsuya
0
110
ハッカソンの勘所とエンジニアリングへの活かし方 / What Hackathons Teach Us and How to Bring That into Engineering
ogatakatsuya
0
16
ソフトウェアアーキテクチャ入門 / Introduction to Software Architecture
ogatakatsuya
0
110
大学のサークルプラットフォームを作った話
ogatakatsuya
0
92
Go College
ogatakatsuya
0
98
文化祭で使うアプリを1人で作った話
ogatakatsuya
0
82
twitter-cloneを作った話
ogatakatsuya
0
55
Featured
See All Featured
Done Done
chrislema
186
16k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
34
2.3k
How STYLIGHT went responsive
nonsquared
100
5.9k
How GitHub (no longer) Works
holman
315
140k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
A Modern Web Designer's Workflow
chriscoyier
697
190k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
11
930
Faster Mobile Websites
deanohume
310
31k
Navigating Team Friction
lara
190
15k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
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