Your SlideShare is downloading. ×
0
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
A Brief Introduction to Redis
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

A Brief Introduction to Redis

983

Published on

This is a brief, high-level overview of Redis, a networked data structure server.

This is a brief, high-level overview of Redis, a networked data structure server.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
983
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
16
Comments
0
Likes
1
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. A Brief Introduction to Redis Charles Anderson ! Salem Dynamic Languages User Group January 2014
  • 2. Overview • Redis is a networked “data structure server” • Fast, powerful, simple
  • 3. Abstract Data Types • In the Before Time, we didn’t have classes and objects - we had abstract data types • and, we liked it! • Procedural interface • First (or last) parameter is the ADT
  • 4. Example: Stack • push(stack, item) • pop(stack): item • size(stack): int • etc.
  • 5. Stack ADT • We had a single, global name space. So: • stack_push(stack, item) • stack_pop(stack) • stack_size(stack) • This is what the Redis API looks like
  • 6. Redis Types • String - scalar value • List • Set • Sorted Set • Hash
  • 7. Redis List • A small subset of the operations: • LPUSH key value • LPOP key • LLEN key • LRANGE key start stop
  • 8. Redis API • Every object has a name/key • First parameter to each call • Every object has a type • Operation must match the type of object
  • 9. Using API via CLI $ redis-cli redis 127.0.0.1:6379> lpush mylist 1 (integer) 1 redis 127.0.0.1:6379> lpush mylist cat (integer) 2 redis 127.0.0.1:6379> lpush mylist 3.14 (integer) 3 redis 127.0.0.1:6379> llen mylist (integer) 3 redis 127.0.0.1:6379> lrange mylist 0 1 1) "3.14" 2) "cat" redis 127.0.0.1:6379> lrange mylist 0 -1 1) "3.14" 2) "cat" 3) "1"
  • 10. Redis Clients • The wire protocol for Redis is dead-simple • Therefore, lots of clients for lots of languages
  • 11. Ruby Client Demo irb(main):015:0> r.lpush('mylist', 1) => 1 irb(main):016:0> r.lpush('mylist', 'cat') => 2 irb(main):017:0> r.lpush('mylist', 3.14) => 3 irb(main):019:0> r.lrange('mylist', 0, -1) => ["3.14", "cat", "1"]
  • 12. Complete Redis API • http://redis.io/commands • Each command includes the time complexity of the operation - unique
  • 13. Set • SADD key member, SREM key member • SCARD key • SISMEMEBER key member • SINTER, SUNION
  • 14. Sorted Set • ZADD key score member • ZSCORE key member • ZRANK key member • ZRANGE key start stop • Use case: leader board
  • 15. Hash • HSET key field value • HGET key field • HEXISTS key field, HKEYS, HLEN • Use case: a structured record like User
  • 16. Other Stuff • Key Expiration • Transactions/batches • Publish-Subscribe • Server-side scripting via Lua • Replication • Clustering
  • 17. Implementation Details • Everything is stored in memory • • Hella fast Not memcache - expiration is not LRU • Persistent - tunable disk storage • Single-threaded - simple, fast, single CPU • Support (@antirez) is awesome
  • 18. But, is it Web Scale? • NoSQL key/value store • Kickass benchmarks • Simpler (smaller scope) than HBase or Cassandra • Sharding done by clients • Not usually a system of record • I already work on a farm
  • 19. More Information • http://redis.io • “The Little Redis Book” Seguin • “Redis in Action” Carlson • “Redis Cookbook” Macedo and Oliveira
  • 20. Questions •?

×