Click Fraud Protection
PHP related blog, freelancer to hire!

How to – magento performance toolkit – part 1

Ben Marks tweeted that Magento Performance Toolkit is available on github – https://github.com/magento/magento-performance-toolkit

This is absolutely amazing news, as it has two very interesting functions

  1. first it can provision your vanilla magento installation and load all categories, products, taxes, rules
  2. secondly – it gives you ready to use Apache Jmeter script for load testing

It is easy as creating XML profile with the quantities you need to be done, running one php script and couple (or more) minutes later it is ready.

So how you do it?

First obtain and install magento version you want to test – currently supported versions are 1.12, 1.13 and 1.14 – I’m sure you can tweak it to use it on CE or other versions, but this is separate topic.

Make sure you DO NOT install any sample data – this is not required as MPT will generate all data for you.

Lets say you installed your magento into /var/www/magento-website/public_html/

Then clone MPT somewhere

cd  /var/www/magento-website/
git clone https://github.com/magento/magento-performance-toolkit.git

Lets make a dir for new tool

mkdir -p  /var/www/magento-website/public_html/dev/tools/performance_toolkit

Copy correct version of toolkit into your project

cp -pr /var/www/magento-website/magento-performance-toolkit/1.14/* /var/www/magento-website/public_html/dev/tools/performance_toolkit/

After doing that in /var/www/magento-website/public_html/dev/tools/performance_toolkit/ you should have

 

fixtures <- php scripts to generate data
framework <- actual framework
profiles <– those are predefined xml profiles for the data to generate
benchmark.jmx <– this is Apache jMeter performance testing script
generate.php <– this is the script to generate magento data

 

At this point you need a XML file – so lets copy profiles/small.xml as ours

cd  /var/www/magento-website/public_html/dev/tools/performance_toolkit/
cp profiles/small.xml profiles/custom.xml

Feel free to modify the new file as you need

as example:

<config>
<profile>
<websites>3</websites> <!– Number of websites to generate –>
<store_groups>6</store_groups> <!–Number of stores–>
<store_views>18</store_views> <!– Number of store views –>
<simple_products>1000</simple_products> <!– Simple products count –>
<configurable_products>2000</configurable_products> <!–Configurable products count (each configurable has 3 simple products as options, that are not displayed individually in catalog) –>
<categories>300</categories> <!– Number of categories to generate –>
<categories_nesting_level>3</categories_nesting_level> <!– Nesting level for categories –>
<catalog_price_rules>15</catalog_price_rules> <!– Number os catalog price rules –>
<catalog_target_rules>20</catalog_target_rules> <!– NUmber of catalog target rules –>
<cart_price_rules>100</cart_price_rules> <!– Number of shopping cart price rules –>
<cart_price_rules_floor>3</cart_price_rules_floor> <!– The price rule condition: minimum products amount in shopping cart for price rule to be aaplied –>
<customers>200</customers> <!– Number of customers to generate –>
</profile>
 </config>

In above example we want 3 websites, each website will have 2 store groups (so we need 2×3=6 groups) and then each store group should have 3 store views (6 groups x 3 store views = 18)

Interesting part is with configs and simple products – in above example in total we will have 7000 simples and 2000 configs – 9000 products. Why???

Because each config needs 3 simple as options – so 2000 x 3 = 6000 simple + 1000 simple is 7000 simple products.

Those 7000 will be spread across 300 categories – each main category will have 3 subcategories. Other options are pretty obvious.

If you want to change logic how data is generated – look into fixtures/configurable_products.php

 

Ok so your xml is ready – time to generate some data. At this point your vanilla magento should be up and running.

so now time to run it.

cd  /var/www/magento-website/public_html/dev/tools/performance_toolkit/
php generate.php --profile=profiles/custom.xml --tmp_dir=/tmp/

 

you will see progress while it runs and also you can login to your magento admin and see how data grows nicely there.

In the second part we can have a look at running performance testing

Leave a Reply