Skip to content

The Heroku Redis Maxmemory Policy

Heroku offers a great Redis addon, which provides 25MB of memory for free.

This amount of storage can be easily filled with just a few thousands items, depending on what you’re storing.

Heroku has a configuration option called maxmemory-policy that determines how the system will behave when the Redis database memory is filled.

By default this property is set to noeviction, which means Redis will raise an error when trying to store more data.

This is done so you realize what is happening, and once you find out that you can change this behavior, it’s time to determine how.

The various behaviors are provided by Redis itself, and they are:

It’s up to you to find the best case for your needs. Once you do have a candidate, you can apply the change using the Heroku CLI, for example:

heroku redis:maxmemory YOUR_REDIS_INSTANCE_NAME --policy volatile-lru

I wrote 17 books to help you become a better developer, download them all at $0 cost by joining my newsletter

JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025

Bootcamp 2025

Join the waiting list