Fabrice Bacchella edited this page Apr 6, 2015 · 2 revisions
RRD4J is a high performance data logging and graphing system for time series data, implementing RRDTool's functionality in Java. It follows much of the same logic and uses the same data sources, archive types and definitions as RRDTool does. Open Source under Apache 2.0 License.

RRD4J supports all standard operations on Round Robin Database (RRD) files: CREATE, UPDATE, FETCH, LAST, DUMP, EXPORT and GRAPH. RRD4J's API is made for those who are familiar with RRDTool's concepts and logic, but prefer to work with pure Java (no native functions or libraries, no Runtime.exec(), RRDTool does not have to be present).

Latest Version (requires Java 6+)

RRD4J 2.2 (released 2013-04-11) - Download - Changelog - Javadoc


RRD4J can be build using gradle, maven or ant, but maven is the main build tool, the one that is used to generate continuous integration build.

The Git repository can also be accessed at https://github.com/fbacchella/RRD4J. But for now, the reference site will stay on google, GitHub will be used for pull request.

The maven generated site is http://rrd4j.org/site.

Automated build are uploaded at sonatype's repository.

RRD4J is missing unit test, so please don't hesitate to look at the jacoco report for missing code coverage and submit new one.

<wiki:gadget url="http://www.ohloh.net/p/13231/widgets/project_partner_badge.xml" height="53" border="0"/>


  • Portable files, RRDTool files are not
  • Simple API
  • RRD4J supports the same data source types as RRDTool (COUNTER, ABSOLUTE, DERIVE, GAUGE)
  • RRD4J supports the same consolidation functions as RRDTool (AVERAGE, MIN, MAX, LAST) and adds TOTAL, FIRST
  • RRD4J supports almost all RRDTool RPN functions (see RPNFuncs)
  • RRD4J has multiple backends, e.g. use MongoDB as data store

Usage Example

import org.rrd4j.code.*;
import static org.rrd4j.DsType.*;
import static org.rrd4j.ConsolFun.*;
// first, define the RRD
RrdDef rrdDef = new RrdDef(rrdPath, 300);
rrdDef.addArchive(AVERAGE, 0.5, 1, 600); // 1 step, 600 rows
rrdDef.addArchive(AVERAGE, 0.5, 6, 700); // 6 steps, 700 rows
rrdDef.addArchive(MAX, 0.5, 1, 600);

// then, create a RrdDb from the definition and start adding data
RrdDb rrdDb = new RrdDb(rrdDef);
Sample sample = rrdDb.createSample();
while (...) {
    sample.setValue("inbytes", ...);
    sample.setValue("outbytes", ...);

// then create a graph definition
RrdGraphDef gDef = new RrdGraphDef();
gDef.setTitle("My Title");

gDef.datasource("bytes", "myrrdpath", "inbytes", AVERAGE);
gDef.hrule(2568, Color.GREEN, "hrule");

// then actually draw the graph
RrdGraph graph = new RrdGraph(gDef); // will create the graph in the path specified

Go through the source of Demo for more examples.

Supported Databases

Next to memory and file storage, RRD4J supports the following databases (using byte array storage):


Thanks to the rrd4clj project Clojure now has a RRD API (using RRD4J). Check out their examples.

Contributing to RRD4J

If you are interested in contributing to RRD4J, start by posting patches to issues that are important to you. Subscribe to the discussion group and introduce yourself.

If you can't contribute, please let us know about your RRD4J use case. Always good to hear your stories!

Graph Examples (from the JRDS project)



You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.