If you see large number of “Out of Memory” Exceptions in your Load Test results, do not quickly conclude that there is a memory leak! First make sure you are running Agents on 64 Bit OS in a 64 Bit Test Run. Note the two terms with 64 bit in them, which I have explained below.
If you want to scale up the VUsers to 1000 and beyond, one fundamental requirement is that your Agent machines should be of 64 Bit OS. For each Agent machine there is only one process that is running the load test, which needs to spawn thousands of threads. Due to this the memory consumed by Agent process increases linearly as the number of VUsers increase. For a large VUser load, the memory consumed can easily go much beyond 2 GB, which is the limit for any process on a 32 bit OS. This is why for a large VUser volume, Load Test will start throwing “Out of Memory” exceptions. These exceptions are not thrown by OS itself, but the Load Test engine starts throwing these exceptions as soon as the process reaches 1.75 GB.
So, even if your machine has huge memory and CPU, load test will not be able utilize it well. Hence, it is imperative that you change the machine OS to 64 bit.
An important thing to remember once upgrading your OS to 64 bit is to make sure to change the Test Run Settings also to 64 Bit. Otherwise, your Load Test will continue to run in 32 bit mode on 64 Bit OS, and you will not be able to go past the out of memory exceptions. So, if you are browsing the Load Test results, and you see Out of Memory exceptions, be sure to look for “QTAgent32” in the results as shown in the above picture. If you see this, you should go and change the run settings as shown below to 64 Bit. On a 64 bit run, the Agent process is listed as “QTAgent” with no “32” suffix!
Finally here is a graph of a successful 64 bit run for a 1000 Vusers, which clearly shows that the Virtual Bytes of the QTAgent process has gone up close to 5 GB. Notice the quick linear jump when VUsers were increased.