1
votes

I'd like to use jmeter's TCP Sampler to stress test my system (i am using the default TCP sampler and the jmeter GUI), but the thread group loop counter doesn't seem to be working. When i run my test threads only one message gets sent. It almost feels like jmeter is waiting for a response from the server before it begins sending the other messages, except in my case the server should not send any type of acknowledgement.

I am sending text message and using the default tcp sampler class, and have added response assertions to the sampler telling it to ignore the response (which i had hoped would solve my problem). I am also sure that my server is not the issue, and the message is formatted in a way my server expects (with a blank line to signify the end of a message)

My very simple thread group

My very simple TCP Sampler

The result after starting my test

As you can see from my 3rd image, when i start the test it sends one message and just hangs. My server only receives the first message. As i'm new to jmeter, any advice would be helpful. I assumed i can accomplish what i need via the default TCP sampler, if that's not the case can anyone point me in the right direction?

2

2 Answers

1
votes

Looking into your screenshot the first request is still running:

enter image description here

Either your server needs to close the connection after receiving the message you you need to come up with your own AbstractTCPClient implementation which will act accordingly to your application setup.

You can also try out HTTP Raw Request sampler which has more simple configuration which might be more suitable for your use case out of the box. HTTP Raw Request sampler can be installed using JMeter Plugins Manager.

enter image description here

0
votes

Yep, JMeter TCP sampler doesn't send data, when connection not send ask. Just use something like this with JSR223 Sampler:

def sock = new Socket()
def host = "localhost" // change it to your host
def port = 9999 // change it to your port
sock.connect(new InetSocketAddress(host, port))

def out = new OutputStreamWriter(sock.getOutputStream())
try {
    while (true) {
        out.write("Yor test data here")
        out.flush()
        if (sock.isConnected()) {
            SampleResult.setSuccessful(true)
        } else {
            SampleResult.setSuccessful(false)
            break
        }
    }
}
finally {
    sock.close()
}