Building Scalable, Distributed Job Queues with Redis and Redis::Client

This video is in English.
Length: 32:45
Source: YAPC::NA 2012 on the 2012-06-13.
Speaker: Mike Friedman (friedo) speaker

In this talk Mike Friedman firts describes Redis itself, the datatypes of Redis and the protocols one can use to talk to Redis. Then mentiones the 3 Perl distributions that were available (back in 2012) to talk to Redis and describes the modules in Redis::Client he wrote. Then he shows some Perl examples using Redis::Client, including one using tie, basically mapping the Redis data into a Perl hash.

At around 18:27 he starts to talk about Job Queues.

Redis

Redis is a BSD licensed, advanced key-value store. Stores everything in memory, flashes it to disk, but you can loose data. (But apparently newer versions of Redis can have journaling storing data in the disk)

Not over HTTP, it has its own protocol.

Redis Data Types

  • Strings ('foo', '42', a JSON blob) thing scalar in Perl
  • Lists (zero or more strings, ordered) operations: RPUSH, RPOP, LPUSH, LPOP
  • Hashes (zero or morekey-value pairs, unordered, unique) operations: HDEL, HEXISTS, HKEYS, HVALS
  • Sets (zero or more keys, unordered, unique, no separate values) operations: SREM, SISMEMBER, SMEMBERS, Union, Intersection, Add/remove, Cardinality
  • Sorted sets (zsets) (zero or more keys, each with a numeric "score". No values.) operations: ZREM, ZRANK, ZRANGE

Old text based protocol

New protocol - Unified Request Protocol (URP)

Much better! Binary round-trip safe.

CPAN