Part 5: Generate sample data for performance testing

Welcome to our serial articles on Magento 2 Command Lines (CLI)!

You know Magento 2 has provided the powerful command-line interface tool (CLI). It allows you to perform tasks including installation, configuration, database backups, compiling LESS etc. Today I will show you how to generate the sample data for performance testing. Before starting this guide, please review our previous posts.

  1. Magento Performance Toolkit

  • Magento 2 has provided the performance toolkit which helps us to generate sample data for testing performance. It locates at [Magento_Folder]/setup/performance-toolkit. You should view the README.txt in performance toolkit for more information.
  • There are four profiles in performance toolkit which is used to generate different data size: small, medium, large and extra large. You can see configuration files of these profiles in folder /setup/performance-toolkit/profiles/ce. Below is a part of Small profile XML configuration file:

Data

Small Profile Medium Profile Large Profile Extra Large Profile
websites 1 1 3 5
store_groups 1 2 3 5
store_views 1 2 3 5
simple_products 800 16,000 400,000 800,000
configurable_products 50 1,000 25,000 50,000
categories 30 300 1,000 3,000
categories_nesting_level 3 3 3 6
catalog_price_rules 10 20 50 100
cart_price_rules 10 20 50 100
cart_price_rules_floor 2 2 2 5
customers 20 200 2,000 5,000
tax_rates 40,000 40,000 40,000 40,000
orders 80 1,600 40,000 80,000
  • You can see that Magento defines the size of sample data to generate in configuration file of profile. The table below will show you the data size of all profiles.
  1. Run the data generator

  • Below is the command to generate testing data
php bin/magento setup:perf:generate-fixtures {path to profile}
  • Generate data using large profile
php bin/magento setup:perf:generate-fixtures setup/performance-toolkit/ce/large.xml
  • The output is below
Generating profile with following params:

|- Websites: 3

|- Store Groups: 3

|- Store Views: 3

|- Categories: 1,000

|- Simple products: 400,000

|- Configurable products: 1,000

|- Customers: 2,000

|- Cart Price Rules: 50

|- Catalog Price Rules: 50

|- Orders: 40,000

Generating websites, stores and store views…  done in <time>

Generating categories…  done in <time>

Generating simple products…  done in <time>

Generating configurable EAV variations…  done in <time>

… more …

Check here for Magento extensions and Magento 2 extensions now !

We also contribute great content of Magento Tutorial for Magento 1.x.

DON'T MISS THE CHANCE!

magento tutorial

How to Enable Google Analytics in Magento 2
How to Use all Commands in Magento 2 CLI (Part 7)

Leave a Reply

Your email address will not be published. Required fields are marked *