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
What's in a Mobile Database?
Search
Samuel E. Giddins
March 03, 2015
Technology
58
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
What's in a Mobile Database?
Samuel E. Giddins
March 03, 2015
More Decks by Samuel E. Giddins
See All by Samuel E. Giddins
Funding Ruby Infrastructure as a Non-Profit
segiddins
0
55
Evolution of Rails within RubyGems.org
segiddins
0
49
The Challenges of Building a Sigstore Client from Scratch
segiddins
0
160
Keeping the Gems Sparkling
segiddins
0
110
A Survey of RubyGems CVEs
segiddins
0
100
Handling 225k requests per second to RubyGems.org
segiddins
0
120
State of the RubyGems 2023
segiddins
0
150
Building Broken Gems
segiddins
0
120
Switching Disciplines as a Tech Lead
segiddins
0
65
Other Decks in Technology
See All in Technology
侵入は突然に 〜 IoTマルウェアと悪用される家庭の機器 ~ / When Intrusion Strikes: IoT Malware and the Abuse of Home Devices
nttcom
0
5.9k
QAエンジニア起点で進める、SmartHRにおける信頼性向上について
kaomi_wombat
1
150
20260807_第6回_関東kaggler会LT_claw系bot xangiと始める、"寂しくない" kaggle
sugupoko
0
320
LLM Internals: 언어 모델의 계보와 알고리즘 진화 (2023~2026)
inureyes
PRO
0
510
Reference-Free Image Quality Assessment for Virtual Try-On via Human Feedback
zozotech
PRO
0
540
『三匹の子ぶた』から学ぶネットワークセキュリティの昔と今 / Network Security: Then and Now Through the Lens of The Three Little Pigs
nttcom
1
6.2k
Go 1.27 の標準パッケージに uuid が入った!のでいろいろ喋る / go_127_std_go_uuid
convto
1
150
トヨタ⽣産⽅式(TPS)⼊⾨
recruitengineers
PRO
3
960
What's new in Go 1.27?
ciarana
0
170
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
猫付きpingコマンドを自作
uyuki234
0
250
【CEDEC2026】『ウマ娘 プリティーダービー』 英語版のキャラクターの方言や口調をローカライズするための創造的アプローチ
cygames
PRO
2
1.1k
Featured
See All Featured
A Soul's Torment
seathinner
6
3.4k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
350
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
64
56k
Writing Fast Ruby
sferik
630
63k
Making the Leap to Tech Lead
cromwellryan
135
10k
The Curse of the Amulet
leimatthew05
2
14k
Paper Plane (Part 1)
katiecoart
PRO
1
10k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Technical Leadership for Architectural Decision Making
baasie
3
490
30 Presentation Tips
portentint
PRO
1
370
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
940
Exploring anti-patterns in Rails
aemeredith
3
460
Transcript
WHAT’S IN A MOBILE DATABASE?
SAMUEL GIDDINS REALM.IO
Show of hands: WHO’S USED A DATABASE?
LET’S NAME SOME
MOST OF THOSE ARE SERVER DATABASES
None
SQLITE THE STATUS QUO
▸ Single-threaded ▸ Dynamically-typed ▸ Weakly-typed ▸ Designed in 2000
WHAT ARE OUR CONSTRAINTS?
▸ Running on a device ▸ Can’t update database code
on a whim ▸ Little RAM ▸ Relatively few CPU cores ▸ Multiple processes ▸ Long-running use of data
WHAT DO WE WANT TO OPTIMIZE FOR?
▸ Querying ▸ Reading values ▸ Maintainable API ▸ Safe
Migrations ▸ Static + Dynamic Schemas
THE GOALS
▸ Cross-platform ▸ Memory-mapped ▸ Thread-safe ▸ Object-oriented ▸ Blazing
fast ▸ Sane interface
CROSS PLATFORM
People build services that need to run on multiple platforms.
Their database should reflect this.
MEMORY MAPPING
void *mmap( void *addr, size_t length, int prot, int flags,
int fd, off_t offset ); This function is magical.
Blur the line between in-memory and on-disk to get the
best of both worlds. Take advantage of optimizations in the kernel and let it do the hard work for you.
THREAD SAFETY
THREAD SAFETY PERHAPS THE MOST LOADED WORD IN CS
WELL-DEFINED THREADING MODEL ▸ What can be passed between threads?
▸ How easily can I isolate things that can’t be?
Built with speed & safety in mind: ▸ No reader
lock ▸ Allow concurrent reading & writing ▸ Let the user know when they violate the threading contract
OBJECT-ORIENTED API
▸ First-class model objects ▸ Support for persisted + in
memory objects ▸ No invisible web of classes
BLAZING FAST
WHY SHOULD OBJECTS AND THE DATABASE EVER GROW APART?
WHY SHOULD OBJECTS AND THE DATABASE EVER GROW APART? OR
WHERE ORMS WENT WRONG
▸ Lazily create objects in memory ▸ Access & set
values directly in the DB ▸ Optimized query engine
SANE API
▸ What do I need a reference to? ▸ Platform
coherence ▸ Isolate DB interaction ▸ Make it impossible to mess up
LET’S RECAP
▸ Cross-platform ▸ Memory-mapped ▸ Thread-safe ▸ Object-oriented ▸ Blazing
fast ▸ Sane interface
SOUNDS A LOT LIKE THE DREAM, RIGHT?
Make persistence just another aspect of your data, instead of
a whole convoluted system.
⾠ This might not be the approach for everyone. Take
a look at the goals, and see if they align with your own.
My company, Realm, is working towards building a database that
hits these bullet points. I’m not here to sell you on Realm. But building something that mirrors those goals is why we exist.
EXAMPLES?
Available now on Speaker Deck. https://speakerdeck.com/segiddins/whats-in-a-mobile-database
db.objects(Question).map { $0.ask }
SAMUEL GIDDINS REALM.IO @SEGIDDINS