Top Banner
NoSQL replacement for SQLite (for Beatstream) Antti-Jussi Kovalainen Seminar OHJ-1860: NoSQL databases
81

NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Apr 22, 2018

Download

Documents

vuongkhanh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

NoSQL replacement for SQLite

(for Beatstream)

Antti-Jussi Kovalainen

Seminar OHJ-1860: NoSQL databases

Page 2: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,
Page 3: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Background

Page 4: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,
Page 5: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,
Page 6: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,
Page 7: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,
Page 8: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,
Page 9: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Inspiration:

postgresapp.com

Page 10: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

demo.beatstream.fi (modern desktop browsers without Flash block)

Page 11: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,
Page 12: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Backend

• Very light

– Access & modify data

– Relay commands to Last.fm

• Currently Ruby on Rails

• So, we’ll focus on the backend

Page 13: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

My Super Complex Data Model

Page 14: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Playlists Songs

Copy the song row

User

s

Relation?

Page 15: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Data

Page 16: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Users

• Few users

• Not many fields: username, email, password, lastfm_key

• Read when user logs in

• Write rarely

• Because users have their own playlists

Page 17: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Songs

• Huge list of objects (array)

• Read after user logs in

• Write rarely

• Basically just meta-data about a song: title, artist,

album, tracknum, path, etc…

Page 18: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Playlists

• Possibly Huge lists of objects (arrays)

• Read a good amount during a day

• Write a lot (probably)

• Owned by a user

• Contains songs

– Also need to track song’s position on the playlist

Page 19: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

SQLite

Page 20: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Why I chose SQLite

• Easy-to-use, simple, familiar

• Ready-to-use on new Rails project

• Simple data model get a simple DBMS?

• Can easily implement CRUD, playlist sorting, etc.

• Great for rapid prototyping

• Doesn’t require separate server installation

Page 21: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Why Replace SQLite?

Page 22: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Why Replace?

1. Fear of Bad Concurrency

– Multiple users + SQLite = Bad memories

• Writing playlists takes time

• Writing the songs list takes time

• SQLite locks up or corrupts data

– Sadness

2. Try something new

– Schemaless == even better for prototyping?

Page 23: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Sidenote

Page 24: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

At The Moment

• Moved to JSON files

– Songs and Playlists are in JSON files

– Users are in SQLite

• SQLite was just getting in the way

– SQLite <--> SQL result <--> JSON

– Keep It Simple

• But this feels kinda icky

Page 25: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

songs.json

Over 9000 objects

Page 26: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Back to regular programme

Page 27: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Features We Want • Standalone / embeddable / portable

– Can embed into application, invisible to Beatstream server user or admin

– No separate server installation etc.

• Simple, easy-to-use

• SQLite-like performance or better

• Lightweight

• No availability, concurrency or consistency problems

– The database can’t be the reason a song won’t play

– When adding a song to a playlist, it should be there and be there always

– The frontend asks only once which songs are in the DB and they should be there always

Page 28: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Features We Want (2)

• Can store whole song library

– Also read it all fast (or we cache it)

– No need for sorting

• Can store sort information somehow

– Sorting of playlists & playlist songs

– Not as obvious as it sounds

• Can fetch only certain user’s playlists

– Relational data!

• (Please, work with Ruby or JRuby)

Page 29: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

NoSQL

Page 30: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,
Page 31: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

CAP

• Consistency

• Availability

• Partition tolerance

Page 33: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Screw CAP

Page 34: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Why NoSQL?

• Data is simple, just lists of objects

– Not relational data

– Songs, Playlists, Users

– Don’t need big queries, joins, analytics, versioning, or anything super-

– Document-oriented systems seem nice for this

• Maybe JSON-oriented?

Page 35: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Why NoSQL? (2)

“try to limit the work done over your data and just store it, then retrieve it and

show it to the user, do not over process the information. Manipulate JSON on

the user interface and send it to the database with few or even none

modification.”

– djondb (http://djondb.com/documentation.html)

I like this idea.

Page 36: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Why NoSQL? (3)

• Standalone / embeddable / portable

– Most SQLite replacement suggestions were

NoSQL systems

• Schemaless

– Think different

Page 37: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Why NoSQL? (4)

• NoSQL systems usually concentrate on

performance and scalability

– I’m not really concerned about those things right

now

– Maybe should not pick NoSQL then?

Page 38: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Why NoSQL? (5)

• Try new things

• Experiment

• It’s what the cool kids use

• And in the end…

– Tech doesn’t matter. Until it does.

Page 39: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Choices

Page 40: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Criteria

STOP

Page 41: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Criteria

• Beatstream’s backend is small-scale with:

– Less than 100,000 rows

– Performance rarely a problem

– No horizontal scaling

And I’m stressing over database choice?

Page 42: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Criteria

Page 43: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Criteria

Page 44: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Criteria

• Standalone / embeddable / portable (no separate server software)

• Lightweight

• Keeps It Simple

• Can store and access our data easily

– Key-value, document-oriented, column-oriented, or something which fits

• Good performance

• No availability, concurrency or consistency problems

• (Works with Ruby, or with Java for use with JRuby)

Page 45: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Criteria (2)

In the future:

• Someone might create a Spotify competitor

using Beatstream with millions of users

• Scaling etc., becomes important, but it’s not important

now

Page 46: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Choices

Key-value

• Kyoto Cabinet

• LevelDB

Page 47: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Choices (2)

Document-oriented

• MongoDB

• CouchDB

• RavenDB

• Terrastore

Page 48: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Choices (3)

Other

• db4o

Page 49: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Findings

Page 50: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Kyoto Cabinet

Page 51: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Kyoto Cabinet

• Key-value store

• Standalone file-based database (also in-memory)

• Support for many languages (Ruby, Java, C#, PHP, etc.)

• Popular (community)

• Hash table or B+ tree based

– Can’t decide which one would be better for Beatstream, have to test

– Hash table: random sorted – not an issue, sorting in frontend

Source: http://fallabs.com/kyotocabinet/

Page 52: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Kyoto Cabinet (2)

Notes:

• Replace SQLite on apps that store simple data

• How do I store song and playlist data in a key-value store?

– Need two collections/tables: songs and playlists

– Own database files for songs and playlists?

– key: filepath --> value: song meta-data as JSON?

Page 53: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

LevelDB

Page 54: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

LevelDB

• Key-value store

• Standalone file-based database

• Support for many languages (C/C++, Ruby, Java)

• Built by Google for use in Google Chrome

• Sorting by key

• Fast write & read, slow if value is large

Sources: http://code.google.com/p/leveldb/, http://en.wikipedia.org/wiki/LevelDB

Page 55: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

LevelDB (2)

Notes:

• Same as with Kyoto Cabinet: good for

simple use, but how do I use key-value

with Beatstream?

Page 56: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

MongoDB

Page 57: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

MongoDB

• Document-oriented

– JSON-style documents!

– Collections are logical and easy!

• For many languages (C/C++, Ruby, Java, C#, PHP, …)

• Easy to use, simple

– “Mongo is a schemaless relational database” – Some people

– Indexes instead of map/reduce functions

• Active community

– Lots of plugins, etc.

Page 58: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

MongoDB (2)

Notes:

• Crash right after successful write: might lose data

• Embedding is not simple, need to build/find a

C++ wrapper & launch DB process in app.

source: http://stackoverflow.com/questions/6115637/can-mongodb-be-used-as-an-embedded-database

Page 59: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

CouchDB

Page 60: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

CouchDB

• Document-oriented

• For many languages

Page 61: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

CouchDB (2)

Notes:

• I would have a HTTP API accessing a HTTP API?

• Embedding is hard

– Need to install Erlang somehow on the user’s

computer

Page 62: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

RavenDB

Page 63: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

RavenDB

• Document-oriented

• Standalone directory/file-based database

• For .NET and Javascript (NodeJS)

• Detailed info on how RavenDB works, listen:

http://herdingcode.com/wp-content/uploads/HerdingCode-0083-Ayende-Rahien-on-

RavenDB.mp3

Page 64: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

RavenDB (2)

Notes:

• No Ruby support :(

Page 65: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Terrastore

Page 66: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Terrastore

• Document-oriented

• For Java, maybe can attach to JRuby?

• Main feature is scalability without sacrificing

consistency

• Seems easy to use

Page 67: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Terrastore (2)

Notes:

• Could not find how to run standalone…

Page 68: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

db4o

Page 69: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

db4o

• Object database

• For Java

• Simple, easy

• Sidenote: Works on Android out-of-the-box

Page 70: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

db4o (2)

Notes:

• Known issue with objects duplicating by

itself sometimes

Page 71: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Eliminated Choices

Page 72: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Eliminated Choices • Berkeley DB

– No time to investigate…

• Cassandra

– “the right choice when you need scalability and high availability”

• SimpleDB

– “Optimized to provide high availability”

– Not really standalone / embeddable / portable, but in the cloud and “invisible”

• djondb

– Not standalone / embeddable / portable

• Couchbase

– Could not find a way to run embed, maybe it’s the same as with CouchDB

Page 73: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Conclusions

Page 74: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Conclusions

• NoSQL systems promote their horizontal

scalability, replication, sharding, etc.

– Features I don’t really care about right now

• Feels like I’m looking at the wrong thing in the

wrong place (for Beatstream at least)

– Only time will tell

Page 75: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Conclusions (2)

MongoDB

CouchDB

Kyoto Cabinet

Page 76: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Conclusions (3)

Simple key-values in SQLite:

• Kyoto Cabinet and LevelDB seem like

excellent replacements

– Use cases: Queue, word dictionary, user

database, document database, session

management, CMS cache

Page 77: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Conclusions (4)

More complex relations:

• Have a look at MongoDB, CouchDB or

RavenDB (.NET)

Page 78: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Extra

• Later: Convert Users-table in SQLite to the

new NoSQL database

– Songs can be re-created

– Playlists is a new feature, hasn’t been released

Page 79: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Extra (2)

• Redis could be embeddable:

“[communicate over unix domain socket] you can fork your main

process, then run one of the exec*() functions in the child to start

Redis.”

source: http://code.google.com/p/redis/issues/detail?id=276

Page 80: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Thx!

ajk.im

@darep

Page 81: NoSQL replacement for SQLite (for Beatstream) - TUTtjm/seminars/nosql2012/sqlite-to-nosql.pdf · – MongoDB is like this and people use it for the strangest things . ... (Ruby, Java,

Links!

http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis

http://blog.nahurst.com/visual-guide-to-nosql-systems

http://www.cs.tut.fi/~tjm/seminars/nosql2012/NoSQL-Intro.pdf

https://speakerdeck.com/u/kplawver/p/nosql-an-introduction

http://fallabs.com/kyotocabinet/rubydoc/

http://blog.creapptives.com/post/8330476086/leveldb-vs-kyoto-cabinet-my-findings

http://herdingcode.com/wp-content/uploads/HerdingCode-0083-Ayende-Rahien-on-

RavenDB.mp3