Redis @ Kijiji.it
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Redis @ Kijiji.it

on

  • 1,881 views

Redis @ Kijiji.it

Redis @ Kijiji.it

Statistics

Views

Total Views
1,881
Views on SlideShare
1,881
Embed Views
0

Actions

Likes
0
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Redis @ Kijiji.it Presentation Transcript

  • 1. Redis @ Kijiji.it NoSQL Day 2013 - Udine Marco Borromeo (@borros)
  • 2. Dove salviamo... ... i contatori? ... funzionalità “a tempo”? ... white/black lists? ... i log delle modifiche? ... cache feed esterni? ... coda di operazioni asincrone? MySQL
  • 3. Contatori in MySQL SELECT COUNT(*) Aggiungiamo un indice! Creiamo dei trigger che aggiungono/sottraggono unità in una tabella di contatori *GASP*
  • 4. “Creiamo dei trigger che aggiungono/sottraggono unità in una tabella di contatori”
  • 5. INCR DECR (+ business logic nei listeners)
  • 6. Introduzione di Redis 2 Shards Ogni shard formato da un Master e uno Slave Custom Failover 2 eth RAM come se piovesse CPU libera per bitcoin
  • 7. Funzionalità “a tempo”... <count> = INCR <userUUID>:instant_replies SETEX <userUUID>:instant_replies 60 <count> (se <count> dello spam level...) SETEX <userUUID>:is_banned 600 1
  • 8. White & Black Lists SADD users_whitelist marborromeo@ebay.com SISMEMBER users_whitelist marborromeo@ebay.com SREM users_whitelist marborromeo@ebay.com
  • 9. Time series (semplici) <action_id> = INCR admin_actions HSET admin_action:<action_id> action changeCatgory admin_user_id 1 ZADD post:2:admin_actions <TS> <action_id>
  • 10. Cache Feeds Sorted Sets (score TS per ordinare) Hash (Articolo)
  • 11. Job Queue - Enqueue jobId = INCR jobs.id job = HMSET job:<jobId> job “sendMail” to “marborromeo@ebay.com” ZADD scheduled_jobs <TS> <jobId>
  • 12. Job Queue - Schedule ZRANGEBYSCORE scheduled_jobs -inf <TS> LPUSH enqueued_job <jobId> ZREM scheduled_jobs <jobId>
  • 13. Job Queue - Worker BRPOPLPUSH scheduled_jobs scheduled_jobs:<workerId>
  • 14. Shared config Login tokens Accendere / Spegnere funzionalità Locks
  • 15. Ma qualcosa è andato storto... Sharding Sharding nei drivers
  • 16. BZFlag ranks
  • 17. Grazie! Marco Borromeo (@borros)