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
100万レコード超えそう(その2)
Search
wakio
June 20, 2024
Programming
1
98
100万レコード超えそう(その2)
wakio
June 20, 2024
Tweet
Share
More Decks by wakio
See All by wakio
世界一流エンジニアの思考法を読んでみた
wakino
1
66
Other Decks in Programming
See All in Programming
GoのDB アクセスにおける 「型安全」と「柔軟性」の両立 - Bob という選択肢
tak848
0
250
存在論的プログラミング: 時間と存在を記述する
koriym
2
190
AI活用のコスパを最大化する方法
ochtum
0
250
Windows on Ryzen and I
seosoft
0
330
PHPで TLSのプロトコルを実装してみる
higaki_program
0
300
Fundamentals of Software Engineering In the Age of AI
therealdanvega
2
270
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
220
安いハードウェアでVulkan
fadis
0
630
OTP を自動で入力する裏技
megabitsenmzq
0
120
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
680
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
150
PHPのバージョンアップ時にも役立ったAST(2026年版)
matsuo_atsushi
0
190
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
130
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
220
HDC tutorial
michielstock
1
560
Paper Plane
katiecoart
PRO
0
48k
Exploring anti-patterns in Rails
aemeredith
2
290
Embracing the Ebb and Flow
colly
88
5k
How to make the Groovebox
asonas
2
2k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
230
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Transcript
100万レコード超えそう その2
自己紹介 名前:ミヤワキ 個人開発&受託開発 組込からスマホアプリまでやります 好きな言語はKotlin 山を走るのが趣味
とある家計簿アプリのお話です
基本スタンドアローンで動きますが、 家計簿の同期はサーバ経由です
現在、登録ユーザ1700人→4000人程度で 24万→87万レコードのテーブルがあります 収入・支出履歴テーブルのレコード数の推移
このまま順調にいくと 100万レコードを超えるかも!
100万レコードを超えると パフォーマンスの劣化が顕著になるらしい 実際、1回の同期に5,6秒かかる ケースもでてきた
でも安易にサーバ増強するとか 富豪的アプローチはとりたくない t3.microで頑張りたい! ※ t3.micro: vCPU2個 メモリ1GB
4個の施策 ・手動で同期してもらう ・古いデータをS3に逃がす ・Bulk Insertを使う ・パーティショニング
S3 EC2 RDS 年1の移動 ユーザ登録・ログイン 古いデータをS3に逃がす 2年分だけ保存
1万レコードの挿入(MariaDB) Bulk単位 処理時間(msec) Bulkなし 2,440 1000 410 10000 259 1万レコードの挿入(SQLite)
Bulk単位 処理時間(msec) Bulkなし 44,189 10 2,839 100 1,537 200 1,867 500 2,967 t3.micro Huawei P20lite Android9 Bulk Insertを使う
ここまでやって、現在は1回の同期が 平均90ms未満、最大3秒
100万レコード超えて パフォーマンスが劣化したらやってみます 乞うご期待! パーティショニング