Created attachment 27162 [details] Update to HTTPSampler2.java and jmeter.properties implementing SSL cache reuse control
Currently the HTTPClient sampler creates an SSL context and connection (i.e.: full handshake) for each thread on the first iteration only. Subsequent iterations reuse their cached SSL Context thereby reusing an existing SSL handshake. While this is typical of the way that a browser behaves (caching and reusing an SSL context where possible) it limits our ability to do specific testing of how a system will handle a constant load of N users when having to perform SSL transactions. The patch I have proposed adds a new property "https.use.cached.ssl.context" to the jmeter.properties file. The default value is "true" to preserve existing functionality. If false the override of public void testIterationStart(LoopIterationEvent event) will get the SSL manager instance and call the resetContext() method, nulling the current threadLocal SSL context, and closing any currently open connections in the HTTP Client. This allows us to create a new SSL context/connection each iteration, but reuse that context within the iteration.
Can you provide a diff patch with current trunk, not full plain files. Thanks.
Created attachment 27509 [details] Implementation of the feature Hello, A note about implementation: 1) It works for HC3 and HC4 implementation 2) For Java Native HTTPSUrlConnection it doesn't work, SSL Context is cached and I don't see the method to reset it, if someone knows I will be interested. To validate my patch I set: -Djavax.net.debug=all And count number of occurences of: "trustStore is: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/lib/security/cacerts" I note something strange: - HC3 => 10 times => OK - HC4 => 12 times => STRANGE ? - Java => 1 time on first run then as it's in cache, regular since I don't reset it see note 2) above Regards Philippe
Please, respect code convention in JMeter for your patch. Thanks. http://wiki.apache.org/jakarta-jmeter/JMeterEclipse
Created attachment 27511 [details] Fix to the issue with corrected code format (I hope so) If format is not OK please tell me what's wrong. Regards Philippe
Please Detab (and don't insert a new line before { on an If statement / methods (now fixed)
Thanks for the patch. I simplified it somewhat by making the base implementation concrete, thus avoiding the need to provide implementations in all samplers. Also made all the notifySSLContextWasReset() methods protected (some were public, not sure why). URL: http://svn.apache.org/viewvc?rev=1172147&view=rev Log: Bug 51380 - Control reuse of cached SSL Context from iteration to iteration Modified: jakarta/jmeter/trunk/bin/jmeter.properties jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java jakarta/jmeter/trunk/xdocs/changes.xml jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2501