Uberspace / lab

The Uberlab provides various tutorials - written by you! - on how to run software and tools on Uberspace 7.
https://lab.uberspace.de
Other
315 stars 414 forks source link

[redis] Warnings on startup #1566

Open tlahn opened 1 year ago

tlahn commented 1 year ago

When following current redis guide, there are three warnings in logs after startup. Two of which can be avoided by setting respective configuration values. The third one is a bit more tricky.

maxclients

# You requested maxclients of 10000 requiring at least 10032 max file descriptors.
# Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
# Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.

This can be mitigated by setting the respective value in ~/.redis/conf: maxclients 4064 (4096 - 32 redis internal descriptors)

redis then only shows an info log Increased maximum number of open files to 4096 (it was originally set to 1024). Depending on the usage scenario it might be sufficient to set maxclients 992 which causes no message to be shown at all.

tcp-backlog

# WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

This can be mitigated by setting the respective value in ~/.redis/conf: tcp-backlog 128

memory overcommit

# WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

The linked issue at jemalloc does not provide a solution on how one could fix this from a user perspective, as I neither have the possibility to change the system's /etc/sysctl.conf nor redis. It might at least be worth mentioning this as a known issue in the redis guide.

Conclusion

Not an issue, but as sidenote: The guide mentions in footer that it was Tested with Redis 5.0.3. Currently installed version is redis 7.0.12 and it still works.

I would be very happy to provide a pull request including the settings for maxclients, tcp-backlog (including maybe some comments) and redis version. But I am not sure on how to best tackle the memory overcommit issue.

brutus commented 1 year ago

@tlahn thank you for this well prepared issue :heart:

We have to discuss the memory overcommit issue and get back to you.