Skip to content

Stripping success result in order to speed up transmit in distributed test mode #6410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin/jmeter.properties
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,8 @@ wmlParser.types=text/vnd.wap.wml
# set this property to false
#sample_sender_strip_also_on_error=true

sample_sender_strip_if_success=false

# Remote batching support
# Since JMeter 2.9, default is MODE_STRIPPED_BATCH, which returns samples in
# batch mode (every 100 samples or every minute by default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class DataStrippingSampleSender extends AbstractSampleSender implements S
private final SampleSender decoratedSender;
// Configuration items, set up by readResolve
private transient volatile boolean stripAlsoOnError;
private static boolean stripIfSuccess = JMeterUtils.getPropDefault("sample_sender_strip_if_success", false);


/**
Expand Down Expand Up @@ -126,6 +127,24 @@ private static void stripContent(SampleResult result, int level) {
private static void stripResponse(SampleResult result) {
result.setBytes(result.getBytesAsLong());
result.setResponseData(EMPTY_BA);

if (stripIfSuccess && result.isSuccessful()) {
result.setSentBytes(result.getSentBytes());
result.setSamplerData(null);
result.setRequestHeaders(null);

result.setBodySize(result.getBodySizeAsLong());
//result.setDataType(null);
//result.setDataEncoding(null);

result.setHeadersSize(result.getHeadersSize());
result.setResponseHeaders(null);

//result.setURL(null);

//result.setResponseMessage(null);
//result.setResponseCode(null);
}
}

/**
Expand All @@ -138,10 +157,12 @@ private static void stripResponse(SampleResult result) {
protected Object readResolve() throws ObjectStreamException{
if (isClientConfigured()) {
stripAlsoOnError = clientConfiguredStripAlsoOnError;
stripIfSuccess = JMeterUtils.getPropDefault("sample_sender_strip_if_success", false);
} else {
stripAlsoOnError = SERVER_CONFIGURED_STRIP_ALSO_ON_ERROR;
}
log.info("Using DataStrippingSampleSender for this run with stripAlsoOnError: {}", stripAlsoOnError);
log.info("Using DataStrippingSampleSender for this run with stripIfSuccess: {}", stripIfSuccess);
return this;
}
}
Loading