Redis
I believe everyone's first impression of Redis is "cache", which is easier to understand, use and control than Memcache. But Redis, as the most widely used storage middleware in the field of Internet technology, actually has many other application scenarios. When the concurrency of the system reaches a certain level and the traffic rises, other Redis functions need to be applied.
How important is Redis?
Regardless of its super high performance, the fact that many large Internet companies and many small and medium-sized companies at home and abroad have applications can show that Redis has become an indispensable skill for middle and advanced back-end developers! If you cannot understand the deep principles behind Redis in depth, many problems cannot be understood at all, let alone solved. So how do you know what Redis is and why, and prepare for future growth as an architect? Don't panic, I just got a copy of his internal "Redis Growth Notes" from a friend of Baidu from Lei Feng on the Internet (in my editor) some time ago. After reading it, there is really more than a slight gap!
There are 6 parts of this note. Due to space limitations, it can only be displayed in the form of screenshots of the main content, one-click three consecutive + comments, and then add my VX (tkzl6666) to receive it for free.
Basics
- Redis installation
- Redis basic data structure
- string (string)
- lit (list)
- hash (dictionary)
- set
- General rules for container data structures
Application
(Distributed lock, delay queue, bitmap, HyperLogLog, Bloom filter, simple current limit, funnel current limit, GeoHash, Scan)
- Distributed lock
- Distributed lock
- Timeout problem
- Reentrancy
- bitmap
- Basic use
- Statistics and lookup
- Magic instruction bitfield
- Bloom filter
- What is a Bloom filter?
- Bloom filter in Redis
- Basic use of Bloom filter
- Precautions
- Principle of Bloom filter
- Space occupation estimate
- How will the false positive rate change when the actual element exceeds
- What should I do if I can't use Redis 4.0?
- Other applications of bloom filters
- Funnel current limit
- Redis-Cell
- summary
Principles
(Thread IO model, communication protocol, persistence, pipeline, transaction, PubSub, small object compression, master-slave synchronization)
- Thread IO model
- Non-blocking IO
- Event polling (multiplexed)
- Instruction queue
- Response queue
- Timed task
- Endurance
- Snapshot principle
- fork (multi-process)
- AOF principle
- AOF rewrite
- fsync
- Operation and maintenance
- Redis 4.0 hybrid persistence
- Master-slave synchronization
- CAP principle
- Eventually unanimous
- Master-slave synchronization
- Incremental synchronization
- Snapshot synchronization
- Add slave node
- Diskless copy
- Wait instruction
Cluster
(Sentinel 、 Codes 、 Cluster
- Sentinel
- Message lost
- Sentinel basic use
- Codes
- Codis fragmentation principle
- How to synchronize the slot relationship between different Codis instances?
- Expansion
- Automatic equalization
- The price of Codis
- Advantages of Codis
- Operation process of MGET instruction
- Architecture changes
- Codis embarrassment
- Codis background management
- Cluster
- Slot location algorithm
- Jump
- migrate
- Fault tolerance
- Network jitter
- Possible offline (PALPossibll Fail and confirm offline (Fail)
- Basic use of Cluster
- Slot migration awareness
- Cluster change awareness
Expansion
(Stream, Info instruction, talk about distributed locks, expiration strategy, LRU, lazy deletion, use Jedis gracefully, protect Redis, Redis secure communication)
- Talk about distributed locks again
- Redlock algorithm
- Redlock usage scenarios
- LRU
- LRU algorithm
- Approximate LRU algorithm
- Extended reading
- Redis secure communication
- spiped principle
- Getting started with spiped
Source code
(Explore the internal structure of "string", "dictionary", "[compressed list", "quick list", "jump list", "compact list", and "radix tree")
- String
- embstr vs raw
- Expansion strategy
- Explore the internal structure of the "jump list"
- basic structure
- Find process
- Random layer
- Insertion process
- Delete process
- Update process
- What if the score values are all-like?
- How is the element ranking calculated?
- Explore the inside of the "Cardinal Tree"
- application
- structure
- Add and delete nodes
Due to space limitations, we can only show part of the content in this form. I hope everyone will understand
Write at the end
There are many knowledge points involved in Redis. A note alone will definitely not be able to take care of all aspects of Redis, but this Redis growth note will definitely help those who are eager to improve and expand their knowledge! As programmers, we must never stop learning! ! We must lay a good foundation for our future architecture.
One-click triple + comment, then add my VX (tkzl6666) to receive it for free.