Upgrade to Pro — share decks privately, control downloads, hide ads and more …

累計5000万DLサービスの裏側 – LINEマンガのKotlinで挑む大規模 Server...

累計5000万DLサービスの裏側 – LINEマンガのKotlinで挑む大規模 Server-side ETLの最適化

「Kotlin Fest 2025」の登壇資料です。
https://2025.kotlinfest.dev/

Avatar for LINE Digital Frontier  - TECH

LINE Digital Frontier - TECH

November 01, 2025
Tweet

More Decks by LINE Digital Frontier - TECH

Other Decks in Technology

Transcript

  1. “ LINEマンガは累計5000万ダウンロードを超え、日々多くのユーザー にレコメンデーションを提供しています。 一見シンプルなバッチ処 理も、この規模になると、億単位のデータを高速に連携する必要が あるなど、全く別の課題が生まれます。 私たちは、これらの大規模 データ処理を、Kotlinで実装したETLバッチパイプラインで支えてい ます。 本セッションでは、この大規模ETLシステムの構築で直面している課

    題と、改善に向けたリアルな試行錯誤を共有します。 本セッションのポイント: - 大規模データ処理における現実的な課題 - Kotlin Coroutines/Channel/Flowを用いた様々なトライ&エラー - 失敗と成功から得られた実践的な指針 実サービスの試行錯誤を通じて見えてきた、Kotlinによる大規模デー タETLのリアルをお伝えします。” Proposal (Re)
  2. 01. Introduction 1.1 About LINE MANGA 1.2 About Recommendation 04.

    “重ねる” - CoroutineによるTrino queryの並列化 4.1 Problem 4.2 Try 02. “分ける” - Trinoにおけるdata segmentation 2.1 Problem 2.2 Try 03. “流す” - Streamによるmemoryの効率化 3.1 Problem 3.2 Try 05. “整える” - Flowによる全体の並列制御 5.1 Problem 5.2 Try A Agenda 1.3 How to recommend ? 1.3 What is the Problem ? 2.3 Result 3.3 Result 06. Conclusion 6.1 Summary 4.2 Result 5.3 Result A 5.4 Try B 5.5 Result B
  3. 01. Introduction 1.1 About LINE MANGA 1.2 About Recommendation 04.

    “重ねる” - CoroutineによるTrino queryの並列化 4.1 Problem 4.2 Try 02. “分ける” - Trinoにおけるdata segmentation 2.1 Problem 2.2 Try 03. “流す” - Streamによるmemoryの効率化 3.1 Problem 3.2 Try 05. “整える” - Flowによる全体の並列制御 5.1 Problem 5.2 Try A Agenda 1.3 How to recommend ? 1.3 What is the Problem ? 2.3 Result 3.3 Result 06. Conclusion 6.1 Summary 4.3 Result 5.3 Result A 5.4 Try B 5.5 Result B
  4. 01. Introduction 1.1 About LINE MANGA 1.2 About Recommendation 04.

    “重ねる” - CoroutineによるTrino queryの並列化 4.1 Problem 4.2 Try 03. “流す” - Streamによるmemoryの効率化 3.1 Problem 3.2 Try 05. “整える” - Flowによる全体の並列制御 5.1 Problem 5.2 Try A Agenda 1.3 How to recommend ? 1.3 What is the Problem ? 3.3 Result 06. Conclusion 6.1 Summary 4.3 Result 5.3 Result A 5.4 Try B 5.5 Result B 02. “分ける” - Trinoにおけるdata segmentation 2.1 Problem 2.2 Try 2.3 Result
  5. 01. Introduction 1.1 About LINE MANGA 1.2 About Recommendation 04.

    “重ねる” - CoroutineによるTrino queryの並列化 4.1 Problem 4.2 Try 02. “分ける” - Trinoにおけるdata segmentation 2.1 Problem 2.2 Try 05. “整える” - Flowによる全体の並列制御 5.1 Problem 5.2 Try A Agenda 1.3 How to recommend ? 1.3 What is the Problem ? 2.3 Result 06. Conclusion 6.1 Summary 4.3 Result 5.3 Result A 5.4 Try B 5.5 Result B 03. “流す” - Streamによるmemoryの効率化 3.1 Problem 3.2 Try 3.3 Result
  6. 01. Introduction 1.1 About LINE MANGA 1.2 About Recommendation 02.

    “分ける” - Trinoにおけるdata segmentation 2.1 Problem 2.2 Try 03. “流す” - Streamによるmemoryの効率化 3.1 Problem 3.2 Try 05. “整える” - Flowによる全体の並列制御 5.1 Problem 5.2 Try A Agenda 1.3 How to recommend ? 1.3 What is the Problem ? 2.3 Result 3.3 Result 06. Conclusion 6.1 Summary 5.3 Result A 5.4 Try B 5.5 Result B 04. “重ねる” - CoroutineによるTrino queryの並列化 4.1 Problem 4.2 Try 4.3 Result
  7. 01. Introduction 1.1 About LINE MANGA 1.2 About Recommendation 04.

    “重ねる” - CoroutineによるTrino queryの並列化 4.1 Problem 4.2 Action 02. “分ける” - Trinoにおけるdata segmentation 2.1 Problem 2.2 Action 03. “流す” - Streamによるmemoryの効率化 3.1 Problem 3.2 Action Agenda 1.3 How to recommend ? 1.3 What is the Problem ? 2.2 Result 3.3 Result 4.2 Result 05. “整える” - Flowによる全体の並列制御 5.1 Problem 5.2 Try A 5.3 Result A 5.4 Try B 5.5 Result B 06. Conclusion 6.1 Summary
  8. • Flow • 複数の非同期処理(suspend)を組み合わせる • Coroutineベース • Bufferという仕組みがある • (Coroutine

    + Channel) x N のチェーンを内部的に自動で構成 • ※ channel sizeとしてのbufferとは別 Try B (2)
  9. • 成功 • 約 1000万 record / 15 min (=現行の3~7倍)

    を達成 • コードも宣言的にまとまって良い Result B
  10. 01. Introduction 1.1 About LINE MANGA 1.2 About Recommendation 04.

    “重ねる” - CoroutineによるTrino queryの並列化 4.1 Problem 4.2 Try 02. “分ける” - Trinoにおけるdata segmentation 2.1 Problem 2.2 Try 03. “流す” - Streamによるmemoryの効率化 3.1 Problem 3.2 Try 05. “整える” - Flowによる全体の並列制御 5.1 Problem 5.2 Try A Agenda 1.3 How to recommend ? 1.3 What is the Problem ? 2.3 Result 3.3 Result 4.3 Result 5.3 Result A 5.4 Try B 5.5 Result B 06. Conclusion 6.1 Summary
  11. Summary (1) “流す” - Streamによるmemoryの効率化 ” 分ける” - Trinoにおけるdata segmentation

    Problem: データサイズが大きすぎる Solution: Hash + moduloで分割 Problem: メモリ使用量を削減したい Solution: Streamで処理 “整える” - Flowによる全体の並列制御 “重ねる” - CoroutineによるTrino queryの並列化 Problem: クエリに時間がかかる Solution: Coroutineで並列化 Problem: 個別最適化しつつ全体協調したい Solution: Flowで制御