Redis Overview
- 2. 2
Outline
● NoSQL and Redis
● The Creation of Redis
● Redis Features
● Redis Persistence
- 3. 3
NoSQL
● Non-relational
● Distributed
● Open-source
● Horizontally scalable
- 6. 6
The Creation of Redis
The story of Salvatore Sanfilippo (antirez)
Creator of Redis
- 7. 7
Business
● Receiving a stream of page views from multiple websites.
● Storing the latest n page views for every site
● Show latest page views in real time to users
● Maintaining history
- 8. 8
Problem
With a peak load of a few thousand page views per second
● Whatever the database schema was
● Whatever trade-offs is
→ No way for storing by SQL
- 9. 9
The Creation of Redis
Solution
● In-memory data store
● Storing lists as a native data type
● Implementing using C language
● Adding fork-based persistence feature
- 10. 10
The Creation of Redis
Solution
● In-memory data store
● Storing lists as a native data type
● Implementing using C language
● Adding fork-based persistence feature
→ Finally, Redis was born!
- 16. 16
Data Model
● STRING
● LIST
● SET
● HASH
● ZSET (Sorted Set)
- 23. 23
RDB (Redis Database)
Point-in-time snapshots of dataset at specified intervals.
- 24. 24
RDB (Redis Database)
Advantages
● Perfect for backup and transfer
● Maximum performance
- Child process: Persist on disk
- Parent process: No I/O
- 25. 25
RDB (Redis Database)
Disadvantages
● Cannot minimize the chance of data loss
● fork() can be time consuming if the dataset is big
- 27. 27
AOF (Append Only File)
● Logs every write operation received by the server
● Plays again operation at server startup to reconstruct
the original dataset
- 28. 28
AOF (Append Only File)
Advantages
● Durability (sync every second, every query)
● No seek is required
● Automatically rewrite AOF in background when it
gets too big
- 29. 29
AOF (Append Only File)
Disadvantages
● Files are usually bigger than RDB files.
● Can be slower than RDB
● Rare bugs in specific commands
- 31. 31
References
TỔNG QUAN VỀ REDIS http://tech.blog.framgia.com/vn/?p=3365
@dinhhoanglong91