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
19
SESから理解する DMARC
toumakido
0
18
若手エンジニアがAIとどう向き合っているか
toumakido
0
39
Featured
See All Featured
Ethics towards AI in product and experience design
skipperchong
2
440
The Limits of Empathy - UXLibs8
cassininazir
2
720
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
Technical Leadership for Architectural Decision Making
baasie
3
600
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
エンジニアに許された特別な時間の終わり
watany
109
250k
Rails Girls Zürich Keynote
gr2m
96
14k
The Cult of Friendly URLs
andyhume
79
7k
Code Reviewing Like a Champion
maltzj
529
40k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Why Our Code Smells
bkeepers
PRO
340
58k
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