dhartford
dhartford

Reputation: 1149

jmeter - asynchronous TCP sampler options?

I'm hoping someone has some experience with asynchronous testing and how to accomplish it with Jmeter. If someone does know, but not with jmeter, also open to other options, but more familiar with jmeter and the context is for load/stress testing.

Definition: For example, sending raw TCP textual datastreams where the "session" id is within the datastream itself. Everything is asynchronous and could be 'out-of-order' as far as returns.

Example: So, given a sample of 10 datastreams with an end signal of \n over 5 threads, it is possible for all 10 to be sent over the same TCP port before the first one responds, and the response could be in any order.

session00001datasenthere\n

session00002datalsosenthere\n

session00003differentdata\n

...

session00010moredifferentdata\n

Using Jmeter, I do want to measure how long it takes for each given datastream based on the sessionid (say data bytes 8-12 of the streams in this example) to return. The intent is to use Jmeter for what it is good at, load/stress testing across multiple machines, but smart enough to understand the asynch TCP data (opposed to your normal HTTP session request/response).

Constraint is during any given testing session the 'sessionid' is unique at least until a response stream is returned (for logistic reasons, otherwise couldn't pull this off ;-).

Thanks in advance, and just to ensure intent is understood, this is to take advantage of all the nice ready-to-go reports/listeners/plugins/analytics available to Jmeter.

EDIT: The implementation of the server under test is Netty, not dissimilar to the Telnet example. If there is a Jmeter example of testing the Netty example Telnet server that may also help.

-D

Upvotes: 0

Views: 4166

Answers (1)

Gábor Lipták
Gábor Lipták

Reputation: 9776

Your option I think is to implement a Java Request Sampler.

You could define the following parameters for your Java Request Sampler implementation:

  • server host
  • server port
  • connection identifier(see later)
  • session identifier
  • data

Read carefully the documentation of JavaSamplerClient to understand the lifecycle. Each thread will have one instance of your sampler.

Then in your implementation you need to take care of the following things:

  • create a connection handler class, which opens up sockets for each connection identifier. Test cases using the same connection identifier will send data through the same socket. This connection handler should take care of sending the data synchronized way and to give back the response to the appropiate instance, which is waiting for it
  • in your sampler you have to create exactly one connection handler (or one per server, or one per port, as you wish)
  • when the sampler sends some text, you give it to the connection handler, and the sampler waits till the response comes.

This way you can simply convert your asynchronous problem to a synchronous one with implementing this conenction handler, which is shared between the sampler instances. But take care of the implementation to be sure that your thread programming does not fake the results with some testing tool side bottleneck.

Upvotes: 1

Related Questions