hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <p.moua...@ubik-ingenierie.com>
Subject httpClient.getConnectionManager() performance with HTTP only
Date Tue, 13 May 2014 21:59:46 GMT
Hello,
We have a report of Performance issue when using HttpClient4 with HTTP.

User noticed cacert was read very frequently.

I traced the calls and it is due to :
HttpClient#getConnectionManager()
=>

    public synchronized final ClientConnectionManager
getConnectionManager() {
        if (connManager == null) {
            connManager = createClientConnectionManager();
        }
        return connManager;
    }

==>        final SchemeRegistry registry =
SchemeRegistryFactory.createDefault();

====>         registry.register(
                new Scheme("https", 443,
SSLSocketFactory.getSocketFactory()));


=======>
    public static SSLSocketFactory getSocketFactory() throws
SSLInitializationException {
        SSLContext sslcontext;
        try {
            sslcontext = SSLContext.getInstance("TLS");
            sslcontext.init(null, null, null); <======== Reads CACERTS
            return new SSLSocketFactory(
                sslcontext,
                BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
        } catch (NoSuchAlgorithmException ex) {
            throw new SSLInitializationException(ex.getMessage(), ex);
        } catch (KeyManagementException ex) {
            throw new SSLInitializationException(ex.getMessage(), ex);
        }
    }
This reads the cacerts.
In this case user is not using HTTPS at all but gets this performance issue

Issue is not present in HTTPCLient 3.1
-- 
Regards.
Philippe

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message