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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
wakio
June 20, 2024
Programming
100
1
Share
100万レコード超えそう(その2)
wakio
June 20, 2024
More Decks by wakio
See All by wakio
世界一流エンジニアの思考法を読んでみた
wakino
1
68
Other Decks in Programming
See All in Programming
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
380
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
280
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
290
GitHubCopilotCLIをはじめよう.pdf
htkym
0
300
Swift Concurrency Type System
inamiy
1
570
20年以上続くプロダクトでも使い続けられる静的解析ツールを求めて
matsuo_atsushi
0
110
How Swift's Type System Guides AI Agents
koher
0
320
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
170
AIを導入する前にやるべきこと
negima
2
310
ハーネスエンジニアリングとは?
kinopeee
13
6.5k
【26新卒研修資料】TDD実装演習
dip_tech
PRO
0
140
個人的に嬉しかったpnpmの新機能・3選
matsuo_atsushi
0
120
Featured
See All Featured
The Spectacular Lies of Maps
axbom
PRO
1
720
Done Done
chrislema
186
16k
How to Talk to Developers About Accessibility
jct
2
190
Facilitating Awesome Meetings
lara
57
6.8k
Paper Plane (Part 1)
katiecoart
PRO
0
6.9k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
220
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
New Earth Scene 8
popppiees
3
2.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.4k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.7k
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万レコード超えて パフォーマンスが劣化したらやってみます 乞うご期待! パーティショニング