"This product is good, let's take a look." Every platform has some hot-selling products, which are called hot products for short. One characteristic of these products is that they have a particularly large number of visits. In our profession, we can call it hot data. When processing these hot commodities, the system needs to do some special processing.
Redis hot data refers to data that has a particularly large number of visits in the redis database. (Recommended learning: Redis video tutorial)
For these types of data on hot products, we must consider that the number of visits is relatively large. The first thing everyone thinks of is cache, and use redis cache. There is certainly nothing wrong with that.
This solution has the advantages of nearby access, fast speed, and no bandwidth limit, but it also has the following problems:
Waste of memory resources
Dirty read problem
Use local cache solution
There are the following problems when using local cache:
Need to know in advance that the hotspot cache capacity is limited, inconsistency, time growth, hotspot Key missing
Traditional hotspot solutions have various problems, so how to solve the hotspot problem?
Hotspot Data Solution
This solution solves the problem of hotspot Key by actively discovering hotspots and storing them.
First, the Client will also access the SLB and distribute various requests to the Proxy through the SLB. The Proxy will forward the requests to the backend Redis in a routing-based manner.
The hot key solution is to add cache on the server side.
Specifically, a local cache is added to the Proxy. The local cache uses the LRU algorithm to cache hotspot data, and the backend db node adds a hotspot data calculation module to return the hotspot data.
The Proxy architecture mainly has the following advantages: Proxy local cache hotspots, the reading ability can be horizontally expanded DB nodes regularly calculate hotspot data collection DB feedback Proxy hotspot data is completely transparent to the client, no need to do any compatibility
For more Redis-related technical articles, please visit the Introduction Tutorial on Using Redis Database column to learn!
The above is the detailed content of What does redis hotspot data refer to?. For more information, please follow other related articles on the PHP Chinese website!