Add redis maxmemmory calculation and change the parameter in the redis.conf accordingly #308
Open
Madias2222 wants to merge 17 commits intoitential:devfrom
Open
Add redis maxmemmory calculation and change the parameter in the redis.conf accordingly #308Madias2222 wants to merge 17 commits intoitential:devfrom
Madias2222 wants to merge 17 commits intoitential:devfrom
Conversation
Contributor
Madias2222
commented
Feb 26, 2026
- Add redis maxmemmory calculation
- Add in redis.conf the maxmemmory accordingly with the base memory of the machine
Removed unnecessary 'become: true' directives from various tasks in the configure-mongodb-numa.yml file.
kvelarde-itential
requested changes
Feb 27, 2026
…of the codebase. Also added a new variable for maxmemory in bytes to be used in the redis.conf template.
kvelarde-itential
requested changes
Mar 3, 2026
Comment on lines
+12
to
+28
| - name: Calculate Redis maxmemory automatically | ||
| ansible.builtin.set_fact: | ||
| redis_maxmemory_bytes: >- | ||
| {{ | ||
| ( | ||
| [ | ||
| redis_maxmemory_min_mb | int, | ||
| ( | ||
| (ansible_facts.memtotal_mb | int) | ||
| * (redis_maxmemory_ratio | float) | ||
| ) | int | ||
| ] | max | ||
| ) * 1024 * 1024 | ||
| }} | ||
| when: redis_maxmemory_bytes == "auto" | ||
| tags: configure_redis | ||
|
|
Contributor
There was a problem hiding this comment.
We probably need to document the algorithm, either here or in the defaults file. And in the Redis guide.
Contributor
Author
There was a problem hiding this comment.
I documented in the configure-redis.yml take a look.
Contributor
There was a problem hiding this comment.
I'm thinking we should put this in the redis_guide.md instead. That is a lot for a code comment.
Look how I did it for the replica priority.
…re-redis.yml task.
kvelarde-itential
requested changes
Mar 5, 2026
docs/redis_guide.md
Outdated
| | `redis_tls_enabled` | Boolean | Flag to enable TLS connections. | `false` | | ||
| | `redis_maxmemory_bytes` | Integer | Maximum memory Redis can use (maxmemory). When set to auto, the installer calculates the value from the system RAM using: `maxmemory = max(redis_maxmemory_min_mb, system_ram × redis_maxmemory_ratio)`. If a numeric value is provided, that value (in bytes) is used directly and the automatic calculation is skipped. | `auto` | | ||
| | `redis_maxmemory_ratio` | Float | Define how much memory the system will use. Only work if `redis_maxmemory_bytes` is configured as auto. Default value 0.6 means 60%. | `0.60` | | ||
| | `redis_maxmemory_bytes` | Integer | This parameter defines the minimum amount of memory Redis is allowed to use, even if the automatic calculation would result in a smaller value. It acts as a safety floor for the maxmemory calculation. | `512` | |
Contributor
There was a problem hiding this comment.
I think this should be redis_maxmemory_min_mb
Comment on lines
+12
to
+28
| - name: Calculate Redis maxmemory automatically | ||
| ansible.builtin.set_fact: | ||
| redis_maxmemory_bytes: >- | ||
| {{ | ||
| ( | ||
| [ | ||
| redis_maxmemory_min_mb | int, | ||
| ( | ||
| (ansible_facts.memtotal_mb | int) | ||
| * (redis_maxmemory_ratio | float) | ||
| ) | int | ||
| ] | max | ||
| ) * 1024 * 1024 | ||
| }} | ||
| when: redis_maxmemory_bytes == "auto" | ||
| tags: configure_redis | ||
|
|
Contributor
There was a problem hiding this comment.
I'm thinking we should put this in the redis_guide.md instead. That is a lot for a code comment.
Look how I did it for the replica priority.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.