Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

STEP1: Preparing the Magento server

  • Install a clean Magento test site

  • Generating test data for example

    Code Block
    bin/magento setup:perf:generate-fixtures /var/www/html/magento2/setup/performance-toolkit/profiles/ce/small.xml
  • Configure Magento site for benchmarking:

  1. Go to Stores > Configuration > General > Web > Search Engine Optimization - Use Web Server Rewrites “Yes”

  2. Go to Stores > Configuration > Catalog > Catalog > Storefront - Use Flat Catalog Category “Yes”
    Use Flat Catalog Product “Yes”

  3. Go to Stores > Configuration > Advanced > Admin > Security - Admin Account Sharing “Yes”

  4. Go to Stores > Configuration > Advanced > Developer - JavaScript Settings -Merge JavaScript Files “Yes”
    Merge CSS Files “Yes”

  5. Indexers setup in "Update by schedule" mode: Follow System > Tool > Index Management Set "Update by schedule" for all idexers

  6. Save configuration, perform reindex and clean Cache

STEP2: Installation of JMeter

  • Prerequisites:

  1. Check if Java is already installed (install if not)

    Code Block
    java -version
  2. Install Apache Web Server

    Code Block
    apt-get install apache2 -y
    systemctl start apache2
    systemctl enable apache2
  • Install Apache JMeter

  1. Go to the Download Apache JMeter page and download JMeter in the Binaries section

  2. Unzip the archive

  3. Install the JSON plugin for JMeter

    Code Block
    curl -k -O https://jmeter-plugins.org/files/packages/jpgc-json-2.6.zip
    unzip jpgc-json-2.6.zip -d ~/apache-jmeter-5.5/

STEP3: Run JMeter

  • Run scenario via console

There are two JMeter scenarios located in setup/performance-toolkit folder: benchmark.jmx and benchmark_2015.jmx (legacy version).

The following parameters can be passed to the benchmark.jmx scenario:

Parameter Name

Default Value

Description

host

localhost

URL component 'host' of application being tested (URL or IP).

base_path

/

Base path for tested site.

admin_path

admin

Admin backend path.

admin_user

admin

Admin backend user.

admin_password

123123q

Admin backend password.

customer_password

123123q

Storefront customer password.

customers_page_size

50

Page size for customers grid in Magento Admin.

files_folder

./files/

Path to various files that are used in scenario (setup/performance-toolkit/files).

loops

1

Number of loops to run.

frontendPoolUsers

1

Total number of Frontend threads.

adminPoolUsers

1

Total number of Admin threads.

browseCatalogByGuestPercentage

30

Percentage of threads in Frontend Pool that emulate catalog browsing activities.

browseCatalogByCustomerPercentage

0

Percentage of threads in Frontend Pool that emulate catalog browsing activities.

siteSearchPercentage

30

Percentage of threads in Frontend Pool that emulate catalog search activities.

searchQuickPercentage

60

Percentage of threads in Frontend Pool that emulate catalog search activities.

searchQuickFilterPercentage

30

Percentage of threads in Frontend Pool that emulate catalog search activities.

searchAdvancedPercentage

10

Percentage of threads in Frontend Pool that emulate catalog search activities.

checkoutByGuestPercentage

4

Percentage of threads in Frontend Pool that emulate checkout by guest.

checkoutByCustomerPercentage

4

Percentage of threads in Frontend Pool that emulate checkout by customer.

addToCartByGuestPercentage

28

Percentage of threads in Frontend Pool that emulate abandoned cart activities.

addToWishlistPercentage

2

Percentage of threads in Frontend Pool that emulate adding products to Wishlist.

compareProductsPercentage

2

Percentage of threads in Frontend Pool that emulate products comparison.

productCompareDelay

0

Delay (s) between iterations of product comparison.

promotionRulesPercentage

10

Percentage of threads in Admin Pool that emulate creation of promotion rules.

adminPromotionsManagementDelay

0

Delay (s) between creation of promotion rules.

adminCategoryManagementPercentage

10

Percentage of threads in Merchandising Pool that emulate category management activities.

adminProductEditingPercentage

35

Percentage of threads in Merchandising Pool that emulate product editing.

adminProductCreationPercentage

25

Percentage of threads in Merchandising Pool that emulate creation of products.

adminPromotionRulesPercentage

15

Percentage of threads in Admin Pool that emulate admin rules creating activities.

adminCategoryManagementDelay

0

Delay (s) between iterations of category management activities.

apiProcessOrders

5

Number of orders for process in Admin API - Process Orders.

adminEditOrderPercentage

15

Percentage of threads in Admin Pool that emulate order edit.

csrPoolUsers

0

Users of Customer Support Request (CSR) Pool.

othersPoolUsers

0

Users of Others Pool.

browseCustomerGridPercentage

10

Percentage of threads in CSR Pool that emulate customers browsing activities.

adminCreateOrderPercentage

70

Percentage of threads in CSR Pool that emulate creation of orders.

adminReturnsManagementPercentage

20

Percentage of threads in CSR Pool that emulate creation/processing of returns.

adminCreateProcessReturnsDelay

0

Delay (s) between creation of returns.

wishlistDelay

0

Delay (s) between adding products to Wishlist.

categories_count

100

Total number of categories that are be used in scenario.

simple_products_count

30

Total number of simple products that are be used in scenario.

Parameters must be passed to the command line with the J prefix:

-J{parameter_name}={parameter_value}

For example, you can run the B2C scenario via console with 90 threads for the Frontend Pool and 10 threads for the Admin Pool:

Code Block
cd {JMeter path}/bin/
jmeter -n -t {path to performance toolkit}/benchmark.jmx -j ./jmeter.log -l ./jmeter-results.jtl -Jhost=magento2.dev -Jbase_path=/ -Jadmin_path=admin -JfrontendPoolUsers=90 -JadminPoolUsers=10

  • Run JMeter scenario via GUI

Note: Use the GUI mode only for scenario debugging and viewing reports. Use console mode for real-life load testing, because it requires significantly fewer resources.

  1. Change directories and run Jmeter

    Code Block
    cd {JMeter path}/bin/
    ./jmeter

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

In the root node (Performance Test Plan) in the left panel, you can change User Defined Variables listed in the previous section. To run a script, click the Start button (green arrow in the top menu).

...