I've set up redis for the matrix cache on our test server and it's working fine. On the production server I need to lock it down and tweak it for performance as best as possible. Does anyone have a Matrix optimized redis.conf file that I could use as a guide. There are quite a few options in the default redis.conf file and I'm not sure which settings are best for Squiz Matrix. In particular the memory settings; size limit and policy? Extract from the default config file on memory settings....
************************************************************************************************************************
# Don't use more memory than the specified amount of bytes. # When the memory limit is reached Redis will try to remove keys # accordingly to the eviction policy selected (see maxmemmory-policy). # # If Redis can't remove keys according to the policy, or if the policy is # set to 'noeviction', Redis will start to reply with errors to commands # that would use more memory, like SET, LPUSH, and so on, and will continue # to reply to read-only commands like GET. # # This option is usually useful when using Redis as an LRU cache, or to set # an hard memory limit for an instance (using the 'noeviction' policy). # # WARNING: If you have slaves attached to an instance with maxmemory on, # the size of the output buffers needed to feed the slaves are subtracted # from the used memory count, so that network problems / resyncs will # not trigger a loop where keys are evicted, and in turn the output # buffer of slaves is full with DELs of keys evicted triggering the deletion # of more keys, and so forth until the database is completely emptied. # # In short... if you have slaves attached it is suggested that you set a lower # limit for maxmemory so that there is some free RAM on the system for slave # output buffers (but this is not needed if the policy is 'noeviction'). # # maxmemory <bytes>MAXMEMORY POLICY: how Redis will select what to remove when maxmemory
is reached. You can select among five behaviors:
volatile-lru -> remove the key with an expire set using an LRU algorithm
allkeys-lru -> remove any key accordingly to the LRU algorithm
volatile-random -> remove a random key with an expire set
allkeys-random -> remove a random key, any key
volatile-ttl -> remove the key with the nearest expire time (minor TTL)
noeviction -> don’t expire at all, just return an error on write operations
Note: with any of the above policies, Redis will return an error on write
operations, when there are not suitable keys for eviction.
At the date of writing this commands are: set setnx setex append
incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd
sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby
zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby
getset mset msetnx exec sort
The default is:
maxmemory-policy volatile-lru
LRU and minimal TTL algorithms are not precise algorithms but approximated
algorithms (in order to save memory), so you can select as well the sample
size to check. For instance for default Redis will check three keys and
pick the one that was used less recently, you can change the sample size
using the following configuration directive.
maxmemory-samples 3
*********************************************************************************************************************
Any suggestions appreciated.