Title: maxmemory
Last modified: March 31, 2024

---

# maxmemory

 *  Resolved [futureyoon](https://wordpress.org/support/users/futureyoon/)
 * (@futureyoon)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/maxmemory/)
 * Hi
 * I would like to check how to set the maxmemory for redis?
 * I know where and how to update the value
 * sudo systemctl restart redis-server and then maxmemory
 * My question is more like how to calculate the most optimal maxmemory for my site.
 * I can simply set maxmemory 2gb as I wish?
 * My memory for the virtual machine is 8gb.
 * Is there any rough formula (or common practice) to set the maxmemory?
 * I often exp my site freezed due to the redis crashed. It appears to be due to
   insufficient memory.
 * Can you please recommend any?
 * Thank you

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/maxmemory/#post-17541356)
 * [@futureyoon](https://wordpress.org/support/users/futureyoon/): That depends 
   on how large your WordPress dataset is. Ideally set `maxmemory` to unlimited,
   and set a `maxmemory-policy` so keys get evicted and you don’t run out of memory.
 *  Thread Starter [futureyoon](https://wordpress.org/support/users/futureyoon/)
 * (@futureyoon)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/maxmemory/#post-17541434)
 * [@tillkruess](https://wordpress.org/support/users/tillkruess/) thx for the input.
   i have further questions as below.
    1. how to set maxmemory unlimited?
    2. plus, i have 2gb database, what is rough recommendation of the maxmemory for
       my case?
    3. i have set the maxmemory-policy as allkeys-lru and changed from allkeys-lfu (
       becaose site was still freezed)
 * please share some insights here.
 * Thank you
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/maxmemory/#post-17542846)
 * [@futureyoon](https://wordpress.org/support/users/futureyoon/) If you comment-
   out the `maxmemory` in your `redis.conf` it will not have a limit.
 * If you have a 2GB database, you’ll probably need around 2GB for Redis Server 
   as well, but keep an eye on it to see what it actually does.
 *  Thread Starter [futureyoon](https://wordpress.org/support/users/futureyoon/)
 * (@futureyoon)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/maxmemory/#post-17544025)
 * OK. I have updated it to 2gb and will monitor.
 * Is there a way for me to observe (any data, maybe from ‘redis-cli info memory’
   or ‘top’) how it performs?
 * I mean instead of wating for the system to hang and then see that debug.log, 
   is there any way to check like ‘oh..it’s hitting very near the breakpoint…so 
   i have to increase bit more’ something like that?
 * Thank you
    -  This reply was modified 2 years, 2 months ago by [futureyoon](https://wordpress.org/support/users/futureyoon/).
    -  This reply was modified 2 years, 2 months ago by [futureyoon](https://wordpress.org/support/users/futureyoon/).
    -  This reply was modified 2 years, 2 months ago by [futureyoon](https://wordpress.org/support/users/futureyoon/).
 *  Plugin Author [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * (@tillkruess)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/maxmemory/#post-17546013)
 * Most server monitoring tools will provide you with Redis memory statistics, but
   I can’t recommend a specific one.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘maxmemory’ is closed to new replies.

 * ![](https://ps.w.org/redis-cache/assets/icon-256x256.gif?rev=2568513)
 * [Redis Object Cache](https://wordpress.org/plugins/redis-cache/)
 * [Support Threads](https://wordpress.org/support/plugin/redis-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/redis-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redis-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redis-cache/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Till Krüss](https://wordpress.org/support/users/tillkruess/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/maxmemory/#post-17546013)
 * Status: resolved