You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2013/07/21 22:41:44 UTC
svn commit: r1505471 - in
/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler:
HTTPAbstractImpl.java HTTPHC3Impl.java HTTPHC4Impl.java HTTPSampler2.java
HTTPSamplerProxy.java
Author: pmouawad
Date: Sun Jul 21 20:41:43 2013
New Revision: 1505471
URL: http://svn.apache.org/r1505471
Log:
Bug 55023 - SSL Context reuse feature (51380) adversely affects non-ssl request performance/throughput
Bugzilla Id: 55023
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java?rev=1505471&r1=1505470&r2=1505471&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java Sun Jul 21 20:41:43 2013
@@ -51,8 +51,8 @@ public abstract class HTTPAbstractImpl i
protected void threadFinished() {
}
- // Allows HTTPSamplerProxy to call testIterationStart; subclasses can override if necessary
- protected void testIterationStart(LoopIterationEvent event) {
+ // Allows HTTPSamplerProxy to call notifyFirstSampleAfterLoopRestart; subclasses can override if necessary
+ protected void notifyFirstSampleAfterLoopRestart() {
}
// Provide access to HTTPSamplerBase methods
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java?rev=1505471&r1=1505470&r2=1505471&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java Sun Jul 21 20:41:43 2013
@@ -44,7 +44,6 @@ import org.apache.commons.httpclient.Pro
import org.apache.commons.httpclient.SimpleHttpConnectionManager;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.cookie.CookiePolicy;
-import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
import org.apache.commons.httpclient.methods.FileRequestEntity;
import org.apache.commons.httpclient.methods.GetMethod;
@@ -65,7 +64,6 @@ import org.apache.commons.httpclient.par
import org.apache.commons.httpclient.params.HttpParams;
import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.commons.io.input.CountingInputStream;
-import org.apache.jmeter.engine.event.LoopIterationEvent;
import org.apache.jmeter.protocol.http.control.AuthManager;
import org.apache.jmeter.protocol.http.control.Authorization;
import org.apache.jmeter.protocol.http.control.CacheManager;
@@ -1112,8 +1110,8 @@ public class HTTPHC3Impl extends HTTPHCA
}
@Override
- protected void testIterationStart(LoopIterationEvent event) {
- log.debug("TtestIterationStart");
+ protected void notifyFirstSampleAfterLoopRestart() {
+ log.debug("notifyFirstSampleAfterLoopRestart");
resetSSLContext = !USE_CACHED_SSL_CONTEXT;
}
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1505471&r1=1505470&r2=1505471&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Sun Jul 21 20:41:43 2013
@@ -1183,8 +1183,8 @@ public class HTTPHC4Impl extends HTTPHCA
}
@Override
- protected void testIterationStart(LoopIterationEvent event) {
- log.debug("TtestIterationStart");
+ protected void notifyFirstSampleAfterLoopRestart() {
+ log.debug("notifyFirstSampleAfterLoopRestart");
resetSSLContext = !USE_CACHED_SSL_CONTEXT;
}
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java?rev=1505471&r1=1505470&r2=1505471&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java Sun Jul 21 20:41:43 2013
@@ -82,6 +82,6 @@ public class HTTPSampler2 extends HTTPSa
*/
@Override
public void testIterationStart(LoopIterationEvent event) {
- hc.testIterationStart(event);
+ hc.notifyFirstSampleAfterLoopRestart();
}
}
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java?rev=1505471&r1=1505470&r2=1505471&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerProxy.java Sun Jul 21 20:41:43 2013
@@ -36,7 +36,7 @@ public final class HTTPSamplerProxy exte
private transient HTTPAbstractImpl impl;
- private transient Exception initException;
+ private transient volatile boolean notifyFirstSampleAfterLoopRestart;
public HTTPSamplerProxy(){
super();
@@ -61,18 +61,20 @@ public final class HTTPSamplerProxy exte
// so SSL context is to be reused
if (impl == null) { // Not called from multiple threads, so this is OK
try {
- if(initException != null) {
- return errorResult(initException, new HTTPSampleResult());
- }
impl = HTTPSamplerFactory.getImplementation(getImplementation(), this);
} catch (Exception ex) {
return errorResult(ex, new HTTPSampleResult());
}
}
+ // see https://issues.apache.org/bugzilla/show_bug.cgi?id=51380
+ if(notifyFirstSampleAfterLoopRestart) {
+ impl.notifyFirstSampleAfterLoopRestart();
+ notifyFirstSampleAfterLoopRestart = false;
+ }
return impl.sample(u, method, areFollowingRedirect, depth);
}
- // N.B. It's not possible to forward threadStarted() to the implementation class.
+ // N.B. It's not po ssible to forward threadStarted() to the implementation class.
// This is because Config items are not processed until later, and HTTPDefaults may define the implementation
@Override
@@ -95,18 +97,6 @@ public final class HTTPSamplerProxy exte
*/
@Override
public void testIterationStart(LoopIterationEvent event) {
- if (impl == null) { // Not called from multiple threads, so this is OK
- try {
- impl = HTTPSamplerFactory.getImplementation(getImplementation(), this);
- initException=null;
- } catch (Exception ex) {
- initException = ex;
- }
- }
- if(impl != null) {
- // see https://issues.apache.org/bugzilla/show_bug.cgi?id=51380
- // TODO Would need a rename ?
- impl.testIterationStart(event);
- }
+ notifyFirstSampleAfterLoopRestart = true;
}
}