Camel을 사용하여 HTTPS 서버에 아주 빠른 속도 (> 1500/초)로 메시지를 POST 할 수 있기를 원합니다.KeepAlive로 Camel HTTP4 최적화하기
keepAlive를 true로 설정하려고했지만 속도가 향상되지 않습니다.
5 개의 메시지를 보내는 동안 tcpdump를 실행했고 wireshark에서 5 개의 SYN/ACK 패킷을 찾았습니다. 각 POST에서 SSL 인증서가 전송되었을 수도 있습니다. (tcpdump에 의해 캡쳐 된 102 패킷,하지만 보내고있는 것은 모두 "HelloWorld"문자열입니다.)
속도를 향상시킬 방법이 있습니까? 이것은 내가 사용 된 코드입니다 :
CamelContext context = new DefaultCamelContext();
final HttpComponent http = (HttpComponent) context.getComponent("https4");
http.setConnectionsPerRoute(1);
http.setMaxTotalConnections(1);
HttpConfiguration httpConfiguration = new HttpConfiguration();
http.setHttpConfiguration(httpConfiguration);;
context.addComponent("fcpHttpComponent", http);
template = context.createProducerTemplate();
headers.put(Exchange.CONTENT_TYPE, "application/json");
headers.put(Exchange.HTTP_METHOD, HttpMethods.POST);
final String endpoint = "https://xxx.xxx.xxx.xxx:443";
try {
httpEndpoint = new HttpEndpoint(endpoint, http, new URI(endpoint));
httpEndpoint.configureProperties(headers);
PoolingHttpClientConnectionManager clientConnectionManager = new PoolingHttpClientConnectionManager();
SocketConfig socketConfig = SocketConfig.custom()
.setSoKeepAlive(true)
.setSoReuseAddress(true)
.setTcpNoDelay(true)
.setSndBufSize(10)
.build();
clientConnectionManager.setDefaultSocketConfig(socketConfig);
HttpClientBuilder clientBuilder = HttpClientBuilder.create();
clientBuilder.setMaxConnPerRoute(1);
clientBuilder.setConnectionManager(clientConnectionManager);
clientBuilder.build();
ConnectionKeepAliveStrategy keepAliveStrategy = new DefaultConnectionKeepAliveStrategy();
clientBuilder.setKeepAliveStrategy(keepAliveStrategy);
httpEndpoint.setClientBuilder(clientBuilder);
httpEndpoint.setClientConnectionManager(clientConnectionManager);
template.start();
context.start();
} catch (final Exception e) {
LOG.error("Exception while starting Camel context ", e);
}
//Call this method 5 times
template.asyncRequestBodyAndHeaders(httpEndpoint, message, headers);
SSL 인증서 세부 정보는 JVM 인수로 제공됩니다. POST 데이터를 사용할 수 있지만 속도가 향상되어야합니다.
[업데이트] 서버로 Apache Tomcat 8을 사용하고 있습니다. 은 server.xml에 설정해야 할 사항은 다음과 같습니다
<Connector
protocol="org.apache.coyote.http11.Http11NioProtocol"
port="443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="/x/store.jks" keystorePass="y"
clientAuth="false" sslProtocol="TLS" maxKeepAliveRequests="-1" keepAliveTimeout="-1" />
은 나뿐만 아니라 내 서버에 구성해야 뭔가가 있나요?