Skip to content

fbacchella/cachingbe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The caching backend

JRDS provides a new RRD4J backend, the RrdCachedFileBackend. It provides an heavy caching backend, whose purpose is similar to rrdcached, by reducing dramaticaly the amout of IO, at the cost of slightly increased risk of loosing intermediate data. Anyway the caching backend assert that the state on disk is coherent, with all waiting data committed to disk or none of them.

To avoid double buffering of data within JRDS and the filesystem cache, it uses directio when available (at lease Linux and Solaris). Implementing directio in the java world was done through some jni call that file a FileDescriptor object with a handle to a directio opened file. The details of the implementation can be found here and here for peoples interested in doing directio in Java.

It need at least RRD4J version 2.1 to work.

A kit with the needed jar and a few natives library can be downloaded .

Its usage is rather simple, it can be registered within RRD44 with the following code RrdBackendFactory.registerFactory(new RrdCachedFileBackendFactory());

The RrdCachedFileBackendFactory class instanciation will look in the same directory that the class' jar to find the native library. If this fails, the RrdCachedFileBackendFactory.loadDirect(File) help is provided to specify the directory where the native library is stored.

To use it, two parameters needs to be given :

  • pageCache : the number of 4 ko pages to be used by the cache.
  • syncPeriod : the commit interval in seconds.
Example code use :

RrdCachedFileBackendFactory factory = (RrdCachedFileBackendFactory) RrdBackendFactory.getFactory("CACHEDFILE");
factory.setPageCache(10);
factory.setSyncPeriod(30);
...
factory.sync();

About

A caching backend for rrd4j, with directio support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published