java http load test

252 views
Skip to first unread message

Baron Reznik

unread,
Aug 1, 2013, 2:14:26 PM8/1/13
to iago-...@googlegroups.com
hi,

I'm trying to use iago to load test an HTTP API with Java. The echo example in the repository uses the ThriftTransport, but according to the documentation I should be using the FinagleTransport, but having trouble leveraging that without using a separate HTTP client.

Snippet of my ParrotLauncherConfig:
victims = "localhost"
localMode = true
imports = "import net.reznik.loadtest.SimpleLoadTest"
scheme = "http"
responseType = "org.jboss.netty.handler.codec.http.HttpResponse"
transport = "FinagleTransport"
loadTest = "new SimpleLoadTest(service.get)"

My load test class looks like:
public class SimpleLoadTest extends LoadTest {
    public SimpleLoadTest(ParrotService<ParrotRequest, HttpResponse> parrotService) {
       // SNIPPED - create apache http client
    }

    @Override
    public void processLines(List<String> lines) {
        for (String line : lines) {
            // SNIPPED - use apache http client
        }
    }
}


I'd like to switch it to use the built in finagle http transport, but it's not clear how I do that. Could anyone please help shed some light on you to get past this roadblock?

Additionally, does iago have a way to keep track of whether the HTTP calls were successful or not? Is that exposed via the metrics? The ostrich graph metrics look nice when the test is executing, but is there a way to access them after the test ends?

Thanks,
Baron

Trisha Quan

unread,
Aug 1, 2013, 9:48:52 PM8/1/13
to iago-...@googlegroups.com
Hey Baron,

Responses inline.




On Thu, Aug 1, 2013 at 11:14 AM, Baron Reznik <ba...@reznik.net> wrote:
hi,

I'm trying to use iago to load test an HTTP API with Java. The echo example in the repository uses the ThriftTransport, but according to the documentation I should be using the FinagleTransport, but having trouble leveraging that without using a separate HTTP client.

Snippet of my ParrotLauncherConfig:
victims = "localhost"
localMode = true
imports = "import net.reznik.loadtest.SimpleLoadTest"
scheme = "http"
responseType = "org.jboss.netty.handler.codec.http.HttpResponse"
transport = "FinagleTransport"
loadTest = "new SimpleLoadTest(service.get)"

My load test class looks like:
public class SimpleLoadTest extends LoadTest {
    public SimpleLoadTest(ParrotService<ParrotRequest, HttpResponse> parrotService) {
       // SNIPPED - create apache http client
    }

    @Override
    public void processLines(List<String> lines) {
        for (String line : lines) {
            // SNIPPED - use apache http client
        }
    }
}


I'd like to switch it to use the built in finagle http transport, but it's not clear how I do that. Could anyone please help shed some light on you to get past this roadblock?
FinagleTransport should allow you to write HTTP requests by default, ParrotRequests are just wrappers for HTTP requests. This example processor might give better insight into how to create HTTP requests to send with the FinagleTransport. The source for ParrotRequest shows the different parameters you can set in your processor.

Additionally, does iago have a way to keep track of whether the HTTP calls were successful or not? Is that exposed via the metrics?

So, the response you get in your Processor from the service(request) call is a Future that contains the HTTPResponse. https://github.com/twitter/finagle#imperative-java-style gives some examples of how to take the Future you get back and operate on them in Java.
 
The ostrich graph metrics look nice when the test is executing, but is there a way to access them after the test ends?
Ah, this one I'll leave for other people to answer. I think there should be a file that is generated with the stats that should be around after the test ends, but I'm not sure where that is.
 

Thanks,
Baron

--
 
---
You received this message because you are subscribed to the Google Groups "Iago Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iago-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Tom Howland

unread,
Aug 5, 2013, 2:51:17 PM8/5/13
to iago-...@googlegroups.com
The ostrich graph metrics look nice when the test is executing, but is there a way to access them after the test ends?
 
The default configuration is for Iago to leave a finagle stats log: parrot-server-stats.log.

It is a collection of performance statistics for the parrot server. From this you can look at interesting metrics like 

records-read -- number of records read from the Iago feeder per minute

client/request_latency_ms_average -- the average time in milliseconds that a message makes it to the victim and the response from the victim is received

client/requests -- the number of requests per minute that have made it to the victim and been responded to

requests_sent -- the number of requests sent by the Iago server

Using these, you can make pretty graphs like

Inline image 1
The above graph indicates that the victim has a maximum requests per minute of 150,000 requests per second and then fails catastrophically rates above that.
Unfortunately, you have to write the code to display this yourself. There should be a github project for displaying these Finagle Stats Logs in a few weeks if all goes according to plan.
image.png

Baron Reznik

unread,
Aug 8, 2013, 2:31:43 PM8/8/13
to iago-...@googlegroups.com
Thanks for the responses. Trying this from java, I'm confused about the service(new ParrotRequest(..)) line in scala as I don't see any methods exposed by the ParrotService, so I'm not sure how to execute a ParrotRequest?

Tom Howland

unread,
Aug 8, 2013, 4:29:38 PM8/8/13
to iago-...@googlegroups.com
Hi Baron

You write

Thanks for the responses. Trying this from java, I'm confused about the service(new ParrotRequest(..)) line in scala as I don't see any methods exposed by the ParrotService, so I'm not sure how to execute a ParrotRequest?

You're referring to the part in SimpleRecordProcessor where the apply method of ParrotService is being called. In Scala, when you invoke an instance as a method you get the "apply" method. This just throws your request onto the output queue.

Tom Howland

unread,
Aug 8, 2013, 4:46:46 PM8/8/13
to iago-...@googlegroups.com
Baron

Did you review the example "web" application? If you're trying to stress test a web app using Parrot you must either create a custom record processor that converts your log into valid URL's or, do what everyone else seems to do: write a script that converts your log into the format described in examples/web/config/web.scala.

If you end up writing a record processor for apache logs, could you contribute it? People ask for that from time to time.

Baron Reznik

unread,
Aug 9, 2013, 5:04:16 PM8/9/13
to iago-...@googlegroups.com
The apply method doesn't seem to be exposed to java though, correct? I didn't see a way to directly append to the queue from Java either, which is what the part I'm stuck on.

I did review the example web application and got that working, the issue is I'm trying to test something a bit more complex then simple GETs, primarily HTTP POSTs with content in the HTTP body, so converting to the web.scala example format doesn't work for me. I'm trying to load test a custom netty service with its own log format. My hope was that if I got it to work, I could then make a simplified java-based http example that could be contributed back.

Whereas in scala it seems you can more simply do "new ParrotRequest(hostHeader, Nil, uri, line)" in Java I appear to have to pass every parameter. I'm not familiar with scala so I don't know if there's a way to expose a simpler mechanism for java or not.

Thanks,
Baron
Reply all
Reply to author
Forward
0 new messages