Redis Memory Test
Like CPU resources, the Redis server has to be sized with adequate memory resources as well to achieve optimal performance. Excessive memory usage can cause significant deterioration in server performance. This is why, it is imperative that administrators track memory usage, detect if actual usage has reached the maximum memory configuration of the server, and configure suitable eviction policies to resolve the memory contention. To achieve this, administrators can use the Redis Memory test.
This test reports the memory usage of the Redis server and the maximum memory that the server is configured to use. Administrators are notified if the actual memory usage reaches the maximum memory configuration, thus prompting them to configure appropriate eviction policies. Additionally, the test sheds light on problem conditions such as memory fragmentation and memory swapping, so that administrators can fine-tune memory allocations based on the memory demands of the server operating system.
Target of the test :A Redis server
Agent deploying the test : An internal agent (recommended)
Outputs of the test : One set of results for the target Redis server
Parameters | Description |
---|---|
Test period |
How often should the test be executed |
Host |
The host for which the test is to be configured. |
Port |
The port at which the specified HOST listens. |
Redis Password and Confirm Password |
In some high security environments, a password may have been set for the Redis server, so as to protect it from unauthorized accesses/abuse. If such a password has been set for the monitored Redis server, then specify that password against REDIS PASSWORD. Then, confirm the password by retyping it against CONFIRM PASSWORD. If the Redis server is not password protected, then do not disturb the default setting of this parameter. To determine whether/not the target Redis server is password-protected, do the following:
|
Measurement | Description | Measurement Unit | Interpretation |
---|---|---|---|
Maximum memory allocated to Redis |
Indicates the value of the maxmemory configuration directive of the server. |
MB |
The maxmemory configuration directive is used in order to configure Redis to use a specified amount of memory for the data set. Setting maxmemory to zero results into no memory limits. This is the default behavior for 64 bit systems, while 32 bit systems use an implicit memory limit of 3GB. |
Used memory |
Indicates the amount of memory used by the server. |
MB |
If the value of this measure is equal to the value of the Maximum memory allocated to Redis measure, it indicates that the server has exhausted its memory limit. The exact behavior Redis follows when the maxmemory limit is reached is configured using the maxmemory-policy configuration directive. The following policies are available:
The policies volatile-lru, volatile-random and volatile-ttl behave like noeviction if there are no keys to evict matching the prerequisites. Picking the right eviction policy is important depending on the access pattern of your application, however you can reconfigure the policy at runtime while the application is running, and monitor the number of cache misses and hits using the Redis INFO output in order to tune your setup. In general as a rule of thumb:
The volatile-lru and volatile-random policies are mainly useful when you want to use a single instance for both caching and to have a set of persistent keys. However it is usually a better idea to run two Redis instances to solve such a problem. It is also worth noting that setting an expire to a key costs memory, so using a policy like allkeys-lru is more memory efficient since there is no need to set an expire for the key to be evicted under memory pressure. |
Memory used by lua engine |
Indicates the amount of memory used by the lua engine. |
MB |
|
Peak memory consumed by Redis |
Indicates the high watermark of memory consumption by the Redis server. |
MB |
|
Memory allocated for redis as seen by operating system |
Indicates the amount of memory that Redis allocated as seen by the operating system. |
MB |
|
Memory fragmentation ratio |
Indicates the the ratio of memory used by the operating system compared to the amount of memory allocated by Redis. |
Percent |
A fragmentation ratio less than 1.0 means that Redis requires more memory than is available on the system and so it has resorted to using swap memory resources. A fragmentation ratio greater than 1.0 indicates that fragmentation is taking place and the Redis instance is consuming more physical memory than has been requested. A healthy Redis server Memory fragmentation ratio is slightly more than 1.0. A ratio greater than 1.5 indicates that excessive fragmentation is taking place. In such instances, you should restart Redis server to allow the operating system to recover the memory that has become unusable due to fragmentation. |
Total system memory |
Indicates the total amount of memory the Redis host has. |
MB |
|