SlideShare a Scribd company logo
#redisldn




    Welcome
(The First) London Redis Meetup

       @robbiehudson
       @adamcharnock
          @bash
#redisldn

                               The Agenda
• Quick Redis introduction
• Using Redis to store all our data, hahaha
  (Rob & Adam / PlayNice.ly)


• Queuing and non-persistent lists
  (Thomas / Mint Digital)


• Super-fast caching and Redis
  (Demis / mFlow)


• QA
#redisldn




Onwards!
#redisldn

What is Redis?
#redisldn

                What is Redis?

• Advanced key value store
• Data Structure Server (+ more!)
 • Lists, Sets, Hashes
                     (and lots of other cool stuff)


• Super-fast in Memory
 • But it is persistent, and now supports VM
#redisldn

  Created by...




Salvatore Sanfilippo (@antirez)
          ... now VMWare
    ... and Pieter Noordhuis
#redisldn

               Redis and PlayNice.ly

•   PlayNice.ly: Collaboration web app for software developers...
 •   So, a bug tracker :)



• And we store all our information in Redis
 •   users, projects, bugs, comments, audit logging, search indexes...
#redisldn

       Redis schema example


• Why you need a schema? ho ho ho
#redisldn

                     Users

user:5:name → “Pete Mascot”
user:5:username → “pete”
user:5:email → “pete@playnice.ly”
#redisldn

                   Projects

project:9:name → “Alan Parson’s Project”
project:9:created_at → 1274815155
...
#redisldn

   Linking users to projects

user:5:projects → SET(2, 9, 13)

project:9:users → SET(3, 5, 9)
#redisldn

 But that looks like hard work!


• Yes it is, so use a model!
#redisldn

                ORM for Redis

• Ohm: http://ohm.keyvalue.org (Ruby)
• http://github.com/nateware/redis-objects (Ruby)
• http://github.com/whoahbot/dm-redis-adapter (Ruby)
• http://github.com/kijin/stalkr (PHP, “not production ready”)
• Roll your own (like we did, for Python)
#redisldn

    A quick example
>>> user = models.User.create()
>>> user.user_id
6
>>> user.name = "Pete"
>>> user.name
u'Pete'
>>> user.projects
[]
#redisldn

    A quick example

>>> project = models.Project.create()
>>> project.project_id
8
>>> project.users
[]
#redisldn

    A quick example

>>> project.users.add(6)
>>> project.users
[6]
>>> user.projects
[8]
#redisldn

Proving it actually worked...
>>> redis.get("user:6:name")
'Pete'

>>> redis.smembers("project:8:users")
set(['6'])

>>> redis.smembers("user:6:projects")
set(['8'])
#redisldn

                      Summary
• It is very fast!
• Other cool stuff:
 • search
 • migrations
 • message queuing
• PlayNice.ly is entering into Private Beta in the next few
 weeks!
#redisldn

             Find out more!

•http://playnice.ly
• http://playnice.ly/blog
• @playnicelyapp
#redisldn

                               The Agenda

• Quick Redis introduction
• Using Redis to store all our data, hahaha
  (Rob & Adam / PlayNice.ly)


• Queuing and non-persistent lists
  (Thomas / Mint Digital)


• Super-fast caching and Redis
  (Demis / mFlow)
#redisldn




   Thanks!
Any Questions?

More Related Content

PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)

  • 1. #redisldn Welcome (The First) London Redis Meetup @robbiehudson @adamcharnock @bash
  • 2. #redisldn The Agenda • Quick Redis introduction • Using Redis to store all our data, hahaha (Rob & Adam / PlayNice.ly) • Queuing and non-persistent lists (Thomas / Mint Digital) • Super-fast caching and Redis (Demis / mFlow) • QA
  • 5. #redisldn What is Redis? • Advanced key value store • Data Structure Server (+ more!) • Lists, Sets, Hashes (and lots of other cool stuff) • Super-fast in Memory • But it is persistent, and now supports VM
  • 6. #redisldn Created by... Salvatore Sanfilippo (@antirez) ... now VMWare ... and Pieter Noordhuis
  • 7. #redisldn Redis and PlayNice.ly • PlayNice.ly: Collaboration web app for software developers... • So, a bug tracker :) • And we store all our information in Redis • users, projects, bugs, comments, audit logging, search indexes...
  • 8. #redisldn Redis schema example • Why you need a schema? ho ho ho
  • 9. #redisldn Users user:5:name → “Pete Mascot” user:5:username → “pete” user:5:email → “pete@playnice.ly”
  • 10. #redisldn Projects project:9:name → “Alan Parson’s Project” project:9:created_at → 1274815155 ...
  • 11. #redisldn Linking users to projects user:5:projects → SET(2, 9, 13) project:9:users → SET(3, 5, 9)
  • 12. #redisldn But that looks like hard work! • Yes it is, so use a model!
  • 13. #redisldn ORM for Redis • Ohm: http://ohm.keyvalue.org (Ruby) • http://github.com/nateware/redis-objects (Ruby) • http://github.com/whoahbot/dm-redis-adapter (Ruby) • http://github.com/kijin/stalkr (PHP, “not production ready”) • Roll your own (like we did, for Python)
  • 14. #redisldn A quick example >>> user = models.User.create() >>> user.user_id 6 >>> user.name = "Pete" >>> user.name u'Pete' >>> user.projects []
  • 15. #redisldn A quick example >>> project = models.Project.create() >>> project.project_id 8 >>> project.users []
  • 16. #redisldn A quick example >>> project.users.add(6) >>> project.users [6] >>> user.projects [8]
  • 17. #redisldn Proving it actually worked... >>> redis.get("user:6:name") 'Pete' >>> redis.smembers("project:8:users") set(['6']) >>> redis.smembers("user:6:projects") set(['8'])
  • 18. #redisldn Summary • It is very fast! • Other cool stuff: • search • migrations • message queuing • PlayNice.ly is entering into Private Beta in the next few weeks!
  • 19. #redisldn Find out more! •http://playnice.ly • http://playnice.ly/blog • @playnicelyapp
  • 20. #redisldn The Agenda • Quick Redis introduction • Using Redis to store all our data, hahaha (Rob & Adam / PlayNice.ly) • Queuing and non-persistent lists (Thomas / Mint Digital) • Super-fast caching and Redis (Demis / mFlow)
  • 21. #redisldn Thanks! Any Questions?

Editor's Notes

  1. Admin stuff Thanks to Mint for hosting Why we’re organising it Hashtag Video/Slides etc
  2. Put some times on here and include QA and drinks!!
  3. Russian for Radish?
  4. non-blocking io, single threaded pub sub and notifications replication cluster support soon 1.2.6 2.0 RC1 out...
  5. Lives in Italy Active Mailing List 20 client libraries in over 10 different languages
  6. “Just about to enter private beta” Chose redis because 1. Its cool 2. Damn fast and scales well
  7. - we went into it thinking: “hey, no schema needed :)” - sadly, not the case, need some structure (e.g. to key naming) - so here is how we tackled it...
  8. - pretty obvious, just string keys :)
  9. - again, pretty clear what is going on - linking projects and users? ...
  10. Sets store COLLECTION of unique values, and will optimise data storage for integer values
  11. Data integrity is enforced at the API level, not the DB level Migrations
  12. nothing for python
  13. 100k on bare-metal, 60% on EC2 VM