Performance Testing With Faban

I’ve been quiet on the blog front lately, having all kinds of fun with new challenges. Now that I got around to installing WordPress maybe it is time to write again…

One of the interesting things I’m looking into at Proofpoint is the performance and scalability of one of the web services we offer. Architecturally the server is of a fairly standard design; built using Java Servlets and it provides a number of services via REST APIs.

In between working on features, I’ve been having fun exploring the performance characteristics. After setting up a suitable lab environment, the next question was deciding which load generator to use.

Back at Sun while working on the Web Server I had used Faban so I was already familiar with it, although only with running the load tests, not writing them. Earlier with the SunONE Application Server I had also used jmeter quite a lot so that was another choice. In the end, I decided to try first with Faban.

While there is a lot of documentation on the Faban web site, there are also gaps in the explanations that can be quite confusing. I found that it took some experimentation to get a custom benchmark driver to work. One drawback is that Faban doesn’t do a very good job of reporting problem root causes. Often if it doesn’t like something about the test or configuration it just doesn’t work, but finding out why involves trial and error. Oh well. Still, in the end it is fairly straightforward so with a bit of patience I had a nice custom benchmark with exercises the primary REST APIs of the server.

One thing I found was that none of the convenience HTTP query APIs built into Faban was suitable for my needs because they insisted in encoding the request data in ways not compatible with the server. The solution turned out to be easy in hindsight but difficult to find in the documentation at first, so documenting it is the primary reason for this article…

I ended up using the TimedSocketFactory provided by Faban. In the contructor of my benchmark class I create one instance of it:

    socketFactory = new TimedSocketFactory();

Then in each of the benchmark operation methods I do:

    Socket s = socketFactory.createSocket(myServerIP, 80);
    PrintWriter out = new PrintWriter(s.getOutputStream(), true);
    BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream()));
    out.println(req);

Here ‘req’ is the previously constructed request buffer. Then I read and process the server response from ‘in’.

With that, Faban takes care of timing and collecting the statistics very nicely.

Overall I found Faban to be quite useful, I’ve used it to collect much useful data on the performance characteristics of our server under various load conditions. I now have a long list of ideas on how to scale up the performance!