This weekend I wanted to get ahead on one of my tasks at work, which was to write some Watir scripts that would help us do a small load test on a new application we have and the server infrastructure on which it lives. I got the Watir scripts working generically but wanted to make them a bit more dynamic. As I was browsing the Watir site’s documentation I saw a mention of a related project called Celerity. It sounded like Watir without the need to actually invoke the events of a real browser.
I hadn’t used JRuby before, but had always wanted to mess with it. Celerity uses JRuby so I had my excuse. It only took a couple of hours to have a fully functional test case running. I used a ‘load test’ Ruby script I was using with Watir to run concurrent instances of the test case. With a single thread everything was excellent. But even just going to 2 threads caused the process to fail with an OutOfMemoryError. I tried increasing the heap size using the
option, but it didn’t help. Luckily, my twitter on the subject was replied to by ‘@jarib’ who helpfully pointed out that the error was a PERM GEN issue rather than a plain ol’ heap space issue. The solution was to use
as the option. After doing that I could run 7 threads, enough to severely slow down my system, but still work without memory issues.
I’m definitely a fan of Celerity now, and I’d recommend anyone interested in web application testing look into it.