On 14 May 2014 12:28, Oleg Kalnichevski <ol...@apache.org> wrote: > On Tue, 2014-05-13 at 23:59 +0200, Philippe Mouawad wrote: >> 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 > > Philippe > > If HttpClient is used correctly, this code should only be executed only > once. Why does JMeter create more than one instance of HttpClient?
We currently create an instance for each instance of different proxy settings and each protocol and each authority, because the client is created with these settings. This is also done for each thread. IIRC, this was necessary originally. We have not rewritten the code yet to use all the latest features. > Oleg > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org