вторник, 31 марта 2020 г.

Siege Load-testing

Siege command line:

siege -f links.csv -c 150 -t15m -d 7 -iv -m "Company1 Mar 31 2020" -l

-c - concurrent users
-t15m - test time
-d 7 - 7sec delay for each user
-i - INTERNET user simulation, hits URLs randomly
-m - MARK, mark the log file with a string
-l - log file, if it isn't specified, then default is used: /var/siege.log

I'm increasing concurrent users number with step 50 within each test.

Tips&tricks:

I got unexpected good results with higher concurrent users number after previous bad with lower ones.
The reason were FPC cache (redis in my case) and OpCache.
So, tricks are cleaning FPC and OpCache caches before each test.
In my case,
redis-cli -p 6380 FLUSHALL 
and restarting php

понедельник, 23 марта 2020 г.

Jmeter plugins

Useful links
https://thetesttherapist.com/2018/07/14/get-max-number-of-user-concurrency-in-jmeter/
https://www.logicify.com/en/blog/apache-jmeter-a-powerful-tool-for-performance-and-load-testing/

Install
https://jmeter-plugins.org/install/Install/
Configure
https://jmeter-plugins.org/wiki/PluginInstall/#Configure-JMeter
Install Active Threads Over Time Listener
https://jmeter-plugins.org/wiki/ActiveThreadsOverTime/
Pick "3 Basic Graphs" in Plugins Manager

Additionally, considering 404 as an acceptable response
https://i.stack.imgur.com/hCLl3.png
https://stackoverflow.com/questions/31317077/how-to-test-an-expected-404-response-with-jmeter


Magento Site Load-Testing via Jmeter

1) gather links of the site;

All needed links are in url_rewrite table. I need the result file with random link lines from the table.
So, I will use RAND() function in select query. It will be enough if I use only category, product, cms_page links, so I will use such entity_type from the table as ones. I need avoid duplicates, so I will use distinct in the query.

    Finally, the result query is
mysql -uuser_name -p -hdatabase -e "select distinct request_path from url_rewrite where entity_type='caterory' or entity_type='product' or entity_type='cms_page' order by RAND();" db_name > load_test.log

2) I noticed that product records begins with slash as the fist character. I need to remove it.
 Such script should help there

./remove_first_slash.sh > load_test-ready.log

#!/bin/bash
for request_path in $(cat load_test.log); do
    tmp_val=$(echo "$request_path" | cut -c -1)
    if [[ "$tmp_val" == "/" ]]; then
        tmp_clear=$(echo "$request_path" | cut -c 2-)
        echo "$tmp_clear"
        continue
    fi
    echo "$request_path"
done

3) use it with Jmeter

Tips&tricks:

I got unexpected good results with higher concurrent users number after previous bad with lower ones.
The reason were FPC cache (redis in my case) and OpCache.
So, tricks are cleaning FPC and OpCache caches before each test.
In my case,
redis-cli -p 6380 FLUSHALL 
and restarting php

пятница, 20 марта 2020 г.

Apache Jmeter

Useful links:
https://jmeter.apache.org/usermanual/build-web-test-plan.html
https://www.blazemeter.com/blog/three-ways-to-generate-random-variables-in-jmeter/
https://www.blazemeter.com/blog/how-run-load-test-50k-concurrent-users/
https://www.blazemeter.com/blog/what%e2%80%99s-the-max-number-of-users-you-can-test-on-jmeter/
https://www.xtivia.com/blog/fixing-jmeter-socket-errors/

Http Cookie Manager

clear cookie

Http Header Manager

User-agent
Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25

CSV Data Set Config

Visible Names: request1

Http request

Path: ${request1}

Results

Vew Result Tree
View Results in Table
Summary Report
Aggregate Report