Version 6

    Running performance tests on JBossCache


    1. Check out the JBossCache CVS module from HEAD.


    2. Edit tests/perf/org/jboss/cache/benchmark/support/ - there are some properties here that need to be configured according to how many threads and loops you want to use to exercise the tests.


        // This parameter specifies how many threads concurrently exercise the tests.
        protected static int NUM_THREADS = 10;
        // This parameter specifies the number of loops each thread runs.
        protected static int NUM_LOOPS = 10000;
        // wait time (in ms) between each iteration
        protected static long WAIT_TIME = 100;


    3. Change log levels in etc/log4j.xml to ERROR or FATAL to reduce log messages which may slow tests down.


    4. Build JBossCache, run the tests and generate a JUnit report  Note that you no longer need X-Windows to run performance tests


      $ ant-dist/bin/ant clean jar jrunit reports


    5.  The JRunit target should have created a file in output/jrunit-serialized-data.dat


    6.  Copy this file to your local machine, and run:


      $ java -cp $CLASSPATH org.jboss.jrunit.OfflineProcessor /path/to/jrunit-serialized-data.dat org.jboss.jrunit.controller.reporters.XrefReporter /path/to/output/directory


    Note that you need the following jars in your classpath to run this:

    • jcommon-1.0.0-rc1.jar

    • jfreechart-1.0.0-rc1.jar

    • jrunit.jar


    7.  The resulting report will have measured times in millis to run 100 operations, calculated on average based on the number of threads and loops configured in step 2 above.


    Writing more tests


    1. Simply write your test to extend Read50PercentTest, Read75PercentTest and Read90PercentTest in

    2. Your test would need to override static methods staticSetUp() and staticTearDown() which is called by the framework, used to initialise and clean up resources.

    3. You would also need to override doPut() and doGet() to perform gets and puts on your cache.

    4. Static variables STATIC_SETUP_METHOD and STATIC_TEARDOWN_METHOD should be set (in a static block) to the Method objects representing your staticSetUp() and staticTearDown() methods respectively.

    5. overriding doSingleNode and doMultiNode properties allows you to specify whether or not to run cache tests on the same TreeCache node, and on multiple TreeCache nodes.

    6. Finally, set the 'configuration' property to the name of your new configuration to test.


    See some of the tests in org.jboss.cache.benchmark.tests for pointers.