Remote Dictionary Server: Nilesh D Department of It
Remote Dictionary Server: Nilesh D Department of It
NILESH D
DEPARTMENT OF IT
Overview
History
Users
Logical Data Model
Atomic Operators
Transactions
Redis Persistance
WHY REDIS?
• Written in: C
• Main point: Blazing fast
• License: BSD, Open Source
• Disk-backed in-memory database,
History
Early 2009 - Salvatore Sanfilippo, an Italian developer,
started the Redis project
He was working on a real-time web analytics solution and
found that MySQL could not provide the necessary
performance.
June 2009 - Redis was deployed in production for the
LLOOGG real-time web analytics website
March 2010 - VMWare hired Sanfilippo to work full-time on
Redis (remains BSD licensed)
Other Users
Logical Data Model
Data Model
Key
Printable ASCII
Value
Primitives
Strings
Containers (of strings)
Hashes
Lists
Sets
Sorted Sets
Logical Data Model
Data Model
Key
Printable ASCII
Value
Primitives
Strings
Containers (of strings)
Hashes
Lists
Sets
Sorted Sets
Logical Data Model
Data Model
Key
Printable ASCII
Value
Primitives
Strings
Containers (of strings)
Hashes
Lists
Sets
Sorted Sets
Logical Data Model
Data Model
Key
Printable ASCII
Value
Primitives
Strings
Containers (of strings)
Hashes
Lists
Sets
Sorted Sets
Logical Data Model
Data Model
Key
Printable ASCII
Value
Primitives
Strings
Containers (of strings)
Hashes
Lists
Sets
Sorted Sets
Logical Data Model
Data Model
Key
Printable ASCII
Value
Primitives
Strings
Containers (of strings)
Hashes
Lists
Sets
Sorted Sets
Shopping Cart Example
Relational Model
carts
CartID User
1 james
2 chris
3 james
cart_lines
Cart Product Qty
1 28 1
1 372 2
2 15 1
2 160 5
2 201 7
UPDATE cart_lines
SET Qty = Qty + 2
WHERE Cart=1 AND Product=28
Shopping Cart Example
Relational Model Redis Model
carts set carts_james ( 1 3 )
CartID User set carts_chris ( 2 )
1 james hash cart_1 {
2 chris user : "james"
3 james
product_28 : 1
cart_lines product_372: 2
Cart Product Qty }
1 28 1 hash cart_2 {
1 372 2 user : "chris"
2 15 1 product_15 : 1
2 160 5 product_160: 5
2 201 7 product_201: 7
UPDATE cart_lines }
SET Qty = Qty + 2
HINCRBY cart_1 product_28 2
WHERE Cart=1 AND Product=28
REDIS ARCHITECTURE
REDIS Persistance