You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Venu Kemthur (JIRA)" <ji...@apache.org> on 2019/08/07 04:30:00 UTC
[jira] [Updated] (HTTPCLIENT-2007) Performance Issue with Pooled
Connection Manager + Custom socket factory
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Venu Kemthur updated HTTPCLIENT-2007:
-------------------------------------
Description:
We are using HttpClient 4.5.9 to connect to a service which expects Client Cert (MTLS)
Since we are using PoolingHttpClientConnectionManager, had to use the following mechanism to create and set a LayeredConnectionSocketFactory when instantiating PoolingHttpClientConnectionManager
{code:java}
ConnectionSocketFactory plainsf = <...>
LayeredConnectionSocketFactory sslsf = <...>
Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", plainsf)
.register("https", sslsf)
.build();
HttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(r);
HttpClients.custom()
.setConnectionManager(cm)
.build();{code}
Tested this service with K6 load testing tool and see latency in seconds. Seems like it keeps growing from milliseconds (20ms) all the way to 8 seconds.
K6 in a minute could only do 45 QPS with this latency.
Sample run
{code:java}
data_received..............: 1.6 MB 27 kB/s
data_sent..................: 6.9 MB 115 kB/s
http_req_blocked...........: avg=8.92ms min=1µs med=3µs max=424.79ms p(90)=6µs p(95)=13µs
http_req_connecting........: avg=1.42ms min=0s med=0s max=46.53ms p(90)=0s p(95)=0s
http_req_duration..........: avg=2.1s min=57.25ms med=2.11s max=5.96s p(90)=4.1s p(95)=4.22s
http_req_receiving.........: avg=71.79µs min=23µs med=55µs max=6.19ms p(90)=89µs p(95)=102µs
http_req_sending...........: avg=25.37µs min=9µs med=20µs max=2.38ms p(90)=35µs p(95)=43µs
http_req_tls_handshaking...: avg=7.49ms min=0s med=0s max=385.7ms p(90)=0s p(95)=0s
http_req_waiting...........: avg=2.1s min=57.18ms med=2.11s max=5.96s p(90)=4.1s p(95)=4.22s
http_reqs..................: 2721 45.349907/s
iteration_duration.........: avg=2.11s min=64.04ms med=2.11s max=6.12s p(90)=4.11s p(95)=4.22s
iterations.................: 2721 45.349907/s
vus........................: 100 min=100 max=100
vus_max....................: 100 min=100 max=100{code}
Same code when replaced with JDK 11 HttpClient could do 600 QPS!
We are using this client in other scenarios (non-MTLS) and we have no issues in that path.
Is there a known issue with *Pooling Connection Manager* +*SSLConnectionSocketFactory*
was:
We are using HttpClient 4.5.9 to connect to a service which expects Client Cert (MTLS)
Since we are using PoolingHttpClientConnectionManager, had to use the following mechanism to create and set a LayeredConnectionSocketFactory when instantiating PoolingHttpClientConnectionManager
{code:java}
ConnectionSocketFactory plainsf = <...>
LayeredConnectionSocketFactory sslsf = <...>
Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create()
.register("http", plainsf)
.register("https", sslsf)
.build();
HttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(r);
HttpClients.custom()
.setConnectionManager(cm)
.build();{code}
Tested this service with K6 load testing tool and see latency in seconds. Seems like it keeps growing from milliseconds (20ms) all the way to 8 seconds.
K6 in a minute could only do 45 QPS with this latency.
Same code when replaced with JDK 11 HttpClient could do 600 QPS!
We are using this client in other scenarios (non-MTLS) and we have no issues in that path.
Is there a known issue with *Pooling Connection Manager* +*SSLConnectionSocketFactory*
> Performance Issue with Pooled Connection Manager + Custom socket factory
> -------------------------------------------------------------------------
>
> Key: HTTPCLIENT-2007
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2007
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (classic)
> Affects Versions: 4.5.9
> Reporter: Venu Kemthur
> Priority: Major
>
> We are using HttpClient 4.5.9 to connect to a service which expects Client Cert (MTLS)
> Since we are using PoolingHttpClientConnectionManager, had to use the following mechanism to create and set a LayeredConnectionSocketFactory when instantiating PoolingHttpClientConnectionManager
> {code:java}
> ConnectionSocketFactory plainsf = <...>
> LayeredConnectionSocketFactory sslsf = <...>
> Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create()
> .register("http", plainsf)
> .register("https", sslsf)
> .build();
> HttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(r);
> HttpClients.custom()
> .setConnectionManager(cm)
> .build();{code}
> Tested this service with K6 load testing tool and see latency in seconds. Seems like it keeps growing from milliseconds (20ms) all the way to 8 seconds.
> K6 in a minute could only do 45 QPS with this latency.
> Sample run
> {code:java}
> data_received..............: 1.6 MB 27 kB/s
> data_sent..................: 6.9 MB 115 kB/s
> http_req_blocked...........: avg=8.92ms min=1µs med=3µs max=424.79ms p(90)=6µs p(95)=13µs
> http_req_connecting........: avg=1.42ms min=0s med=0s max=46.53ms p(90)=0s p(95)=0s
> http_req_duration..........: avg=2.1s min=57.25ms med=2.11s max=5.96s p(90)=4.1s p(95)=4.22s
> http_req_receiving.........: avg=71.79µs min=23µs med=55µs max=6.19ms p(90)=89µs p(95)=102µs
> http_req_sending...........: avg=25.37µs min=9µs med=20µs max=2.38ms p(90)=35µs p(95)=43µs
> http_req_tls_handshaking...: avg=7.49ms min=0s med=0s max=385.7ms p(90)=0s p(95)=0s
> http_req_waiting...........: avg=2.1s min=57.18ms med=2.11s max=5.96s p(90)=4.1s p(95)=4.22s
> http_reqs..................: 2721 45.349907/s
> iteration_duration.........: avg=2.11s min=64.04ms med=2.11s max=6.12s p(90)=4.11s p(95)=4.22s
> iterations.................: 2721 45.349907/s
> vus........................: 100 min=100 max=100
> vus_max....................: 100 min=100 max=100{code}
> Same code when replaced with JDK 11 HttpClient could do 600 QPS!
> We are using this client in other scenarios (non-MTLS) and we have no issues in that path.
> Is there a known issue with *Pooling Connection Manager* +*SSLConnectionSocketFactory*
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org