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.
What:
Add support for volatile keys. Add timeout in seconds for keys to expire.
Depends on greenbone/gvm-libs#460.
Why:
Can be used in combination with redis settings such as
maxmemory
andmaxmemory-policy
to have a more options in handling memory issues in regards to redis.How:
Stop ospd-openvas if running.
Do a flushall in redis.
sudo redis-cli -s /run/redis-openvas/redis.sock FLUSHALL
)Start nasl script which places keys with expire in redis.
sudo openvas-nasl -X -i <installpath>/var/lib/openvas/plugins/ -t 127.0.0.1 add_volatile_keys.nasl
Check number of keys in db.
sudo redis-cli -s /run/redis-openvas/redis.sock -n 1 DBSIZE
. Should be 100.Set maxmemory
config set maxmemory 15728640
in redis.Set maxmemory-policy
Config set maxmemory-policy volatile-lru
in redis.Start VT2 which places keys without expire set in other terminal.
sudo openvas-nasl -X -i <installpath>/var/lib/openvas/plugins/ -t 127.0.0.1 persistent_keys.nasl
.When maxmemory is hit the keys with expire set will get removed by redis to make space for new keys. Check number of keys in db 1 and 2. db 2 should have 100 keys while db 1 should have less.
This way we can make sure which keys can be removed when memory limits are reached.
Checklist: