Simulation exceeds JVM code size limits?

Hello, I’m new to Gatling but am trying it out as an alternative to jmeter; initially I see a lot that I like. I ran into an error in one of my early tests and am looking for some insight. I took a .har recording of a sample web session and imported it into Gatling; this appeared to work well. I explored the generated class a bit, it looks pretty straightforward and I like the ability to use a DSL to craft tests.

This is on version 2.3.0 (30 August 2017), downloaded yesterday, running on Windows.

Anyway, I went to run the simulation, and after running gatling.bat, it sat there for a bit before coming back with this and a long stacktrace:

09:48:55.877 [ERROR] i.g.c.ZincCompiler$ - Could not write class mypackage/RecordedSimulation because it exceeds JVM code size limits. Method java/lang/StringBuilder’s code too large!
09:48:55.893 [ERROR] i.g.c.ZincCompiler$ - one error found
09:48:55.893 [ERROR] i.g.c.ZincCompiler$ - Compilation crashed
sbt.compiler.CompileFailed: null

I’m assuming this might have something to do with this from the faq?

The compiler complains my Simulation class is too big
Scala classes have the same limitations as Java ones. For example, the amount of code inside a method can’t exceed 64Kb.
If you are in this case (for example, you recorded a big maven installation), you should consider refactoring things a little bit.
If you want to achieve modular and maintainable scenarios, you should consider externalizing processes as chains in other Scala objects.
If you don’t care about maintainability but just want to quickly play what you recorded, you can move the chains outside of the apply method. Also consider changing them from val to lazy val if you have multiple Simulations in your directory.

If that’s the case, is there any guidance on developing test plan classes, especially if I’m importing sessions from a .har file? Is it the actual size of the class that’s the problem? Or the length of some of the chaining? If it’s the chaining, is there a rough estimate of what the max “length” of a chain can be? Like how many chained commands or something? In this example I did notice that it actually broke the whole archive into 3 chains, so maybe there’s something like that already happening?

It’s nice to be able to have someone record a test plan in Chrome or something, give me the archive file, and be able to import that in. But if the importer is going to generate a class that’s too big to compile, what is suggested to tackle that? In this example there were probably some requests that were not needed that I could pare down at first and I’m going through those. But I’d like an idea for what limitations I might be up against so I can determine how to address it.

Thanks for any help!


Hi Tirell,

It looks like you’ve recorded a humongous number of requests.
Either try to split your recording into multiple processes before ingesting into the recorder, or split afterward your Simulation Scala class into several objects that you’ll re-attach together, like it’s being done in our advanced tutorial.