Rurien
133
2021-04-19 12:37:37 작성 2021-04-19 12:38:00 수정됨
2
130

Spring boot 부하테스트 관련 질문입니다


스프링 부트로 REST API 부하테스트를 진행 중에 있는데요,


JMeter로 동시접속자(Thread) 500명, Ramp up period 10초로 두고, 내부 로직 없이 단순히 HTTP Request/Response만 주고받는 테스트를 진행하고 있습니다.


자바 Controller 코드

@RequestMapping(method=RequestMethod.POST, value="/client/test")
public String testResponse(
		) throws Exception {
	String resultJson = "test response";
	
	return resultJson;
}



설정은 다음과 같습니다.


Application.properties

server.tomcat.connection-timeout=20000
server.tomcat.max-connections=100000
server.tomcat.threads.max=10000
server.tomcat.threads.min-spare=2500
server.tomcat.accept-count=100000


Java 실행 설정

-Xmx8g -Xms4g -Xmn1g -XX:PermSize=512m -XX:SurvivorRatio=4 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=50 -XX:+CMSParallelRemarkEnabled -Xloggc:gc.log -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps


CentOS 7 설정

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 901658
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 8192
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 65535
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited



약 1-2만건 정도까지는 정상적인 처리가 진행되는데, 그 이상으로 진행하면


아래 그래프와 같이 응답시간이 증가하면서 JMeter에서 다음 오류가 출력됩니다.






org.apache.http.conn.ConnectTimeoutException: Connect to 112.220.184.107:8098 [/112.220.184.107] failed: connect timed out

	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)

	at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$JMeterDefaultHttpClientConnectionOperator.connect(HTTPHC4Impl.java:404)

	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)

	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)

	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)

	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)

	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)

	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)

	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)

	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)

	at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:935)

	at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:646)

	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)

	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296)

	at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285)

	at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638)

	at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)

	at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)

	at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)

	at java.lang.Thread.run(Thread.java:748)

Caused by: java.net.SocketTimeoutException: connect timed out

	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)

	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)

	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

	at java.net.Socket.connect(Socket.java:607)

	at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75)

	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)

	... 19 more



정말로 처리시간이 오래 걸려서 connect timeout이 발생하는지 확인하기 위해 Connect timeout을 5초->60초로 늘려도 보았지만 결과는 동일합니다.


도무지 원인을 잡을수가 없는데, 혹여나 원인이 될 수 있는 부분이 있다면 지적 감사하겠습니다.

0
  • 답변 2

  • Oniony
    30
    2021-04-19 13:09:24

    connection pool 을 모니터링 해보세요

  • Rurien
    133
    2021-04-19 14:09:01

    Oniony

    확인해보겠습니다. 감사합니다!

  • 로그인을 하시면 답변을 등록할 수 있습니다.