REDIS AT GUARDIAN.CO.UK
      Michael Brunton-Spall - @bruntonspall
MPS’ EXPENSES (2)
MPs’ Expenses 2
Before Redis


Originally selected a random article to start reviewing

SQL = ORDER BY RAND() LIMIT 1

Inefficient and horrible
If in doubt, ask
With Redis


Maintain redis set of all available pages per assignment

Maintain redis set of reviewed pages per assignment

SDIFFSTORE the two sets

Use SRANDMEMBER on the stored set
SDIFFSTORE
SRANDMEMBER
SOULMATES
Soulmates
What do we use it for?


github.com/simonw/django-redis-monitor

  Written internally by Simon Willison and Daniel Vydra

  Counts requests per second / SQLops per second in django

Management switches
Management Switches


Whats the problem?

  We’re basically a java shop

  In Java, management switches are easy

  In python not so much
How Java Works
How Python Works
Soulmates Architecture
   Django          Django
  Frontend        Frontend
          Redis           Redis

  Scala API       Scala API       Solr Slave
                                   Solr Slave
  WebApp          WebApp


                                  Solr Master

                  MongoDB
                   MongoDB
Switches must be externalised


Normally we’d use the database but

  Soulmates django app doesn’t have a database

  So we used redis
Define and initialise
Implementation
Redis Switches


Hit a URL on any server, any process to toggle switch

All processes are able to check that switch later

Redis processes are local to the machine

Redis at the guardian