# Test Designer Performance Scalability: Maximizing the number of concurrent browsers per node

For performance testing, you can maximize the number of concurrent browsers that can be opened in a node.

For AWS EC2 nodes running AIQ, the number of concurrent Chrome browsers that can be assigned per node is around 20 to 30, depending on the application.

The main bottleneck to achieving more concurrent browsers is the speed of the storage volume as measured in IOPS (input/output operations per second). A typical 60GB EBS volume is not rated higher than 3000 IOPS.

To avoid the bottleneck of volume speed, you can leverage **AWS EC2 instances that include NVME SSD volumes**. These types of volumes are very fast, but they are ephemeral storage volumes. Any data stored in these volumes will be lost once the instance is stopped or terminated. Also, the data in the NVME SSD volumes are not saved in the AMI images.

So the process of starting appvance in one of this nodes involves several initial steps which are coded in the provided **nvme\_setup.sh** script recommended for performance nodes. The script does:

1. Mount the NVME SSD storage as a device visible to the OS
2. Copy GraalVM and aiq\_distribution folder to the NVME SSD
3. Modify global.json in aiq\_distribution/NetworkProxy/config/global.json so Chrome browser has the following option added:
    
    <div class="codeSnippet">[Copy](javascript:void(0);)<div class="codeSnippetBody" data-mc-continue="False" data-mc-line-number-start="1" data-mc-use-line-numbers="False">```
    {<br></br>     "name": "experimentalDS3",<br></br>     "value": "--disk-cache-dir=cache||--disk-cache-size=1"      <br></br>}
    ```
    
     </div> </div>
4. Start AIQ from the NVME SSD drive.
 
## Setting up a Amazon Linux 2 node for performance testing

1. Add the following file (nvme\_setup.sh) to the aiq\_distribution folder in the Amazon Linux 2 instance.  
    This script will mount the NVME SSD volume, if found, and then copies the Graalvm and aiq\_distribution folders to the SSD drive.   
    Note: This script assumes the AIQ is located at /opt/aiq/aiq\_distribuition. Edit the script if the AIQ location is different.
    
    <div class="codeSnippet">[Copy](javascript:void(0);)<div class="codeSnippetCaption">nvme\_setup.sh
    
     </div><div class="codeSnippetBody" data-mc-continue="False" data-mc-line-number-start="1" data-mc-use-line-numbers="False" style="mc-code-lang: Bash;">```
    <span style="color: #969896; ">#!/bin/bash</span><br></br><span style="color: #969896; "># This script assumes:</span><br></br><span style="color: #969896; ">#  - using a AWS ec2 instance with an ephemeral SSD NVME volume (for example m5ad, c5d instance families)</span><br></br><span style="color: #969896; ">#  - AIQ is installed at /opt/aiq/aiq_distribution, modify below if not.</span><br></br><span style="color: #969896; ">#  - Linux has NVME volumne drivers (included in Amazon Linux 2 OS)</span><br></br><span style="color: #969896; ">#  - graalvm is installed and $JAVA_HOME is set to its location</span><br></br><span style="color: #a71d5d; ">if</span> [ -e <span style="color: #df5000; ">'/dev/nvme1n1'</span> ] ; <span style="color: #a71d5d; ">then</span><br></br>    <span style="color: #0086b3; ">echo</span> <span style="color: #df5000; ">"Mounting NVME volume as /data"</span><br></br>    sudo file -s /dev/nvme1n1<br></br>    sudo mkfs -t xfs /dev/nvme1n1<br></br>    <span style="color: #a71d5d; ">if</span> [ ! -d <span style="color: #df5000; ">'/data'</span> ] ; <span style="color: #a71d5d; ">then</span><br></br>       sudo mkdir /data<br></br>    <span style="color: #a71d5d; ">fi</span><br></br>    sudo mount /dev/nvme1n1 /data<br></br>    sudo chown ec2-user:ec2-user /data<br></br>    sleep 5<br></br>    FOLDER=$(basename <span style="color: #8f3300; ">$JAVA_HOME</span>)<br></br>    sudo cp -R <span style="color: #8f3300; ">$JAVA_HOME</span> /data<br></br>    <span style="color: #0086b3; ">export</span> JAVA_HOME=/data/<span style="color: #8f3300; ">${FOLDER}</span><br></br>    <span style="color: #0086b3; ">export</span> PATH=/data/<span style="color: #8f3300; ">${FOLDER}</span>/bin:<span style="color: #8f3300; ">$PATH</span><br></br>    <span style="color: #0086b3; ">echo</span> <span style="color: #df5000; ">"JAVA_HOME: <span style="color: #8f3300; ">$JAVA_HOME</span>"</span><br></br>    sudo cp -R /opt/aiq/aiq_distribution /data/aiq_distribution<br></br>    sudo chown -R <span style="color: #8f3300; ">$USER</span>:<span style="color: #8f3300; ">$USER</span> /data<br></br>    <span style="color: #0086b3; ">cd</span> /data/aiq_distribution/TestNode<br></br><span style="color: #a71d5d; ">else</span><br></br>   <span style="color: #0086b3; ">echo</span> <span style="color: #df5000; ">"Skipping mounting /data as instance do not have an NVME volume (/dev/nvme1n1)"</span><br></br><span style="color: #a71d5d; ">fi</span><br></br>bash startup.sh
    ```
    
     </div> </div>
 
2\. Modify global.json in aiq\_distribution/NetworkProxy/config/global.json so that Chrome browsers have following option added:

<div class="codeSnippet" id="bkmrk-copy-%7B%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%22name%22%3A-">[Copy](javascript:void(0);)<div class="codeSnippetBody" data-mc-continue="False" data-mc-line-number-start="1" data-mc-use-line-numbers="False">```
{<br></br>      "name": "experimentalDS3",<br></br>      "value": "--disk-cache-dir=cache||--disk-cache-size=1"      <br></br>}
```

 </div> </div>3\. Start AIQ started using a systemd serviceDo not use /etc/rc.local.   
The systemd service can set the maximum number of open files per process. This is needed in linux distros because the default of 1024 files per process is too low.   
Note: Staring AIQ as a service in this manner is not compatible with the Lab Management automatic upgrade for linux nodes.  
  
To configure the service create a text file named appvance.service in the /etc/systemd/system folder with the following contents. Edit the paths in file as needed to match your configuration.

<div class="codeSnippet" id="bkmrk-copy-%5Bunit%5Ddescripti">[Copy](javascript:void(0);)<div class="codeSnippetBody" data-mc-continue="False" data-mc-line-number-start="1" data-mc-use-line-numbers="False">```
[Unit]<br></br>Description=Start Appvance IQ services<br></br>After=syslog.target<br></br>[Service]<br></br>Environment=PATH=/opt/graalvm-ce-java11-21.3.3.1/bin:/sbin:/bin:/usr/sbin:/usr/bin<br></br>Environment=JAVA_HOME=/opt/graalvm-ce-java11-21.3.3.1<br></br>User=ec2-user<br></br>Type=simple<br></br>LimitNOFILE=10000000<br></br>LimitNPROC=20000<br></br>ExecStart=/bin/bash /opt/aiq/aiq_distribution/TestNode/nvme_setup.sh<br></br>WorkingDirectory=/opt/aiq/aiq_distribution/TestNode<br></br>TimeoutStartSec=0<br></br>[Install]<br></br>WantedBy=multi-user.target
```

 </div> </div>   
After creating above file, execute the following commands in the shell:  
  
`systemctl daemon-reload`  
`systemclt enable appvance`  
  
With the above configuration, an instance with size of m6id.2xlarge AIQ was able to execute a test designer test case using 40 chrome browsers concurrently. An instance with a size of m6id.4xlarge was able to execute 80 chrome browsers concurrently. Please note that specific values might vary depending of the application under test.

<div id="bkmrk-last-updated%3A-may-26">---

Last updated: <span class="mc-variable General.NewDateTimeVariable variable">May 26, 2023</span>

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>

</div>