This paper gives a general analysis of the application scenarios and characteristics of Redis, and makes a detailed analysis of the usage scenarios of the common data types of the APSARADB and the aspects of memory optimization and performance optimization. Redis Common data
Jump Table (skiplist) to ensure data storage and order, HashMap in the member to score mapping, and the jumping table is stored in all the members, Sorting is based on the score of HashMap, using the structure of the jumping table can obtain a relatively high efficiency, and the implementation is relatively simple.Common memory optimization methods and parameters? With some of our implementations above, we
Redis memory usage optimization and storageRedis crashes are really a headache.Redis memory optimization under LinuxRedis Memory storage Structure analysisRedis Common data typesThe most commonly used data types of
Timeline of Twitter, which can be stored as score in the publication time, which is automatically sorted by time.Implementation method:Redis sorted set internal use HASHMAP and jump Table (skiplist) to ensure the storage and ordering of data, HashMap in the member to score mapping, and the jumping table is all the members, sorted by HashMap in the score , the use of the structure of the jumping table can obtain a relatively high efficiency of finding, and it is relatively simple to implement.Co
Redis memory optimization, persistence, and master-slave ReplicationConfigure the memory optimization parameters of the apsaradb for Redis database, advantages and disadvantages of each persistence mode and the principle and confi
the configuration of Redis database memory optimization parameters, the pros and cons of each persistence method, and the principle and configuration of master-slave replicationfirst, commonly used memory optimization methods and parametersThe performance of
the public Timeline of Twitter, which can be stored as score in the publication time, which is automatically sorted by time.Implementation method:Redis sorted set internal use HashMap and jump Table (skiplist) to ensure the storage and ordering of data, HashMap in the member to score mapping, and the jumping table is all the members, sorted by HashMap in the score , the use of the structure of the jumping table can obtain a relatively high efficiency of finding, and it is relatively simple to i
feature, except that set is automatically weight-saving, and set is a good choice when you need to store a list of data and you don't want duplicate data. and set provides an important interface to determine whether a member is within a set set, which is not available in list.Implementation method:The internal implementation of set is a value that is always null hashmap, which is actually calculated by hashing the way to fast weight, which is also set to provide a judge whether a member is with
A recent system that uses Redis heavily, we store a large amount of user information in Redis, and the memory application is hundreds of G, and the volume is quite large. So we're constantly thinking about ways to optimize the use of redis memory and to share our
Theoretically, Redis can store 2 of the 32-time key, each instance at least 250 million keys, but because the Redis is a memory based database so it means that it is not possible to store a lot of data, it should be said that Redis storage limit is the system's available memory
First, special code:
Since Redis 2.2, many data types can be optimized for storage in a special coding way. The Hash, list, and integer sets can optimize the storage structure to take up less space and, in some cases, save 9/10 of the space.These special encodings are completely transparent to the use of Redis, in fact, it is only a transaction between CPU and memory
I. Special encoding:
Since redis 2.2, many data types can be optimized by special encoding. Here, the storage structure can be optimized by hash, list, and sets composed of Integers to consume less space. In some cases, you can save 9/10 of the space.These special codes are completely transparent for redis usage. In fact, they are only a transaction between CPU and mem
1. Redis storage mechanism
Redis storage mechanisms are divided into two types: Snapshot and AOF. Regardless of the Mechanism, Redis stores data in the memory.
How Snapshot works: It stores data in the memory first, and then triggers a DUMP operation when the data reaches a
Redis requires much memory reserved memory for security issues, redis memory usage
I have tried to limit the memory usage of apsaradb for redis by setting it. The result shows that it
Redis memory fragments and Redis memory fragments
Redis uses jemalloc to allocate memory by default. According to the best article in fast '14, when a variable-length key-value load occurs, the fragmentation problem may occur: low
allocation of all physical memory, regardless of the current memory status)
I. Running services
# Enable redis-server/etc/redis. conf
# Disable redis-cli Shutdown
Ii. Test
1) You can use the redis-benchmark command to test the
restarting the loss of part of the data between snapshot and statement append mode.
Do not let your redis machine use more than 3/5 of the physical memory of the actual memory.
The MaxMemory option in Redis.conf, which tells Redis how much physical memory is used t
Redis data import tool optimization process summary, redis Data ImportBackground of optimization of Redis data import tool
Developed a Redis data import tool using C ++Import all table data from oracle to
Memory Cache for Android memory optimization and android Memory OptimizationPreface:The above two blogs have talked about the basic knowledge of images and image loading methods and optimization. All these optimizations are designed to avoid the OOM problem in applications.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.