As standard, Revive Adserver logs aggregated delivery data such as requests, impressions, clicks and conversions in so-called bucket tables inside the database. While this works very well, it does mean that the speed and scale of ad delivery can be restricted by how many write queries the database server is able to handle in a short span of time.
We have developed a plugin called “Redis Logging” or RediX, which is able to log all of these delivery data points in the Redis memory based storage. Because of the incredible speed of Redis, ad delivery will improve much in terms of speed, scale and reliability.
You have probably been directed here after purchasing a license of the RediX plugin. This page explains how to install and configure it, to fully benefit from this plugin.
Redis Caching plugin
First of all, the RediX plugin requires the free Redis Caching plugin. In fact, anyone should be able to benefit from caching using Redis to begin with. Begin by installing Redis Caching using the instructions provided. As part of this, you will also be installing and configuring Redis itself.
AdserverPlugins.com Loader plugin
In order to run Redis Logging, you’ll also need to install and configure the AdserverPlugins.com Loader plugin and the associated SourceGuardian PHP extension. There are instructions to install apLoader as well.
In order to use Redis logging, it is not required to also use Redis Caching, it just needs to be installed, not even enabled. However, we do recommend using Redis Caching nevertheless, as it will add even more speed to your ad server. See the Redis Caching documentation to find out how to enable Redis Caching.
Install Redis Logging plugin
You will have received the Redis Logging plugin (file name apDeliveryLogRedis.zip) after you’ve purchased your license. Store it on your local disk, and do not decompress it.
Next, follow the instructions to Install a plugin in Revive Adserver to install the Redis Logging plugin.
Configure Redis Logging plugin
By default, both plugins (Redis Caching and Redis Logging) use localhost to connect to Redis using separate databases (logging db 0, cache db 1), but the parameters can be changed in the plugin settings screens.
Immediately after being installed, the Redis logging plugin will work in parallel with the regular database logging.
Once you’ve checked that statistics get into Redis correctly, and you’re happy with it, you can check the “Disable database logging” plugin setting, and no statistics will be saved to MySQL during delivery anymore.
A new maintenance script has to be run in order to move the statistics back into the database before the main maintenance script is executed. However, since the script is encoded with SourceGuardian and is locked to specific domains, it cannot be run with php-cli. Below is an example to run it with curl on localhost but specifying the proper hostname, so that:
curl -s -H "Host: your.domain.com" http://127.0.0.1/plugins/apDeliveryLogRedis/scripts/maintenance.php
This has to be setup as a cron job on each individual delivery server, ideally at minute 0 of every hour, as it only processes statistics from the previous hour or before.
Depending on the configuration of the delivery servers, a specific virtual host might be required to run the script, both because the plugins folder isn’t normally accessible for security reasons (by means of a built in .htaccess file), and also because your delivery virtual host might point directly to the www/delivery directory. One thing that might be helpful to know is that SourceGuardian also whitelists the subdomains: e.g. if your licence is linked to example.com, you could set up such a virtual host to be redis-maint.example.com.
After this special maintenance step has completed, the delivery data that was initially logged in Redis will have been written into the traditional bucket tables (to be recognized by data_bkt in their table names). Now you can trigger the normal maintenance to summarize and further process the bucket data so that they become available as statistics.