Performance Testing Learning (Four): monitoring tools, regular tasks, data-driven

Monitoring tools --nmon

nmon is a linux operating system on a wide range of monitoring and analysis tools are there, the information is recorded nmon more comprehensive, they can capture the usage of system resources in real time during system operation, and can output to a file and then generate a data file with the graphical results nmon_analyzer tool.

Enter the following command into the server to download nmon:
wget http://sourceforge.net/projects/nmon/files/nmon_linux_14i.tar.gz
unpack:
tar zxvf nmon_linux_14i.tar.gz extract to the current directory

Enter the command to view system version, and then select the server system associated with the package name change:
CAT / proc / Version


12883356-74879e263bae8da5.png
image.png

Change the name:
mv nmon_x86_64_debian7 nmon
copied to the bin directory:
cp nmon / usr / bin

nmon usage:

nmon -f This is a mandatory parameter, and must come first, meaning that the output file; with this argument, nmon output file name is the default name: hostname_date_time.nmon, is the host name Date Time .nmon
-F <filename> this is the same argument and -f, except that users can define their own file names;
-s data collection frequency, the frequency of which is stored data;
-c data collection frequency
-t most resource-consuming process output data
-h View help
enter the command:
the nmon -f -F demo.nmon -s -t 1 -c 10
-f output
-F file to the output file to demo.nmon
-s frequency per second at
-c statistics 10
-t output most the process of consumption of resources

View demo.nmon file:
CAT demo.nmon


12883356-fa8e9c1b5ccbe6ef.png
image.png
nmon_analyzer Tools

nmon_analyzer role is to analyze the results of nmon data collection, nmon_annlyzer need the help of Excel macros to open and check the results.
First download nmon_annlyzer, Download:
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Power+Systems/page/nmon_analyser
find Download and Links, click download, download the local computer:

12883356-5e65c7a362205092.png
image.png

After downloading unzip is:
12883356-e0d0ed9e175002bb.png
image.png

The demo.nmon in the server downloaded to the local:


12883356-da8d6aea17e5db35.png
image.png

Open: nmon analyser v60.xlsm


12883356-7855efd20a5edd55.png
image.png

Generating demo.nmon.xlsx, open follows:
12883356-ca1e2f6f7100d79f.png
image.png

The document sheet page explains:
SYS_SUMM: system summary page, contains the CPU occupancy rate change information, the change of disk IO and so on;
AAA: some information about the operating system and nmon itself
CPU_ALL: All CPU overview, displaying all CPU average occupancy where
CPU_SUMM: occupancy of each CPU within the execution time
DISKBUSY: hdisk devices each disk group is on average
DISKREAD: average read each disk group
DISKBSIZE: leveling each disk group
DISKWRITE: each disk the average write the set of the
DISKXFER: I / O operations per second per disk group
MEM: memory-related primary information, use, free memory size

Regular tasks

linux system is controlled by the system cron service, including a lot of planning work on linux system, users themselves can set scheduled tasks, linux system provides a user-controlled command scheduled task. This command is crontab command.

crontab start :
Because debian system I use, with /etc/init.d/cron start to start the service
to view /etc/init.d/cron status status
/etc/init.d/cron stop / restart services Stop / Restart service

12883356-274a19b0a778ae51.png
image.png

crontab service privileges :
crontab rights management and file storage cron.allow cron.deny file in. If you can not create in the etc directory.
Enter etc directory, vi cron.allow linux user name can be written in the file:

12883356-3be5ab8c1e166ac9.png
image.png

Creating Success:
12883356-7a316b9211c6239b.png
image.png

cron.deny files are created the same way and cron.allow.

cron.allow file is stored which users are allowed to use crontab.
cron.deny file storage which users are not allowed to use crontab.

crontab usage scenarios Description :
When two files are not present, then only allow the root user to use crontab.
When cron.allow file exists, but cron.deny file does not exist, then the user is only allowed cron.allow file using crontab.
When cron.deny file exists, but cron.allow file does not exist, so long as it is not listed in the cron.deny file users can use crontab.
If both files are present, but a user has in two files, then to cron.allow file is correct, as long as there is cron.allow file that users can use crontab.

crontab using
crontab -e command in the Edit Page input

The basic format: minute hour day month week command
counterparts: moon and peripheral sharing command

Time Unit Description :
The first column represents 00 to 59 minutes per min * or * / 1 indicates
the second column shows 00 to 230 hours indicates 0:00
third column indicates 01 to 31
in the fourth column represents a 01 to 12 month
of five represents the identification number of the week from 0 to 6 (0 for Sunday)
the sixth column shows the command to run

Symbol Description :

  • All values representative of the range
    / mean representing each
  • Representative from a digital to a certain number
    , separated by several different numbers

First check cron service is started:
/etc/init.d/cron Status


12883356-075e34c599769df0.png
image.png

Edit a command:
the crontab -e i Press ESC and enter the command to switch
input:
20 is 14 ~ 4. 6 2 mkdir / QZX
Representative QZX create a directory on June 4, 2:20 pm on Tuesday.
See the directory in the root directory has been created:


12883356-fbd431bb7d5812f3.png
image.png

Enter the command again, remove the directory
27 14 * * * rm -rf ~ / qzx
behalf delete qzx directory in two in the afternoon 27 minutes


12883356-c160189f0db82916.png
image.png

Again View directory has been deleted:
12883356-87789e36c6842e0f.png
image.png

Example
  Example 1: a command execution every 1 minute

Command: * * * * * command

Example 2: 3 and every hour in the first 15 minutes of

Command: 3,15 * * * * command

Example 3: 3 and performed in the first 15 minutes of 8:00 to 11:00

Command: 3,15 8-11 * * * command

Example 4: 3 and performs the first 15 minutes of every day 8:00 to 11:00

命令:3,15 8-11 */2 * * command

实例5:每个星期一的上午8点到11点的第3和第15分钟执行

命令:3,15 8-11 * * 1 command

实例6:每晚的21:30重启smb

命令:30 21 * * * /etc/init.d/smb restart

实例7:每月1、10、22日的4 : 45重启smb

命令:45 4 1,10,22 * * /etc/init.d/smb restart

实例8:每周六、周日的1 : 10重启smb

命令:10 1 * * 6,0 /etc/init.d/smb restart

实例9:每天18 : 00至23 : 00之间每隔30分钟重启smb

命令:0,30 18-23 * * * /etc/init.d/smb restart

实例10:每星期六的晚上11 : 00 pm重启smb

命令:0 23 * * 6 /etc/init.d/smb restart

实例11:每一小时重启smb

命令:* */1 * * * /etc/init.d/smb restart

实例12:晚上11点到早上7点之间,每隔一小时重启smb

命令:* 23-7/1 * * * /etc/init.d/smb restart

实例13:每月的4号与每周一到周三的11点重启smb

命令:0 11 4 * mon-wed /etc/init.d/smb restart

实例14:一月一号的4点重启smb

命令:0 4 1 jan * /etc/init.d/smb restart

实例15:每小时执行/etc/cron.hourly目录内的脚本

命令:01 * * * * root run-parts /etc/cron.hourly

说明:

run-parts这个参数了,如果去掉这个参数的话,后面就可以写要运行的某个脚本名,而不是目录名了

数据驱动

The data driver definitions:
test data is read from a data file, a test method of driving test, the data driver can be understood as a more advanced parameterized. Separation of test data and test code, you can control the testing process data, such as access to information about sex, sex for men walk a branch process, sex for women to go to another branch of the process.
Data-driven test code amount can be reduced, reducing script development and maintenance costs, and ease of maintenance with the modified embodiment, only the test data is not changed over to change the test code to complete the test data is different.

Data-driven usage scenarios:
according to the business scene shunt in complex business processes, creating qualified concurrency scenarios.

Create a scene using data-driven concept jemeter the
first step in configuring jemeter fetch data from the database
into the database to view the data, taking sex data fields in the user table:

12883356-9cf23077d3684f8c.png
image.png

Entering jemeter, adding configure JDBC Connection Configuration element:
12883356-de6249506dc5d193.png
image.png

Add JDBC Request in the sampler:
12883356-6e5da426eaccd3e8.png
image.png

Adding Debug Sampler in the sampler, the results are easy to see:
12883356-cefba840afe184c2.png
image.png

Results of the:
12883356-c45edbaf1a85458a.png
image.png

Since there are 5 data, the sex _ # = 5, each of the results to count the number used, such sex_1 = 1
12883356-ab89f6810ca2af2b.png
image.png

NOTE: If you want to get more information from a database table, set the name of the database in the variable name for created pool JDBC Connection Configuration, the name of the pool set in the JDBC Request for name of the database, sql statement is written with the database name The database table name to query the database information, as shown:


12883356-ac335f3dc58f25c3.png
image.png

12883356-86b59bd9b8731c5a.png
image.png

Step arranged along different branches of the controller if the flow is determined based on the data
added if the controller if the logic controller

12883356-d6e3625b25c0e906.png
image.png

Add sampler Sampler in BeanShell:
System.out.println ( "Sex is a woman");
12883356-a85ced153c8e631d.png
image.png

Add another controller if if if equal to 0 to go this branch:


12883356-995c4652f7c99b3b.png
image.png

12883356-32b8178f0b8a4b90.png
image.png

The results seen in jemeter execution log:


12883356-68af569b93e86489.png
image.png

The third step loop setting parameters determined for all data
open configuration element, counter Found:

12883356-a8847c3583d7a677.png
image.png

12883356-5e7179f89180b075.png
image.png

Open the function assistant:
find __V, enter

sex_${count}

Click Generate, copy

${__V(sex_${count})}
12883356-cd4105c4f4f17deb.png
image.png

Replace if controller, two controllers need to be replaced if:


12883356-33a337c07a64f6dc.png
image.png

Adding the cyclic controller logic controller:


12883356-f5544b6c66fe74f2.png
image.png

Maximum number of loops is $ {sex_ #} is to take the number of pieces of data from the database


12883356-98ab35e63de9092f.png
image.png

The counter, if the controller into the loop controller below, click on the execution to see the results:


12883356-6d109107d8843230.png
image.png

12883356-db065e181a282c60.png
image.png

Guess you like

Origin blog.csdn.net/weixin_34252686/article/details/90877529