Clarification of proper redis config settings

Summary

Working with new installation of kolibri-server and would like advice on proper redis config settings

Technical details

image

Systemctl status kolibri

I understand the suggestion to add “maxmemory-policy allkeys-lru” and leads me to believe redis in the kolibri-server is used for cache only(?). I have no experience with redis.

From redis docs; “If you plan to use Redis just as a cache where every key will have an expire set you may consider using the following configuration instead (assuming a max memory limit of 2 megabytes as an example):”
maxmemory 2mb
maxmemory-policy allkeys-lru

My question is about the maxmemory setting. The VM for this kolibri-server has 16GB of memory. What is suggested amount of maxmemory for kolibri-server?

Kind regards,
David

Hi David,

I’m personally not an expert on Redis config either, but there was a recent thread on the forum discussing it and showing an example of all the other settings.

I’ll try to find someone on the team who can give you more specific advice on how to tune the max memory settings on your 16 GB VM.

@mrdavidhaag Could you try these settings in Kolibri’s .kolibri/options.ini file in the [Cache] section?

It sets the max memory to about 512 MB which should be adequate for your VM. The console will log another warning if that setting isn’t enough, though.

[Cache]
CACHE_REDIS_MAXMEMORY=536870912
CACHE_REDIS_MAXMEMORY_POLICY=allkeys-lru
CACHE_BACKEND=redis

Hello @jonathan
Thank you for the quick response and good directions. I have followed your instructions and used these settings in .kolibri/options.ini [Cache] section

[Cache]
CACHE_BACKEND = redis
CACHE_REDIS_MAXMEMORY = 536870912
CACHE_REDIS_MAXMEMORY_POLICY = allkeys-lru

I followed the syntax of space before and after equals sign to match the syntax in examples inside of options.ini file

Systemctl status kolibri now shows no more warnings about redis

● kolibri.service - LSB: kolibri daemon, an offline education platform
Loaded: loaded (/etc/init.d/kolibri; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-09-24 18:24:13 UTC; 37s ago
Process: 894 ExecStart=/etc/init.d/kolibri start (code=exited, status=0/SUCCESS)
Tasks: 9 (limit: 19113)
Memory: 173.6M
CGroup: /system.slice/kolibri.service
└─971 /usr/bin/python3 /bin/kolibri start

Sep 24 18:24:13 kol-serv kolibri[941]: /usr/lib/python3/dist-packages/kolibri/dist/rest_framework/utils/serializer_helpers.py:107: SyntaxWarning: “is” with a literal. Did you mean “==”?
Sep 24 18:24:13 kol-serv kolibri[941]: if value is None or value is ‘’:
Sep 24 18:24:13 kol-serv kolibri[941]: INFO Running Kolibri with the following settings: kolibri.deployment.default.settings.base
Sep 24 18:24:13 kol-serv kolibri[941]: INFO Configuring Redis: maxmemory-policy allkeys-lru
Sep 24 18:24:13 kol-serv kolibri[941]: INFO Configuring Redis: maxmemory 536870912
Sep 24 18:24:13 kol-serv kolibri[941]: INFO Running Kolibri as background process
Sep 24 18:24:13 kol-serv kolibri[941]: INFO Starting Kolibri background workers
Sep 24 18:24:13 kol-serv kolibri[941]: INFO Going to background mode, logging to /home/kolibri/.kolibri/logs/kolibri.txt
Sep 24 18:24:13 kol-serv runuser[928]: pam_unix(runuser:session): session closed for user kolibri
Sep 24 18:24:13 kol-serv systemd[1]: Started LSB: kolibri daemon, an offline education platform.

Thank you for your help and direction.

1 Like