Cookies setting

Cookies help us enhance your experience on our site by storing information about your preferences and interactions. You can customize your cookie settings by choosing which cookies to allow. Please note that disabling certain cookies might impact the functionality and features of our services, such as personalized content and suggestions. Cookie Policy

Cookie Policy
Essential cookies

These cookies are strictly necessary for the site to work and may not be disabled.

Information
Always enabled
Advertising cookies

Advertising cookies deliver ads relevant to your interests, limit ad frequency, and measure ad effectiveness.

Information
Analytics cookies

Analytics cookies collect information and report website usage statistics without personally identifying individual visitors to Google.

Information
mageplaza.com

Magento 2 Performance Toolkit for Performance Testing

11-11-2024

Magento 2 Performance Toolkit for Performance Testing

Previous topic, we discussed about Magento 2 Performance Optimization, in this topic, let me introduce Performance toolkit which test Magento 2 store. The toolkit is Jmeter

Performance Toolkit (Jmeter)

Installation Jmeter

jMeter:

– Go to http://jmeter.apache.org/download_jmeter.cgi and download jMeter in the Binary section (pay attention that Java 6 or later is required) – unzip archive

Plugins (only if you want to use additional reports (like graphs)):

– Go to http://jmeter-plugins.org/downloads/all/ and download JMeterPlugins-Standard and JMeterPlugins-Extras

– Unzip them to the appropriate ext directory of your jMeter instance.

– Additional reports can now be added via GUI.

Usage of jmeter

Before running the jMeter tests for the first time, you will need to first use bin/magento setup:performance:generate-fixtures command to generate the test data.

Run via console

A scenario can accept parameters that are described bellow in the format <parameter_name:default_value>:

<host:localhost> URL component 'host' of the application being tested (URL or IP). The default is 'localhost'.

<base_path:/> Base path for the tested site. The default is '/'.

<report_save_path:./> Path where reports will be saved. Reports will be saved in the current working directory by default. The default is './'.

<ramp_period:300> Ramp period (seconds). Period the request will be distributed within. The default is '300'.

<orders:0> Number of orders in the period specified in the current allocation. If <orders> is specified, the <users> parameter will be recalculated. The default is '0'.

<users:100> Number of concurrent users. The recommended  amount is 100. The minimal amount is 10. The default is '100'.

<view_product_add_to_cart_percent:62/> Percentage of users that will only reach the add-to-cart stage. The default is '62'.

<view_catalog_percent:30/> Percentage of users that will only reach the view catalog stage. The default is '30'.

<guest_checkout_percent:4/> Percentage of users that will reach <a href="https://www.mageplaza.com/blog/magento-2-guest-checkout.html" rel="dofollow noopener" target="_blank">the guest checkout stage</a>. The default is '4'.

<customer_checkout_percent:4/> Percentage of users that will reach the (logged-in) customer checkout stage. The default is '4'.

<loops:1/> Number of loops to run. The default is '1'.

<admin_path:admin/> Admin backend path. The default is 'admin'.

<admin-user:admin/> Admin backend user. The default is 'admin'.

<admin-password:123123q/> Admin backend password. The default is '123123q'.

<think_time_deviation:1000> Deviation (ms) for "think time" emulation. The default is '1000'.

<think_time_delay_offset:2000> Constant delay offset (ms) for "think time" emulation. The default is '2000'.

Necessary parameters must be passed to the command line with the “J” prefix: “-J<parameter_name>=<parameter_value>

Example:

> cd /directory_of_jMeter/bin/

> jmeter -n -t /path_to_benchmark_file/benchmark.jmx -Jhost=magento2.dev -Jbase_path=/ -Jusers=100 -Jramp_period=300 -Jreport_save_path=./

Run via GUI

– Open the jMeter/bin directory and run jmeter.bat

– Click in menu File -> Open (Ctrl+O) and select file; or drag and drop benchmark.jmx file in the opened GUI.

On the first tab ‘Test Toolkit’ you can change ‘User Defined variables’ like as <host>, <users>, <ramp_period>, <orders>, <report_save_path>.

For running script click “Start” (green arrow in the top menu).

Results of running (Report types)

After running via GUI you can see the result of working in the left panel. Choose the corresponding report.

After running the script via console report will be generated in the path that has been specified in <report_save_path>.

Threads

jMeter script consists of five threads. Setup thread and four user threads.

The percentage ratio between threads is as follows:

Browsing, adding items to the cart, and abandoning the cart (BrowsAddToCart suffix in reports) - 62%

Just browsing (BrowsAddToCart suffix in reports) - 30%

Browsing, adding items to the cart, and check out it as guest (GuestChkt suffix in reports) - 4%

Browsing, adding items to the cart, and checkout as a registered customer (CustomerChkt suffix in reports) - 4%

About reports:

Summary Report

The report contains aggregated information about threads.

Report file name is {report_save_path}/summary-report.log

Details http://jmeter.apache.org/usermanual/component_reference.html#Summary_Report

Detailed URLs report

The report contains information about URLs.

Pay attention that the URL is displayed only in the generated report file (in GUI, the URL is not displayed).

The report file name is {report_save_path}/detailed-urls-report.log (can be opened in CSV format).

Details http://jmeter.apache.org/usermanual/component_reference.html#View_Results_in_Table

About other types read on

http://jmeter.apache.org/usermanual/component_reference.html

Performance Optimization Tools

If your company is searching for professional shortcut tools to cut down performance time conveniently, Mageplaza is happy to introduce one useful extension for both of Magento 1&2 stores, comes from one of our partners PotatoCommerce, which improves the rapidity by optimizing JS, CSS, and HTML content effortlessly.

Say Goodbye to Slow Page Loading

Get Website Performance Audit. Speed it up - earn more sales & customer satisfaction.

Get Website Audit
pdf shopping season


Table of content


    Related Post

    Website Support
    & Maintenance Services

    Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.

    Get Started
    mageplaza services