Redis Configuration Controls - New at Compose

At Compose, we're all about giving you control of your databases where we can and Redis users on Compose are about to get a whole lot more control. It's a story about iterating design. The team at Compose who work on Redis looked at their recently introduced Slow Query Logs feature and decided they could make it better. In the process they created the new Redis Configuration Controls.

The Redis Configuration Controls allows experienced users to change a selection of Redis settings so they can tune their deployments to behave exactly as they want them. These aren't for new users to modify without thoroughly researching the consequences and taking care in the process; please consult the linked documentation for each setting before changing it.

The design of our user interface follows the actual redis.conf configuration file, turning it into an interactive form. This means it'll be easier to take application recommended configurations and apply them to your own Redis deployment. Under the hood, we handle these new settings by automatically applying them to both nodes of your high availability deployment. There's no need to wait for synchronisation at the Redis level to ensure they are applied and saved.

Over the coming months, we plan on refining the experience of Configuration Controls.

Using the Configuration Controls

We'll briefly introduce each setting in this article, but for full details of them, you'll find links to the Redis documentation for many of them by clicking on the blue circled question mark next to its name. As we mentioned, the sections and fields of the interface are modelled on the redis.conf configuration file and that means, where there isn't a link to the documentation, you can find more information there.

Now, onwards to the Configuration Controls themselves. You'll find the them in the Compose console for Redis under the Settings tab. At the top of the Settings view, as before, are the version and upgrade controls, then the "Redis as a Cache" control and then, below that are the new Configuration Controls. They open with the warning we've just given, that these are expert Redis settings with a link to the example Redis configuration file. Then we're into the various settings groups and settings.

Any changes made in these settings will only be applied when the Apply Configuration Changes button at the bottom is pressed. This will put any changes you have made to the configuration into practice on each of the servers.

Network

top timeout and keepalive

The first group of settings concern the Network. This contains timeout and tcp-keepalive.

timeout

When it's set to 0, the timeout setting's default, idle client connections stay open until they are closed by the client. You may want to ensure idle clients are ejected after some number of seconds and setting this to a non-zero value will set that number of seconds.

tcp-keepalive

While some parts of the network will also step in to disconnect idle connections, use of a keepalive will send TCP ACKs at regular intervals to keep the connection open. That interval can be set here. Setting it to 0, which is the default, disables this feature.

Security

This section is slightly different because its requirepass setting is set outside the Configuration Controls.

requirepass

The Redis authentication credential is a simple password and this is where it can be set. Clicking on Change will send you to the Overview page where that credential can safely be changed. Be aware that any other settings you may have made in the Configuration Controls will be discarded when you click Change.

Limits

maxmemory-policy

This setting replaces the old "Change Maxmemory Policy" control by letting you directly set the policy. The Redis documentation on eviction policies covers what the available settings - no eviction, LRU, volatile LRU, random, volatile random and volatile TTL - do. If you continue on reading that page you'll see there's a setting you can use to fine tune some of those policies which is...

maxmemory-samples

This setting lets the user control how the sampling-LRU mechanism works in Redis by setting the number of samples used. It defaults to 5.

Lua Scripting

Lua settings

lua-time-limit

There's only one setting in Lua Scripting and it sets the lua-time-limit. That's the number of milliseconds that a Lua script can run before being kicked into touch by Redis for taking too long. It's a safety feature to stop the system being hogged by badly written loopy scripts. Important fact: This doesn't kill the script, it logs it and tells other clients the system is busy while waiting to be told to kill the script. The default is five seconds which is enormous when you consider a script is supposed to run in a millisecond.

Slow Logs

The Slow Query Log feature is where we began. It uses two configuration settings, slowlog-log-slower-than and slowlog-max-len. A brief reminder – read more in our slow log introduction.

slowlog-max-len

The slow log is actually a queue of slow log events and you can control the size of that queue with slowlog-max-len. The bigger you make it, the more memory you will consume. Ideally, it should be big enough for you to catch your problematic slow commands, but not so big that it becomes an issue itself. The default is 128 and we recommend you run with that till you are certain you need to expand it.

slowlog-log-slower-than

The other way to capture that tricky slow event would be to filter out all the slow, but not that slow, log events . That's where slowlog-log-slower-than comes in. It sets the threshold on what qualifies as a slow event. It defaults to 10000 microseconds.

The slow query log viewer has moved to the main tab bar of the console as part of the switch to the Configuration Control to make it more accessible and it retains it's own Settings dialog so you can quickly and safely adjust just the two values that matter.

Event Notification

Event Notification

notify-keyspace-events

Another setting that was previously available is the Event Notification's notify-keyspace-events. This setting gives you the ability to plug into the changes going inside the database. The feature is called "Keyspace Notifications" and you can read about it in the Redis documentation. The short version of that is you set a configuration variable, notify-keyspace-events, to a string which represents what events you want to hear about. Setting it to the string "KEA" says you want a stream of all events. You can listen to that stream by connecting to Redis and issuing a psubscribe command looking for messages with a key pattern of __key*__:*.

Wrapping up

That's it for the current settings available in the Redis Configuration Controls. Keep an eye on Compose Notes for updates on new settings being made available.