anonymous
anonymous

Reputation: 4064

Jmeter tcp sampler works fine but always receives the response later

My jmeter TCP sampler works fine. I adjusted the protocol and my server accepts the request and responds accordingly.

The server already sent the response to JMeter, but my TCP sampler doesn't recognize the response right away. Instead, it takes the amount of milliseconds I configured on timeout -> response field.

enter image description here

For example, if I set 100ms, TCP sampler records the request as successful exactly after 100ms no matter how fast my server responds the request.

enter image description here

This is simple configuration. How can I make my TCP sampler receives the response right away and records it as successful? Am I missing some configurations??

Upvotes: 1

Views: 412

Answers (2)

Dmitri T
Dmitri T

Reputation: 168247

  1. Depending on the implementation you might need to set EOL byte value so JMeter would consider it as the message end. It might be CRLF, } character, > character or 0 for NULL strings, check the responses and see if this is your case. Look for DEC value for the character in the ASCII table

  2. Enable JMeter debug logging for TCP protocol, you can do it by adding the next line to log4j2.xml file (lives in "bin" folder of your JMeter installation

    <Logger name="org.apache.jmeter.protocol.tcp" level="debug" /> 
    

    this way you will see requests and responses dumps plus some information regarding what's going on under the hood

More information: How to Load Test TCP Protocol Services With JMeter

Upvotes: 0

anonymous
anonymous

Reputation: 4064

I figured it out. BinaryTCPClientImpl was looking for EOL byte value to recognize the end of resopnse. Mine is always JSON, so it always ends with } value, which can be converted into followings

  • binary 01111101
  • hex 7D
  • Octal 175
  • signed / unsigned 125

The signed/unsigned value of 125 was required in the EOL field. I put the value and the transaction ends as soon as the server responds.

Upvotes: 0

Related Questions