Improving Zentyal performance: Redis

12 Dec 2010

Now that we have some time after our 2.0 release I want to start a series of post about how to improve Zentyal performance (what we’ve done, what we will do, and what you can do). In this first post I’m going to talk about one of the new Zentyal features. Redis as config backend.


Redis is a persistent key-value database written with performance in mind, it stores the whole database in memory and syncs to disk asynchronously.

Previous backend: GConf

Before Redis, Zentyal stored configuration in GConf, the engine that Gnome Desktop uses to store user preferences. Besides few minor problems, our main issue with GConf was it is intended for desktop applications and does not provide much performance. We searched for alternatives that would be fast, lightweight and easy to use (protocol, api...) and finally chose Redis as it had all this and more!

Integration with Zentyal

Migrating from GConf to Redis was not a trivial task, GConf keys are organized into a hierarchy while Redis is a flat key-value store. Javier Uruen did most of the work as a Zentyal contributor, he rewrote our backend to be compatible with old code! For those interested in the internals you can see, for example:

sub all_entries
    my ($self, $key) = @_;
    my $length = length $key;
    my @dirs;
    for my $path ($self->_redis_call('keys', "$key/*")) {
        push (@dirs, $path) if (index($path, '/', $length + 1) == -1);
    return @dirs;

Future work

There are some features that can take advantage of Redis and will use in some moment: make a better use of its rich instruction set or benefit from its replication features, stay tuned for future updates!

If you also want to contribute you can do it! You can translate, test, help people using Zentyal… Visit our contribute page for more info!