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
reduce-db-data-with-cloudian
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
syamauchi
September 16, 2020
Technology
1.4k
1
Share
reduce-db-data-with-cloudian
syamauchi
September 16, 2020
More Decks by syamauchi
See All by syamauchi
Survey on how to protect PostgreSQL child process from OOM-killer
syamauchi
0
370
consideration-of-log-compression-by-timesacledb
syamauchi
0
1.4k
Other Decks in Technology
See All in Technology
Redmine次期バージョン7.0の注目新機能解説 — UI/UX強化と連携強化を中心に
vividtone
1
210
続 運用改善、不都合な真実 〜 物理制約のない運用改善はほとんど無価値 / 20260518-ssmjp-kaizen-no-value-without-physical-constraints
opelab
2
270
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.6k
障害対応のRunbookは作った、でも本当に動くの? AWS FIS で EKS の AZ 障害を再現してみた
tk3fftk
0
120
JTCでRedmine利用者2700人を実現した手法 第二部
nobuonakamura
0
150
PdM・Eng・QAで進めるAI駆動開発の現在地/aidd-with-pdm-eng-qa
shota_kusaba
0
260
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
100k
TypeScriptはどのようにどこまで推論できるのか ─ とにかく as は禁止で
ypresto
0
250
React Compiler導入から21ヶ月、いま始めるならこうやる
astatsuya
2
280
The Making of AI Chips
pfn
PRO
0
490
AWS運用におけるAI Agent活用術 / JAWS-UG 神戸 #11 LT大会
genda
1
310
Claude Code / Codex / Kiro に AWS 権限を 渡すとき、何を設計すべきか
k_adachi_01
6
1.9k
Featured
See All Featured
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
120
Game over? The fight for quality and originality in the time of robots
wayneb77
1
170
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.4k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
930
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
170
Testing 201, or: Great Expectations
jmmastey
46
8.1k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
190
The Curse of the Amulet
leimatthew05
1
12k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
250
What's in a price? How to price your products and services
michaelherold
247
13k
How to train your dragon (web standard)
notwaldorf
97
6.6k
Transcript
#RAKUSMeetup ©2020 RAKUS Co., Ltd. ©2020 RAKUS Co., Ltd. DB容量肥大化への取り組み
山内 覚
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 自己紹介 •前職 • メールとウェブからの情報漏洩対策ソフトの開発 •現職
• 2019年7月 株式会社ラクス入社 • 楽楽販売の開発チームに所属 • バージョンアップなど運用周りの業務を担当
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 楽楽販売の紹介 •クラウド型販売管理システム •導入社数1,000社超 •10年以上続くサービス
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 楽楽販売の概要 •Webデータベース • ブラウザを使ってデータの登録、更新、検索ができる •
販売情報を管理するデータベースを作れる •構成 • PHP + PostgreSQL
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 楽楽販売が抱えていた問題 •DB容量の肥大化 • 既存顧客のデータ容量の増加 •
新規顧客の増加 •PostgreSQLのI/O負荷の増加 •バックアップ取得などのメンテナンス時間の増加
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 当時のデータ状況 • DB全体 • 一番サイズが大きいDB
ファイルによりDB容量が増えている状態 合計サイズ(GB) ファイルサイズ(GB) ファイル数 サイズにおける ファイルの割合 1,106 829 4,872,548 75% サイズ(GB) ファイルサイズ(GB) ファイル数 サイズにおける ファイルの割合 127 124 244,664 98%
#RAKUSMeetup ©2020 RAKUS Co., Ltd. DB以外のファイル保存先の検討 • 選定 • ファイルが増加しても性能が劣化しづらい
• 障害に強い構成をとれる • プログラムから扱いやすい • Cloudian HyperStore • オブジェクトストレージ • ノードとファイルの多重化 • Amazon S3 と同じインタフェース(AWS SDK for PHPを使える) ※ラクスの他のサービスですでに使用していた
#RAKUSMeetup ©2020 RAKUS Co., Ltd. Cloudianを使った楽楽販売の構成 Cloudian 楽楽販売1/ 楽楽販売N/ 楽楽販売1
楽楽販売N ・ ・ ・ ・ ・ ・
#RAKUSMeetup ©2020 RAKUS Co., Ltd. ファイル保存方法の変更 file_id loid 0001 0010
・・・ ・・・ loid data 0010 ・・・ ・・・ 楽楽販売1/ 0001 ファイル一覧テーブル pg_largeobject ファイル一覧テーブル Before After Cloudian file_id loid 0001 0010 ・・・ ・・・
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 課題1 ファイルの追加・削除 • トランザクションで管理で きない
• ファイルの登録 1. Cloudianにファイルを登録 2. ファイル一覧にレコード追加 • ファイルの削除 1. ファイル一覧のレコード削除 2. Cloudianのファイルを削除 ※定期的なごみ掃除が必要 楽楽販売1/ 0001 ファイル一覧テーブル After Cloudian file_id loid 0001 0010 ・・・ ・・・
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 課題2 バックアップオプション •バックアップオプション • 過去7日分のバックアップをユーザが確認できる機能
日 月 火 水 木 金 土 通常環境 バックアップオプション
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 課題2 バックアップオプション (ファイルをコピーする場合) Cloudian バックアップオプションのファイルもCloudianで管理
すると・・・ ・大量のファイルコピーがCloudian内で発生する! 日 月 火 水 木 金 土 通常環境 バックアップオプション 通常環境/ バックアップ オプション(日)/ ・ ・ ・ バックアップ オプション(土)/
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 課題2 バックアップオプション (ファイルを共通化する場合) 通常環境/ 通常環境と同じファイルを見る
file_id 0001 0002 file_id 0001 0002 0001 0002 file_idが0002のファイルはファイル一 覧テーブルにあるが、Cloudianから 削除されているためアクセスできない Cloudian 日 月 火 水 木 金 土 通常環境 バックアップオプション
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 課題2 バックアップオプション (削除タイミングの変更) 削除日の2週間後に削除する file_id
delete_date 0001 0002 2020/09/16 file_id 0001 0002 file_idが0002のファイルにア クセスできる 日 月 火 水 木 金 土 通常環境 バックアップオプション 通常環境/ 0001 0002 Cloudian
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 課題3 既存ファイルの移行 file_id loid 0001
0010 ・・・ ・・・ loid data 0010 ・・・ ・・・ 楽楽販売1/ 0001 ファイル一覧テーブル pg_largeobject ファイル一覧テーブル Before After Cloudian file_id loid 0001 0010 ・・・ ・・・
#RAKUSMeetup ©2020 RAKUS Co., Ltd. 課題3 既存ファイルの移行 •DB全体 • サービス停止して一度に移行するのは難しい
• サービス移行中にバッチ処理で少しずつ移行 • 2019-11~2020-02の間で移行 合計サイズ(GB) ファイルサイズ(GB) ファイル数 サイズにおける ファイルの割合 1,106 829 4,872,548 75%
#RAKUSMeetup ©2020 RAKUS Co., Ltd. まとめ •DBに保存していたファイルをオブジェクトスト レージに保存した • 問題となっていたDB容量の肥大化に対応できた
• 一方、アプリの考慮点が増えた • DB容量肥大化のような問題には構成の見直しが必要