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
120
Kubernetesで分散処理をやってみる-Kafkaを添えて-
Ogata Katsuya
September 13, 2025
Tweet
Share
More Decks by Ogata Katsuya
See All by Ogata Katsuya
ソフトウェアアーキテクチャ入門
ogatakatsuya
0
81
大学のサークルプラットフォームを作った話
ogatakatsuya
0
82
Go College
ogatakatsuya
0
89
文化祭で使うアプリを1人で作った話
ogatakatsuya
0
70
twitter-cloneを作った話
ogatakatsuya
0
44
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
30
2.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Making Projects Easy
brettharned
119
6.4k
GitHub's CSS Performance
jonrohan
1032
460k
Side Projects
sachag
455
43k
Visualization
eitanlees
148
16k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
890
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.7k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.6k
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