remodel your persistence layer
May 06, 2015
remodel your persistence layer
ORM
object redis mapper
“People that are wrapping ORM’s around redis are missing the point.”
— Nate Wiger
OMG
why replace mysql with remodel + redis ?
“Memory is the new Disk. Disk is the new Tape.”
— Jim Gray
speed!
flickr.com/photos/atzu/2645776918
mysql
• read scaling
• vertical: more memory
• horizontal: master-slave replication
• write scaling
• vertical: more / faster disks (raid, ssd ...)
• horizontal: sharding
“You are not Facebook.” — me
redis
• ~ 100K ops / second (read or write)
• read scaling?
• probably not necessary
• write scaling
• probably not necessary
• (but sharding is possible)
remodel
• “minimal” object mapper
• mapping strategy:
• unique key prefix per entity class
• serialize properties to json
• store associations as separate keys
• less than 300 lines of ruby
features
• supports all basic ruby / json types
• plus custom mappers (date, time ...)
• associations
• one-to-many / many-to-one
• one-to-one, many-to-many
flickr.com/photos/78918694@N00/3519713609
demo time!
limitations
• only very basic validations
• use ActiveModel::Validations
• no complex finders
• not supported by redis
• maybe somebody wants to build redis-lucene ?
roadmap
• current status — alpha (0.1.0)
• next month:
• “eat your own dogfood”
• bugfixing
• documentation
• beta release
ideas
• find_by(with ohm-like indexes)
• optimistic locking
• re-implement in node.js
• .... what else ?
??
github.com/tlossen /remodel
fork me: