简体   繁体   中英

TCP sampler request in JMeter

I have a java program that acts as s TCP server and I need to test its performance. Written a tcp sampler jmeter request and I am able to get response data correctly but the response code is 500 and there are errors thrown in logs

TCPClientClassName : TCPClientImpl
Response : 500
Checked "Reuse Connection", "Set No Delay" options

Thread Name: Thread Group 1-1
Sample Start: 2014-10-15 17:33:51 IST
Load time: 514
Latency: 0
Size in bytes: 14
Headers size in bytes: 0
Body size in bytes: 14
Sample Count: 1
Error Count: 1
Response code: 500
Response message: org.apache.jmeter.protocol.tcp.sampler.ReadException: 

Exception in logs

2014/10/15 17:35:14 INFO  - jmeter.engine.StandardJMeterEngine: Running the test! 
2014/10/15 17:35:14 INFO  - jmeter.samplers.SampleEvent: List of sample_variables: [] 
2014/10/15 17:35:14 INFO  - jmeter.gui.util.JMeterMenuBar: setRunning(true,*local*) 
2014/10/15 17:35:14 INFO  - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group 
2014/10/15 17:35:14 INFO  - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group. 
2014/10/15 17:35:14 INFO  - jmeter.engine.StandardJMeterEngine: Thread will continue on error 
2014/10/15 17:35:14 INFO  - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 1      perThread 1000.0 delayedStart=false 
2014/10/15 17:35:14 INFO  - jmeter.threads.ThreadGroup: Started thread group number 1 
2014/10/15 17:35:14 INFO  - jmeter.engine.StandardJMeterEngine: All thread groups have been started 
2014/10/15 17:35:14 INFO  - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1 
2014/10/15 17:35:14 INFO  - jmeter.protocol.tcp.sampler.TCPClientImpl: Using platform default charset:windows- 1252 
2014/10/15 17:35:14 INFO  - jmeter.protocol.tcp.sampler.TCPSampler: Using eolByte=10 
2014/10/15 17:35:15 ERROR - jmeter.protocol.tcp.sampler.TCPSampler:    org.apache.jmeter.protocol.tcp.sampler.ReadException: 
at org.apache.jmeter.protocol.tcp.sampler.TCPClientImpl.read(TCPClientImpl.java:117)
at org.apache.jmeter.protocol.tcp.sampler.TCPSampler.sample(TCPSampler.java:414)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.apache.jmeter.protocol.tcp.sampler.TCPClientImpl.read(TCPClientImpl.java:104)
... 4 more

2014/10/15 17:35:15 INFO  - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1 
2014/10/15 17:35:15 INFO  - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test 
2014/10/15 17:35:15 INFO  - jmeter.gui.util.JMeterMenuBar: setRunning(false,*local*) 

First, To check that your TCP server is really running, run :

telnet host:port

If it still fails, it might be because Firewall is not open between JMeter and target server hosting your TCP server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM