Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

How to handle the big response

Some performance testing script may return a significant amount of response. This situation occurs when you try to download the file and test video in the script especially. Because nGrinder is configured to use at maximum 1GB memory per one process, the each thread can use 100MB if 10 threads per a process are invoked. Considering the variety of other overhead, the maximum response nGrinder can handle might be about 50 mega per request. if the each response is over this amount, nGrinder agent might cause OOM error.
The easiest way to solve this problem is to reduce the number of threads and to increase the number of processes. Instead of this solution, you can make script not to read whole response to save memory if the whole response read is not necessary. Please refer to the following code.


from jarray import zeros
request1 = HTTPRequest()
# set this not to read whole response when the GET/POST is called.
# Make any method call on request1 increase TPS
class TestRunner:
    # initlialize a thread 
    def __init__(self):
    # test method        
    def __call__(self):
        result = request1.GET("")
        # create a buffer.. 
        buf = zeros(1024, 'b')
        # read only 1024 byte from input stream 
        stream = result.getInputStream();


class Test1 {

	public static GTest test;
	public static HTTPRequest request;

	public static void beforeClass() {
		test = new GTest(1, "aa000000");
		request = new HTTPRequest();
		// Make not to read whole response.
		test.record(request);"before process.");
	// Prepare buffer
	byte[] buffer = new byte[1000];

	public void beforeThread() {
		grinder.statistics.delayReports=true;"before thread.");

	public void test(){
		HTTPResponse result = request.GET("");

		// Read only 1000 byte and close the stream
		def stream = result.getInputStream();;

		if (result.statusCode == 301 || result.statusCode == 302) {
			grinder.logger.warn("Warning. The response may not be correct. The response code was {}.", result.statusCode);
		} else {
			assertThat(result.statusCode, is(200));
comments powered by Disqus
Page info
viewed 2553 times
translations en
posted 4 years ago by
updated 4 years ago by
View revisions
Share this article