Hi,
I have nGrinder controller version 3.0.4, nGrinder agent version 3.0.3, Apache Tomcat Version 6.0.36 and JDK version 1.7.0_10. I created a script and configured a performance test for the script. The number of threads and processes populated as default is 2 each On selected 4 "Vuser per agent". Hence, only 2 threads are created while running the test. I calculated this by printing the thread numbers of the threads generated. 4 threads are created only when I select 4 threads and 1 process (=4 Vusers). How is the load distributed on entering some number for Vusers? Could anyone explain how the threads and VUsers work in nGrinder in detail. Thanks Viji |
Administrator
|
If you select 4 in vuser per agent field, it will be divided in 2 processes and each process will run two threads. You may have dumped only 1 process. You have to dump all processes to check the total thread count.
See process_and_thread_policy.js section in http://www.cubrid.org/wiki_ngrinder/entry/advanced-ngrinder-controller-configuration |
Administrator
|
In reply to this post by viji1188
Among the logs per multiple processes. Only one log file is passed to contoller due to the size
http://www.cubrid.org/wiki_ngrinder/entry/how-to-adjust-logger-level It might make you confused |
The following is my sample code:
from net.grinder.script.Grinder import grinder from net.grinder.script import Test from net.grinder.plugin.http import HTTPRequest #import csv test1 = Test(1, "Test1") request1 = test1.wrap(HTTPRequest()) class TestRunner: def __init__(self): grinder.statistics.delayReports=True global gfile gfile = open("F:/Test.csv", "r") def __call__(self): line = str(gfile.readline()) if(line==""): gfile.seek(0) line = str(gfile.readline()) userID = str(line[0]) email = str(line[2]) num = grinder.threadNumber grinder.logger.info(" vi-line" + " " + userID + " " + email + " threadnum " + str(num)) filename = str(num) file = open(("F:/User" + filename+ ".txt"), "a") file.write(" Hello thread number is " + str(num) + " " + userID + " " + email) file.close() def __del__(self): gfile.close() This code creates a file per thread. When I select 4 Vusers per agent i.e. 1 process and 4 threads, then it creates 4 files (as per the code). Whereas, as default, when 2 processes and 2 threads are configured in test, then only 2 files are created. As per my assumption, in 2 processes with 2 threads each may have the thread numbers as 0 and 1. Do the threads with same number but different processes overwrite each other? As we have "grinder.threadNumber" to get the thread number, do we have any command to get the process number and corresponding thread number running in the program? |
Administrator
|
You can use grinder.processNumber to print out process number. :-)
I've tested it with following script. It perfectly works. ================================================== from net.grinder.script.Grinder import grinder from net.grinder.script import Test test1 = Test(1, "Test1") class TestRunner: def __init__(self): grinder.statistics.delayReports=True def __call__(self): pnumber = str(grinder.processNumber) tnumber = str(grinder.threadNumber) filename = pnumber + "_" + tnumber; file = open(("F:/User_" + filename+ ".txt"), "a") file.write(" Hello process/thread number is %s/%s" % (pnumber, tnumber)) file.close() |
In reply to this post by viji1188
Hi Viji,
In nGrinder, the total number of virtual users (VUsers) is calculated as: **VUsers = number of processes × number of threads** So if you set 2 processes and 2 threads, you’ll get 4 VUsers. But in your case, with 2 as default for both, it results in only 4 VUsers regardless of what you enter in the "Vuser per agent" field unless you adjust the thread/process count directly. The "Vuser per agent" field is more of a guide than a strict override—it doesn't automatically update the thread/process settings unless you're using the test configuration wizard or templates that scale accordingly. You’ll get the desired load only by manually setting the appropriate combination of processes and threads. Bei so komplexen Testszenarien lohnt es sich, mit Übersicht und Struktur zu arbeiten – genauso wie ein durchdachtes frühlingskleid im Alltag für Klarheit und Leichtigkeit sorgt, bringt eine präzise Vorbereitung auch im Performance-Testing die besten Ergebnisse. |
Free forum by Nabble | Edit this page |