Performance testing

Performance tests can be found under the setup/performance-toolkit/ directory. These tests require Apache JMeter to be installed and are available on the console via the jmeter command. Apache JMeter can be downloaded and installed by following the instructions at http://jmeter.apache.org.

The crux of the performance test is defined in the benchmark.jmx file, which can be opened in the JMeter GUI tool, as shown in the following screenshot:

Performance testing

As shown in the preceding screenshot, the default benchmark.jmx tests are sectioned into three thread groups that are named setUp Thread Group, Customer Checkout, and tearDown Thread Group. We might want to additionally click on each group and configure it with some extra parameters, thus possibly changing Number of Threads (users), as shown in the following screenshot. We can then simply save the changes as modifications to the benchmark.jmx file or a file with new name:

Performance testing

We can manually trigger a performance test from the console without using a GUI interface by running the following command:

jmeter -n 
-t /Users/branko/www/magento2/setup/performance-toolkit/benchmark.jmx 
-l /Users/branko/Desktop/jmeter-tmp/results.jtl 
-Jhost="magento2.ce" 
-Jbase_path="/" 
-Jreport_save_path="/Users/branko/report" 
-Jloops=2 
-Jurl_suffix=".html" 
-Jcustomer_email="[email protected]" 
-Jcustomer_password="abc123" 
-Jadmin_path="/admin_nwb0bx" 
-Jadmin-user="john" 
-Jadmin-password="abc123" 
-Jresponse_time_file_name="/Users/branko/report/AggregateGraph.csv" 
-Jsimple_product_url_key="simple-product-1" 
-Jsimple_product_name="Simple Product 1" 
-Jconfigurable_product_url_key="configurable-product-1" 
-Jconfigurable_product_name="Configurable Product 1" 
-Jcategory_url_key="category-1" 
-Jcategory_name="Category 1" 
-Jsleep_between_steps=50

The console parameters that are listed here and which start with -J also match the names of the Used Defined Variables test toolkit, as shown in the preceding screenshot. We need to be careful and set them according to the Magento installation. The -n parameter instructs jmeter to run in the run nongui mode. The -t parameter is where we set the path of the test (.jmx) file to run. The -l parameter sets the file where we need to log samples to.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.30.162