We have a project for running load tests with Gatling against Magnolia. The corresponding git repository is performance-loadtests.

Preparation

Gatling is based on Scala, so you may want to install a Scala plugin for your IDE. Make sure the Scala version matches the one used in the project (2.11.* at the time of this writing).

Run Magnolia webapp

Start magnolia-load-webapp with / as application context (found under Run Configurations > Deployment in IntelliJ) and run installation tasks if necessary.

Load test application configuration

In IntelliJ, create a new application configuration with the following properties:

Main class: Engine

VM options: -DsimulationName=findbar-masses -DsimulationClass=info.magnolia.loadtest.simulation.FindBarMassSimulation -Dgatling.test.instance=http://localhost:8080

This is an example to run FindBarMassSimulation  - for others, adjust as needed.

Use classpath of module: magnolia-load-test

Run load test

Once the Magnolia webapp is up and running and the load test application has been properly configured, it can be executed.

A successful run will continuously print statistics to the output, similar to the following snippet:

---- Requests ------------------------------------------------------------------
> Global                                                   (OK=278    KO=15    )
> getLoginPage                                             (OK=27     KO=0     )
> doLogin                                                  (OK=24     KO=0     )
> doLogin Redirect 1                                       (OK=24     KO=0     )
> getWidgetset Redirect 1                                  (OK=24     KO=0     )
> postBrowserDetails Redirect 1                            (OK=22     KO=0     )
> focus findbar                                            (OK=21     KO=0     )
> set search term: t                                       (OK=18     KO=0     )
> set search term: tr                                      (OK=18     KO=0     )
> set search term: tra                                     (OK=17     KO=0     )
> set search term: trav                                    (OK=17     KO=0     )
> set search term: trave                                   (OK=17     KO=0     )
> set search term: travel                                  (OK=17     KO=0     )
> pickFirstResult                                          (OK=17     KO=0     )
> doLogout                                                 (OK=15     KO=0     )
> doLogout Redirect 1                                      (OK=0      KO=15    )
---- Errors --------------------------------------------------------------------
> status.find.is(401), but actually found 500                        15 (100.0%)

---- Search in findbar ---------------------------------------------------------
[######################------------------                                  ] 30%
          waiting: 23     / active: 12     / done:15    
================================================================================

Memory consumption

In order to observe memory consumption during different load tests, you can attach an external profiler like VisualVM. Just attach the profiler to the running Magnolia webapp server (most likely Tomcat) and observe its behavior while the load test application is running against that.