Redis @ Kijiji.it

  • 1,815 views
Uploaded on

Redis @ Kijiji.it

Redis @ Kijiji.it

More in: Technology , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,815
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
6
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

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)