사진: Unsplash의Jacek Dylag |
JMeter로 소켓 프로그램의 성능 테스트를 하고 있다.
구성은 다 된 것 같은데, 에러가 20% 이상 발생하는 경우가 있다.
에러는 JMeter로 부하를 발생시키는 장비에서 난다.
에러도 특이하다. 요청한 주소를 배정할 수 없다고 한다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | java.net.ConnectException: 요청한 주소를 배정할 수 없습니다 (connect failed) at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_372] at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_372] at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_372] at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_372] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_372] at java.net.Socket.connect(Socket.java:607) ~[?:1.8.0_372] at org.apache.jmeter.protocol.tcp.sampler.TCPSampler.getSocket(TCPSampler.java:167) ~[ApacheJMeter_tcp.jar:5.5] at org.apache.jmeter.protocol.tcp.sampler.TCPSampler.sample(TCPSampler.java:380) ~[ApacheJMeter_tcp.jar:5.5] at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:651) ~[ApacheJMeter_core.jar:5.5] at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:570) ~[ApacheJMeter_core.jar:5.5] at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:501) ~[ApacheJMeter_core.jar:5.5] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:268) ~[ApacheJMeter_core.jar:5.5] at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_372] | cs |
정확한 원인을 모르니, 엄한 곳에서부터 원인을 찾기 시작했다.
ipv6, file descriptor. 아니다.
netstat으로 연결된 소켓 목록을 보고 감을 잡았다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | [pluto@localhost apache-jmeter-5.5]$ netstat -an | grep 8119 (생략) tcp6 0 0 1x.1x.1x.xx:53152 1x.1x.1x.xx:8119 TIME_WAIT tcp6 0 0 1x.1x.1x.xx:55990 1x.1x.1x.xx:8119 TIME_WAIT tcp6 0 0 1x.1x.1x.xx:54230 1x.1x.1x.xx:8119 TIME_WAIT tcp6 0 0 1x.1x.1x.xx:60162 1x.1x.1x.xx:8119 TIME_WAIT tcp6 0 0 1x.1x.1x.xx:43378 1x.1x.1x.xx:8119 TIME_WAIT tcp6 0 0 1x.1x.1x.xx:51470 1x.1x.1x.xx:8119 TIME_WAIT tcp6 0 0 1x.1x.1x.xx:58146 1x.1x.1x.xx:8119 TIME_WAIT tcp6 0 0 1x.1x.1x.xx:56986 1x.1x.1x.xx:8119 TIME_WAIT [pluto@localhost apache-jmeter-5.5]$ netstat -an | grep 8119 | wc -l 21471 [pluto@localhost apache-jmeter-5.5]$ netstat -an | grep 8119 |grep TIME_WAIT | wc -l 26345 [pluto@localhost apache-jmeter-5.5]$ netstat -an | grep 8119 |grep TIME_WAIT | wc -l 27706 [pluto@localhost apache-jmeter-5.5]$ | cs |
JMeter TCP Sampler 옵션 중 SO_LINGER에 TIME_WAIT에 대한 설명이 있다.
옵션 값을 0으로 설정 후 다시 테스트, 통과!
0 댓글