Bug 54777 - Improve Performance of default ResultCollector

Add saving.autoflush
Bugzilla Id: 54777

git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1464580 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Philippe Mouawad 2013-04-04 14:51:30 +00:00
parent 7f30f68e32
commit 79a044f851
3 changed files with 15 additions and 1 deletions

View File

@ -448,6 +448,12 @@ log_level.jorphan=INFO
# Prefix used to identify filenames that are relative to the current base
#jmeter.save.saveservice.base_prefix=~/
# AutoFlush on each line written in XML or CSV output
# Setting this to true will result in less test results data loss in case of Crash
# but with impact on performances, particularly for intensive tests (low or no pauses)
# Since JMeter 2.10, this is false by default
#saving.autoflush=false
#---------------------------------------------------------------------------
# Settings that affect SampleResults
#---------------------------------------------------------------------------

View File

@ -51,6 +51,7 @@ import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.TestStateListener;
import org.apache.jmeter.testelement.property.BooleanProperty;
import org.apache.jmeter.testelement.property.ObjectProperty;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jmeter.visualizers.Visualizer;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.jorphan.util.JMeterError;
@ -95,6 +96,9 @@ public class ResultCollector extends AbstractListenerElement implements SampleLi
private static final String SUCCESS_ONLY_LOGGING = "ResultCollector.success_only_logging"; // $NON-NLS-1$
/** AutoFlush on each line */
private static final boolean SAVING_AUTOFLUSH = JMeterUtils.getPropDefault("saving.autoflush", false); //$NON-NLS-1$
// Static variables
// Lock used to guard static mutable variables
@ -420,7 +424,7 @@ public class ResultCollector extends AbstractListenerElement implements SampleLi
}
}
writer = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(filename,
trimmed)), SaveService.getFileEncoding("UTF-8")), false); // $NON-NLS-1$
trimmed)), SaveService.getFileEncoding("UTF-8")), SAVING_AUTOFLUSH); // $NON-NLS-1$
log.debug("Opened file: "+filename);
files.put(filename, new FileEntry(writer, saveConfig));
} else {

View File

@ -86,6 +86,10 @@ This does not affect JMeter operation.
<p>SMTP Sampler now uses eml file subject if subject field is empty</p>
<p>With this version autoFlush has been turned off on PrintWriter in charge of writing test results.
This results in improved throughput for intensive tests but can result in more test data loss in case
of JMeter crash (very rare). To revert to previous behaviour set saving.autoflush property to true. </p>
<!-- =================== Bug fixes =================== -->
<h2>Bug fixes</h2>