why Apache HttpAsyncClient just send 10 request per second. Am i config something wrong? it my way to start an asyncClient:
PoolingNHttpClientConnectionManager connManager = null;
try {
if (client != null && client.isRunning()) {
client.close();
}
TrustStrategy acceptingTrustStrategy = (certificate, authType) -> true;
SSLContext sslContext = SSLContexts.custom()
.loadTrustMaterial(null, acceptingTrustStrategy).build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext,
SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
Registry<ConnectionSocketFactory> socketFactoryRegistry =
RegistryBuilder.<ConnectionSocketFactory> create().register("https", sslsf).build();
Registry<SchemeIOSessionStrategy> socketRegistry = RegistryBuilder.<SchemeIOSessionStrategy>create()
.register("http", NoopIOSessionStrategy.INSTANCE)
.register("https", new SSLIOSessionStrategy(sslContext, SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER))
.build();
connManager = new PoolingNHttpClientConnectionManager(
new DefaultConnectingIOReactor( IOReactorConfig.custom()
.setConnectTimeout( connectionTimeout * 1000 ) //connectTimeout
.setSoTimeout( readTimeout * 1000 ) //readTimeout
.setIoThreadCount(10000)
.build() ), socketRegistry );
} catch (Exception e) {}
client = HttpAsyncClients.custom()
.setMaxConnPerRoute( maxConnsPerRoute )
.setConnectionManager( connManager )
.setMaxConnTotal( maxConnections )
.setKeepAliveStrategy( DefaultConnectionKeepAliveStrategy.INSTANCE )
.build();
client.start();
and, it's my way to use it:
for(int i = 0; i < 100; i++) {
client.execute(request.getHttpPost(), null);
}
How can I achieve more request per second???