Azure managed redis cache error out of memory but pleanty avalible

Cameron Fullilove 0 Reputation points
2025-02-23T16:00:11.8333333+00:00

Hi I am using Azure managed redis cache and keep getting this error OOM command not allowed when used memory > 'maxmemory I have a 500 MB cache and currently only use around 70mb. When I try and insert and data I get an error indicating out of memory. After some time the error disappears. I definitely have memory free both Redis directly and Azure report only 70mb used. Any ideas I would assume this may be because the feature is still in preview. But wanted to raise if it was not known

# Memory used_memory:67584256 used_memory_human:64.45M used_memory_rss:67584256 used_memory_peak:138835496 used_memory_peak_human:132.40M used_memory_lua:63488 maxmemory_policy:noeviction mem_fragmentation_ratio:1 mem_allocator:jemalloc-5.3.0

Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
273 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vijayalaxmi Kattimani 1,485 Reputation points Microsoft Vendor
    2025-02-24T01:48:19.5433333+00:00

    Hi Cameron Fullilove,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    As we understand that, you are encountering an issue with your Azure managed Redis cache where the "OOM command not allowed when used memory > 'maxmemory'" error is being triggered despite having sufficient free memory.

    We would like to inform you that, the error message "OOM command not allowed when used memory > 'maxmemory'" indicates that Redis has reached its configured memory limit, and it cannot accept any more data until some memory is freed up. However, based on your description, it seems that you are not actually using the full capacity of your Azure Redis Cache instance.

    Please find below the troubleshooting steps to help resolve your issue.

    • Memory Fragmentation: The mem_fragmentation_ratio indicates how fragmented your memory is. A value significantly greater than 1 can suggest that memory is not being utilized efficiently. If the fragmentation is high, it might lead to situations where Redis thinks it is out of memory even though there is free memory available.
    • Eviction Policy: Your current maxmemory_policy is set to noeviction, This means that Redis will not evict any keys when it reaches the memory limit, which can lead to the OOM error. You might want to consider changing this policy to one that allows eviction, such as allkeys-lru or volatile-lru, depending on your use case.
    • Memory Allocation: The mem_allocator is set to jemalloc-5.3.0, which is generally efficient, but you might want to experiment with different allocators if the issue persists. Sometimes, temporary memory usage can spike due to operations like large transactions. If you are running such operations, they might temporarily increase memory usage, leading to the OOM error.
    • Monitoring and Logs: Check the Azure portal for any logs or metrics that might indicate issues with your Redis instance. Azure provides monitoring tools that can help you identify memory usage patterns and potential issues.
    • Azure Redis Cache Limits: Since you are using Azure Redis Cache, ensure that you are aware of any limitations or quotas that might be imposed by the Azure service.

    Note: In the preview feature, there may be certain bugs or limitations that do not exist in the stable version.

    If the issue still persists, please consider restarting your Azure Redis Cache instance. as this may help resolve transient issues.

    Please find the below mentioned links for more information.

    https://stackoverflow.com/questions/18430324/how-to-debug-the-error-oom-command-not-allowed-when-used-memory-maxmemory

    https://docs.hypernode.com/hypernode-platform/tools/how-to-solve-redis-error-oom-command-not-allowed-when-used-memory-maxmemory.html

    https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-best-practices-memory-management

    I hope, This response will address your query and helped you to overcome on your challenges.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.