remodel your persistence layer

2,200 views

Published on

presented at ruby user group berlin on 2010-04-01

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,200
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
23
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

remodel your persistence layer

  1. 1. remodel your persistence layer
  2. 2. ORM
  3. 3. object redis mapper
  4. 4. “People that are wrapping ORM’s around redis are missing the point.” — Nate Wiger
  5. 5. OMG
  6. 6. why replace mysql with remodel + redis ?
  7. 7. “Memory is the new Disk. Disk is the new Tape.” — Jim Gray
  8. 8. speed! flickr.com/photos/atzu/2645776918
  9. 9. mysql • read scaling • vertical: more memory • horizontal: master-slave replication • write scaling • vertical: more / faster disks (raid, ssd ...) • horizontal: sharding
  10. 10. “You are not Facebook.” — me
  11. 11. redis • ~ 100K ops / second (read or write) • read scaling? • probably not necessary • write scaling • probably not necessary • (but sharding is possible)
  12. 12. 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
  13. 13. 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
  14. 14. demo time! flickr.com/photos/78918694@N00/3519713609
  15. 15. limitations • only very basic validations • use ActiveModel::Validations • no complex finders • not supported by redis • maybe somebody wants to build redis-lucene ?
  16. 16. roadmap • current status — alpha (0.1.0) • next month: • “eat your own dogfood” • bugfixing • documentation • beta release
  17. 17. ideas • find_by(with ohm-like indexes) • optimistic locking • re-implement in node.js • .... what else ?
  18. 18. ??
  19. 19. fork me: github.com/tlossen /remodel

×