Home  >  Article  >  Database  >  How much data can redis cache at most?

How much data can redis cache at most?

anonymity
anonymityOriginal
2019-06-04 17:25:066107browse

Redis occupies an increasingly important position in distributed applications. With just tens of thousands of lines of code, a high-performance data storage service is implemented.

How much data can redis cache at most?

Check the redis source code and find that redis will time out under certain circumstances, as follows:

1. Network. Redis processing is closely related to the network. If the network is interrupted, redis timeout is likely to occur. If this situation occurs, you should first check the network bandwidth information of the redis machine to determine whether there is an interruption.

2. Memory. All redis data is stored in memory. When the physical memory is not enough, Linux OS will use swap memory, causing memory swapping. At this time, if there is a redis call command, a redis timeout will occur. Here you can adjust the /proc/sys/vm/swappiness parameter to set the amount of physical memory used before swapping.

Maximum cache setting

Example: maxmemory 100mb

Unit: mb, gb.

The default is 0, and the maximum cache is not specified. If new data is added and exceeds the maximum memory, redis will crash, so it needs to be set.

After setting maxmemory, the cache data recycling policy must be set accordingly.

The above is the detailed content of How much data can redis cache at most?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn