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
Look Ma! No more blobs
Search
Aparna Chaudhary
April 27, 2013
Technology
1
2.3k
Look Ma! No more blobs
Binary storage using GridFS.
Aparna Chaudhary
April 27, 2013
Tweet
Share
More Decks by Aparna Chaudhary
See All by Aparna Chaudhary
Understanding JVM
aparnachaudhary
0
140
Esper - Complex Event Processing
aparnachaudhary
1
270
Other Decks in Technology
See All in Technology
JAWS FESTA 2024「バスロケ」GPS×サーバーレスの開発と運用の舞台裏/jawsfesta2024-bus-gps-serverless
ma2shita
3
420
AIエージェント入門
minorun365
PRO
35
20k
OCI IAM Identity Domains Entra IDとの認証連携設定手順 / Identity Domain Federation settings with Entra ID
oracle4engineer
PRO
1
1.3k
フォーイット_エンジニア向け会社紹介資料_Forit_Company_Profile.pdf
forit_tech
1
1.7k
OCI Success Journey OCIの何が評価されてる?疑問に答える事例セミナー(2025年2月実施)
oracle4engineer
PRO
2
280
【Forkwell】「正しく」失敗できるチームを作る──現場のリーダーのための恐怖と不安を乗り越える技術 - FL#83 / A team that can fail correctly by forkwell
i35_267
2
160
エンジニア主導の企画立案を可能にする組織とは?
recruitengineers
PRO
1
350
LangGraph × Bedrock による複数の Agentic Workflow を利用した Supervisor 型のマルチエージェントの実現/langgraph-bedrock-supervisor-agent
ren8k
3
390
ライフステージの変化を乗り越える 探索型のキャリア選択
tenshoku_draft
2
360
リクルートのエンジニア組織を下支えする 新卒の育成の仕組み
recruitengineers
PRO
2
210
株式会社Awarefy(アウェアファイ)会社説明資料 / Awarefy-Company-Deck
awarefy
3
12k
Ruby on Railsで持続可能な開発を行うために取り組んでいること
am1157154
3
190
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
34
3.1k
Testing 201, or: Great Expectations
jmmastey
42
7.2k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
193
16k
Fireside Chat
paigeccino
35
3.2k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
115
51k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
580
YesSQL, Process and Tooling at Scale
rocio
172
14k
Measuring & Analyzing Core Web Vitals
bluesmoon
6
270
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Documentation Writing (for coders)
carmenintech
69
4.6k
Unsuck your backbone
ammeep
669
57k
Statistics for Hackers
jakevdp
797
220k
Transcript
Look Ma! No more blobs Aparna Chaudhary NoSQL matters, @Cologne
Germany 2013
EMBRACE POLYGLOT PERSISTENCE! STOP RDBMS ABUSE! KNOW YOUR USE CASE
Parse Extract Store Read XML We don't do rocket science...
Use Case Runtime support for document types Metadata definition provided at runtime Document type names - max 50 char Look up content based on metadata RA
Challenges Storage of up to one million documents of 10KB
to 2GB per document type per year Write 1MB < x msec Retrieve 1MB < y msec ......and details RA But…the Numbers make it interesting...
How? File System MongoDB RDBMS JCR Document Management
if you want to store files, its logical to use
file system. ain't it? File System ✓ Ease of Use ✓ No special skill-set ✓ Backup and Recovery ✓ It’s free!
How do I name them? Support for metadata storage? Performance
with too many small files? Query - Administration? High Availability? Limitation on total number of files?
Relational database Integrity Consistency Durability Atomicity Joins Backups High Availability
You name it, We have it! RDBMS Aggregations
RDBMS Developer’s Perspective
Challenge #1 RA We need runtime support for document type.
RA We need runtime support for document type.
Challenge #1 DOC_1 DOC_2 DOC_3 DOC_4 DOC_5 DOC_6 Dynamic DDL
Generation DOC_1 DOC_2 DOC_3 DOC_4 DOC_5 DOC_6 Dynamic DDL Generation
Challenge #1 String concatenations are ugly… DEV String concatenations are
ugly… DEV
Challenge #1 Let's build a utility. DEV Let's build a
utility. DEV
Challenge #1 More Work More Work
Challenge #2 RA Document type is 50 char long RA
Document type is 50 char long
Challenge #2 TABLE NAME LIMITS Wait… SQL-92 says 128 Char
? We rule. Let's support only 30 char. TABLE NAME LIMITS Wait… SQL-92 says 128 Char ? We rule. Let's support only 30 char.
Challenge #2 DOC_TYPE_MAPPING Let's create a mapping table. DEV DOC_TYPE_MAPPING
Let's create a mapping table. DEV
Challenge #2 Ugly unreadable table names! Ugly unreadable table names!
So...finally... Read XML Dynamic DDL generation Document Type Alias DocumentType
Defined Yes No Extract Metadata Store Metadata Store Content Simple use case becomes complex...
Remember... Our Challenge QA Let's see if we are in
spec for response time. Aah..what about performance now? DEV
MongoDB Document Based GridFS B-Tree Dynamic Schema JSON BSON Query
Scalable http://www.10gen.com/presentations/storage-engine-internals Joins Complex Transaction
F1 F2 F3 F4 F5 ID1 ID2 ID3 ID4 ID5
F1 F1 F1 F1 F2 F2 F3 F4 F5 F6 F2 F3 F4 F5 Fx F8 F3 F9 F7 Concepts Database Collection Collection Collection Collection Collection Collection Database Collection Collection Collection Collection Collection Collection Database Collection Collection Collection Collection Collection Collection Database Collection Collection Collection Collection Collection Collection Table = Collection Column = Field Row = Document Database = Database
GridFS MongoDB divides the large content into chunks Stores Metadata
and Chunks separately http://docs.mongodb.org/manual/core/gridfs/
> mybucket.files { "_id" : ObjectId("514d5cb8c2e6ea4329646a5c"), "chunkSize" : NumberLong(262144), "length"
: NumberLong(103015), "md5" : "34d29a163276accc7304bd69c5520e55", "filename" : "health_record_2.xml", "contentType" : application/xml, "uploadDate" : ISODate("2013-03-23T07:41:44.907Z"), "aliases" : null, "metadata" : { "fname" : "Aparna", "lname" : "Chaudhary","country" : "Netherlands" } } ObjectId - 12 Byte BSON: 4 Byte - Seconds since Epoch 3 Byte - Machine Id 2 Byte - Process Id 3 Byte - Counter
> mybucket.chunks { "_id" : ObjectId("514d5cb8c2e6ea4329646a5d"), "files_id" : ObjectId("514d5cb8c2e6ea4329646a5c"), "n"
: 0, "data" : BinData(0,...) }
? I'm storing 10KB file, but would it use 256KB
on disk? Last Chunk = FileSize % 256 + Metadata overhead 256 1128KB 256 256 256 104 + x 10KB 10 + x Chunk is as big as it needs to be...
Challenge #1 DEV MongoDB supports Dynamic Schema. You can use
collection per docType and they are created dynamically. RA We need runtime support for document type.
Challenge #2 RA Document type is 50 char long DEV
MongoDB namespace can be up to 123 char.
So...finally... Simple use case remains simple...well becomes simpler... Read XML
Extract Metadata Store Metadata & Content
Remember... Our Challenge QA Let's see if we are in
spec for response time. DEV Performance test is part of our definition of 'DONE'
BEcause seeing is believing! Demo ‣ GridFS 2.4.0 ‣ PostgreSQL
9.2 ‣ Spring Data ‣ JMeter 2.7 ‣ Mac OS X 10.8.3 2.3GHz Quad-Core Intel Core i7, 16GB RAM https://github.com/aparnachaudhary/nosql-matters-demo
EMBRACE POLYGLOT PERSISTENCE! STOP RDBMS ABUSE! KNOW YOUR USE CASE
@aparnachaudhary
Java Developer, Data Lover Eindhoven, Netherlands http://blog.aparnachaudhary.com/ @aparnachaudhary Thank You!