Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
コンテナによるPDF Generatorについて
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
toumakido
May 20, 2026
240
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
コンテナによるPDF Generatorについて
at
https://fin-jaws.connpass.com/event/388549/
toumakido
May 20, 2026
More Decks by toumakido
See All by toumakido
AWSのPQC対応について
toumakido
0
18
SESから理解する DMARC
toumakido
0
14
若手エンジニアがAIとどう向き合っているか
toumakido
0
39
Featured
See All Featured
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Side Projects
sachag
456
43k
Un-Boring Meetings
codingconduct
0
420
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
330
WENDY [Excerpt]
tessaabrams
14
39k
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
First, design no harm
axbom
PRO
2
1.3k
The Limits of Empathy - UXLibs8
cassininazir
1
680
Transcript
© 2015 - 2026 Nowcast Inc. JAWS-UG Fin-JAWS × コンテナ⽀部
⾦融コンテナ⼤全 〜ビジネスから技術まで〜 コンテナによるPDF Generatorについて 2026-05-20 1
© 2015 - 2026 Nowcast Inc. ⽬次 1. ⾦融業界とPDF 2.
PDF⽣成の負荷特性 3. PDF Generatorについて 4. なぜ「コンテナ」でLambdaにデプロイするか 5. 実装上の技術的⼯夫 2
© 2015 - 2026 Nowcast Inc. ⾦融とPDFについて ⾦融業界ではPDF⽣成が頻繁に⾏われる • 契約書
• 取引明細 • 運⽤報告書 • その他帳票 3
© 2015 - 2026 Nowcast Inc. リクエストは周期的に集中してくる リクエスト数 時間 →
⽉末 ⼤量発⽣ 平時はほぼゼロ 4 ⾦融業界の書類は年次、⽉次でまとめて作成するものが多い • ⽉次レポート • 運⽤報告書
© 2015 - 2026 Nowcast Inc. PDF Generator コンテナ Lambdaで稼働
常時稼働はせず、1ファイルの⽣成を1リクエストで即時で返す Lambdaのメリット • ECSタスクと⽐べて、初回起動、スケールアウトが速い • ⼤量のリクエストが来た時に、ウォーム状態をキープしながら、並列で処理できる 5
© 2015 - 2026 Nowcast Inc. Chromiumを使ったHTML→PDF変換 HTML テンプレート Chromium
(ヘッドレス) PDF 出⼒ /main (Go binary) Chromium Playwright (Go) アーキテクチャ サブプロセス CDP (Chrome DevTools Protocol) フロー page.PDF() PDF バイト列
© 2015 - 2026 Nowcast Inc. 安定したPDF⽣成のために 1 HTMLレンダリング ChromiumでHTMLを読み込む
2 networkidle 待機 ネットワークリクエストが500ms発⽣しなくなるまで待つ→画像‧フォントのロード完了を確 認 3 CSSセレクタ出現待機 指定セレクタが現れるまで待つ→JS動的コンテンツの⽣成完了を確認 4 <img>ロード確認 全画像のロード完了をJavaScriptで確認 5 PDF出⼒ A4サイズ(297mm × 210mm)でPDF⽣成 7 PDF⽣成は5ステップの順序制御で、画像が表⽰されないPDFが⽣成されない問題を解消
© 2015 - 2026 Nowcast Inc. なぜ「コンテナ」を使⽤したか 理由1: サイズ上限 デプロイ⽅式
サイズ上限 Chromium zipデプロイ 250MB(展開後) ✗ 不可 (300〜400MB) コンテナイメージ 最⼤10GB ✓ 可能 理由2: コンテナのメリットとして、依存ライブラリを管理が楽 Dockerfile(抜粋) RUN ~/go/bin/playwright install --with-deps chromium ↑ Chromiumと依存ライブラリをイメージに焼き込み → コールドスタート時のダウンロード不要
© 2015 - 2026 Nowcast Inc. 起こった問題と解決策
© 2015 - 2026 Nowcast Inc. 課題1:Lambdaペイロード制限 → S3中継の2段階パターン 問題:Lambda直接呼び出しのレスポンス上限は
6MB。HTML、PDFともにこれを超える 10 クライアント 解決:S3中継 署名付きURL PDF Generator S3 署名付きURL ファイル配置 ファイル配置
© 2015 - 2026 Nowcast Inc. 課題2:Chromiumのメモリリーク → コンテナ⾃殺(suicide関数) 問題:Chromiumは⻑期稼働でメモリリーク。LambdaはAWSがコンテナを管理し、直接終了できない
解決:→ 環境変数更新という "⾃殺トリガー" で対処 起動から10分経過 ⾃分の環境変数をAPIで更新 Lambda基盤が新しいコンテナを 起動 古いコンテナが⾃然に交代 11
© 2015 - 2026 Nowcast Inc. 12