Using Gatling to drive Java code


I’ve read through the first steps and advanced guides, and poked around the wiki, but I still need a bit more direction. Apologies if this is a repetition or I’ve missed documentation on it.

I’d like to load test a web application which sits behind a Flash Rich Internet Application. In short, the Flash client makes AMF calls to a BlazeDS Java endpoint. The load testing frameworks I’ve found so far that speak AMF are proprietary, expensive, and/or unproven. To keeps things simple and feasible, I want to cut out the Flash side and instead load test by making direct Java calls to the endpoint, and get statistics for those calls. From what I’ve read, Scala and Java are byte code compatible and straightforward to integrate, and Gatling can cope with the large number of actors I need. So I could theoretically achieve what I need if I can get Gatling scenarios to make the method calls.

Are there examples or references on writing scenarios that make Java calls in this way?



Yes, using Java code from Scala is very straightforward (the other way is a bit more tricky). Actually, we use a lot of Java library in Gatling, like Netty and async-http-client.

We have yet to provide extension point over HTTP so one can plug in a serializer/deserializer. We intend to do that in Gatling 2. This feature would be useful for other serialization protocols such as GWT-RPC.

Which java AMF library do you have in mind. I guess it implies providing the Java DTO classes, right?




Is there any example you can point me to of a Gatling scenario making a Java call? That would really help me piece this together.

re: for AMF, IIRC, either Adobe’s BlazeDS or LiveCycle Data Services handle the serialisation to and from Java DTOs when using a Java backend (the Spring BlazeDS project delegates to the former)


I thought you wanted to “just” serialize requests and deserialize responses into AMF, but let Gatling handle the HTTP transport.

Now I properly understand what you’re up to. You have to write your own protocol support. You can find a WIP documentation here:



I’m planning on writing a simple protocol handler to run code and record the runtime on a flight this Friday; the DSL I have in mind is something like this:

exec(fn(“my_call”){session =>


I’ll post the results here.

Sounds like someone’s going to Nescala :slight_smile:

Looks nice.
What about success/failure? Failure = Exception?

Good point. That’s the simplest way; I’ll see if an obvious way to expose it comes to mind when I’m doing it.

No Nescala I’m afraid - redeye from JFK back home to DUB.

Good point. That's the simplest way; I'll see if an obvious way to expose
it comes to mind when I'm doing it.

Cool, thanks!

No Nescala I'm afraid - redeye from JFK back home to DUB.

Sorry for you... :slight_smile:

Is it possible to run jUnit tests as part of performance testing instead of creating an http url?

If you’re looking for a micro-benchmark solution on top of JUnit, I recommend JUnitBenchmarks: