Regperf V1 - Running the Grails performance tests (howto)

Regperf (v1) – Running Grails Performance Tests
How to run the Regperf v1 tests using Grails framework
and Glassfish Java EE 5,0 server


Damien Cooke and I have been building some tools to enable performance testing and comparisons of a simple application built in 3 frameworks Grails, Rails and Java EE 5.0 (JSF), this blog entry is one of a number we are posting between us to describe how to run these simple performance tests (which we presented at JavaOne). This blog entry describes how to run the simple Regperf application implemented in Grails , Damien will be posting how to run the Rails version of Regperf in the very near future and when I have finished the JavaServer Faces write up I will post this too.

The instructions and software has been tested on Solaris and Mac OSX but should run anywhere where Faban and Grails , Java and Postgres run

The main steps

    1. Install the database

    2. Install / create the Grails “Regperf” application

    3. Setting up Faban and the Faban Regperf driver

    4. Running the performance tests using the Grails runtime (jetty)

    5. Deploying and testing the Grails application using Glassfish Java EE 5 application server

  1. Install the database.

  • we used postgres 8.4.2 (of course MySQL, JavaDB , Oracle etc are all okay too). For simplicity these instructions assume that Postgres DB is installed and running on the same host as your grails application.

  • download and unpack the postgres Regperf dump

  • create the db createdb regperfdb

  • import the database schema pg_restore -d regperfdb grails-regperfdb.tar

  1. Install / create the Grails application
    (assumes you have Grails installed at $GRAILS_HOME and $GRAILS_HOME/bin is in your PATH)


  • grails create-app regperf

  • edit $GRAILS_HOME/regperf/grails-app/conf/\*Data\* to point to your database
    class DevelopmentDataSource {
        boolean pooling = true
        String dbCreate = "create-drop" // one of 'create', 'create-drop','update'
        String url = "jdbc:postgresql://localhost:5432/regperfdb"
        String driverClassName = "org.postgresql.Driver"
        String username = "regperf"
        String password = "regperf"

  • copy the JDBC driver into $GRAILS_HOME/regperf/lib

  • copy the following Subscriber.groovy class into the $GRAILS_HOME/regperf/grails-app/domain directory
    class Subscriber {
        String name
        String address
        String email
        Date renewDate = new Date()
        String location

  • cd $GRAILS_HOME/regperf

  • grails generate-all Subscriber

  • grails run-app

  • point your browser to http://localhost:8080/regperf and click on the SubscriberController link

  1. Setup Faban and the Faban Regperf driver

  • Download and install Faban (look at the bottom of the page for download link and installation instructions)
    Note Faban has a driver and also a harness for automatically queuing and running multiple benchmarks but in these instructions we are going to run just the driver component and again assuming localhost

  • set the FABAN_HOME environment variable and add $FABAN_HOME/bin to your PATH

  • mkdir $FABAN_HOME/output (this is where the tests results will be stored)

  • download the Faban Regperf driver for Grails and unjar it into $FABAN_HOME/samples

  • edit the $FABAN_HOME/samples/regperf-grails/config/run.xml
    change the value for outputDir to match your $FABAN_HOME/output directory
    modify the number of simulated users by changing the value for <scale>1<scale> you will get 10 users for each scale factor e.g. scale 1 will give 10 simulated users
    Note the number of loadedsubscribers should match the number of rows you load into the database (this is set initially to 100)
    refer to the Faban documentation for other values to change in the run.xml

  1. Running the performance using the Grails runtime (jetty)

  • cd $FABAN_HOME/samples/grails-regperf/sbin
    assuming that the database and the grails application is still running execute ./ 10

  • start the rmiregistry (this runs in the background)
    ./ &

  • start and execute the benchmark
    Starts up all of the simulated users and writes results of the run into $FABAN_HOME/output/xx directory.
    The results can be conveniently viewed with a web browser.

  1. Deploying and testing the Grails application using Glassfish Java EE 5 application server

  • Assuming Glassfish is installed and running on localhost on port 8080 (the default install)

  • Grails allows the application to be packaged into a .war file and deployed to the application server, to create regperf.war
    cd $GRAILS_HOME/regperf
    grails war

  • Login to the browser admin console. By default this is http://localhost:4848

  • Choose “Deploy Web Application (.war)” from the Deployment column

  • Browse to the $GRAILS_HOME/regperf directory and select regperf.war

  • Click ok to deploy, and test for successful deployment by browsing to http://localhost:8080/regperf )

  • Use the and scripts as per step 4. above to load the database and run the tests (start the rmiregistry if it is not already running).  If you have Glassfish running on a different port or host adjust the run.xml to reflect this.


  • There are other values in the run.xml you might want to configure such as the rampUp, SteadyState and rampDown times.

  • One some platforms we tested deletes seem to run faster than inserts , so over the run the number of rows in the database may decrease. For this reason it is probably a good idea to load a few more rows in the database than is indicated by the loadedsubscribers entry in the run.xml

  • Running the performance tests with the driver, application and database all on one system is great for getting going but is of limited use for doing performance analysis of the application as it is hard to identify or separate the resource requirements of the 3 components when running on one box.

Disclaimer/Important note

Regperf and the simple performance testing tools offered here and on Damien's blog are designed to allow performance testing but do not constitute a “benchmark” per se. A benchmark has process, run rules, criteria for comparison and peer review or audit that can enable relevant performance comparisons to be made with a reasonable (or high) degree of confidence, so please feel free to use the tools to do performance testing of Grails, Rails but understand that this is “not a benchmark” it is just a few interesting and hopefully useful testing and tuning tools!


Post a Comment:
Comments are closed for this entry.



« March 2017