Rate This Document
Findability
Accuracy
Completeness
Readability

Sysbench 0.5

Use the Sysbench 0.5 client to log in to the MySQL database server to perform a pressure test. The test can be performed by running scripts or commands.

Running Scripts

  1. Download the script package and save it to the /home directory.
    1
    2
    cd /home/
    wget https://mirrors.huaweicloud.com/kunpeng/archive/kunpeng_solution/database/scripts/sysbench-0.5-script.zip --no-check-certificate
    

    You can also use a browser to download the script package and upload it to the /home directory. Download URL: https://mirrors.huaweicloud.com/kunpeng/archive/kunpeng_solution/database/scripts/sysbench-0.5-script.zip

  2. Decompress the package and modify the script.
    1. Decompress the script package.
      1
      unzip sysbench-0.5-script.zip
      
    2. Go to the script directory.
      1
      cd /home/sysbench-0.5-script
      
    3. Modify the parameters in the runall.sh script as required. See Table 1.
      1
      vi runall.sh
      
      Table 1 Script parameters

      Parameter

      Description

      host='192.168.221.156'

      Server IP address

      -P 3306

      Port number of the database

      user='root'

      Username of the database

      password='123456'

      Password of the database

      database='sysbench'

      Name of the database. Enter a value according to the actual situation.

      count='100'

      Number of databases

      size='1000000'

      Table size

      numactl -C 80-127

      Ensures that the Sysbench command is isolated from the NIC interrupt in CPU.

    4. Modify the parameters of the nine models in sequence. Modify the following parameters as well:
      • Set the number of concurrent threads to 64, 128, 256, 512.
      • Set the execution time of each concurrent task to 120 seconds (TIME=${TIME:-120}).
      • Add --forced-shutdown=1 before run and $CMD.
        1
        --forced-shutdown=1
        

      Open the scripts of the nine models.

      1
      2
      3
      4
      5
      6
      7
      8
      9
      vi test_oltp_distinct.sh
      vi test_oltp_index.sh
      vi test_oltp_nonindex.sh
      vi test_oltp_order.sh
      vi test_oltp_point.sh
      vi test_oltp_simple.sh
      vi test_oltp_sum.sh
      vi test_oltp_delete.sh
      vi test_oltp_mix.sh
      
  3. Execute the model script.

    If the database is not restarted before the write scenario (INDEX, NONINDEX, or DELETE) is executed, you need to execute the script of the OLTP MIX scenario once for preheating.

    • Method 1: Run the script of each model in sequence. Set CPU core binding and related parameters as required.
      1. Modify the script permission to obtain the execute permission on the file.
        1
        2
        cd /home/sysbench-0.5-script
        chmod 777 *
        
      2. Execute the model script.
        OLTP DISTINCT read scenario:
        1
        numactl -C 80-127 ./test_oltp_distinct.sh -h 192.168.221.156 -P 3306 -u root -p 123456 -D sysbench -C 100 -S 1000000 -t 512 -c run
        

        OLTP INDEX write scenario:

        1
        numactl -C 80-127 ./test_oltp_index.sh -h 192.168.221.156 -P 3306  -u root -p 123456  -D sysbench -C 100 -S 1000000 -t 512 -c run
        

        OLTP NONINDEX write scenario:

        1
        numactl -C 80-127 ./test_oltp_nonindex.sh -h 192.168.221.156 -P 3306  -u root -p 123456 -D sysbench -C 100 -S 1000000 -t 512 -c run
        

        OLTP ORDER read scenario:

        1
        numactl -C 80-127 ./test_oltp_order.sh -h 192.168.221.156  -P 3306  -u root -p 123456  -D sysbench -C 100 -S 1000000 -t 512 -c run
        

        OLTP POINT read scenario:

        1
        numactl -C 80-127 ./test_oltp_point.sh -h 192.168.221.156 -P 3306  -u root -p 123456  -D sysbench -C 100 -S 1000000 -t 512 -c run
        

        OLTP SIMPLE read scenario:

        1
        numactl -C 80-127 ./test_oltp_simple.sh  -h 192.168.221.156  -P 3306  -u root -p 123456 -D sysbench -C 100 -S 1000000 -t 512 -c run
        

        OLTP SUM read scenario:

        1
        numactl -C 80-127 ./test_oltp_sum.sh -h 192.168.221.156  -P 3306  -u root -p 123456  -D sysbench -C 100 -S 1000000 -t 512 -c run
        

        OLTP DELETE write scenario:

        1
        numactl -C 80-127 ./test_oltp_delete.sh -h 192.168.221.156  -P 3306  -u root -p 123456  -D sysbench -C 100 -S 1000000 -t 512 -c run
        

        OLTP MIX mixed scenario:

        1
        numactl -C 80-127 ./test_oltp_mix.sh -h 192.168.221.156  -P 3306  -u root -p 123456  -D sysbench -C 100 -S 1000000 -t 512 -c run
        
    • Method 2: Execute the script in full mode.
      1
      2
      3
      cd /home/sysbench-0.5-script
      chmod 777 *
      sh runall.sh > result-arm.txt
      

    After the model script is executed, the test result is saved in the result-arm.txt file.

Running Commands

Run the commands of the nine models listed in Table 2 respectively. See Table 3 to modify the parameters in the commands as required.

Table 2 Models and corresponding commands

Model

Command

OLTP DISTINCT

/home/sysbench-0.5/sysbench/sysbench --test=/home/sysbench-0.5/sysbench/tests/db/oltp.lua --db-driver=mysql --debug=off --mysql-db=sysbench --mysql-password=123456 --oltp-tables-count=100 --oltp-distinct-ranges=1 --oltp-index-updates=0 --oltp-non-index-updates=0 --oltp-order-ranges=0 --oltp-point-selects=0 --oltp-simple-ranges=0 --oltp-sum-ranges=0 --oltp_delete_inserts=0 --oltp-table-size=1000000 --num-threads=512 --max-requests=0 --max-time=60 --oltp-auto-inc=off --mysql-engine-trx=yes --oltp-test-mod=complex --mysql-host=192.168.222.120 --mysql-port=3306 --mysql-user=root --oltp-user-delay-min=10 --oltp-user-delay-max=100 --report-interval=10 --forced-shutdown=1 run

OLTP INDEX

/home/sysbench-0.5/sysbench/sysbench --test=/home/sysbench-0.5/sysbench/tests/db/oltp.lua --db-driver=mysql --debug=off --mysql-db=sysbench --mysql-password=123456 --oltp-tables-count=100 --oltp-distinct-ranges=0 --oltp-index-updates=1 --oltp-non-index-updates=0 --oltp-order-ranges=0 --oltp-point-selects=0 --oltp-simple-ranges=0 --oltp-sum-ranges=0 --oltp_delete_inserts=0 --oltp-table-size=1000000 --num-threads=512 --max-requests=0 --max-time=60 --oltp-auto-inc=off --mysql-engine-trx=yes --oltp-test-mod=complex --mysql-host=192.168.222.120 --mysql-port=3306 --mysql-user=root --oltp-user-delay-min=10 --oltp-user-delay-max=100 --report-interval=10 --forced-shutdown=1 run

OLTP NONINDEX

/home/sysbench-0.5/sysbench/sysbench --test=/home/sysbench-0.5/sysbench/tests/db/oltp.lua --db-driver=mysql --debug=off --mysql-db=sysbench --mysql-password=123456 --oltp-tables-count=100 --oltp-distinct-ranges=0 --oltp-index-updates=0 --oltp-non-index-updates=1 --oltp-order-ranges=0 --oltp-point-selects=0 --oltp-simple-ranges=0 --oltp-sum-ranges=0 --oltp_delete_inserts=0 --oltp-table-size=1000000 --num-threads=512 --max-requests=0 --max-time=60 --oltp-auto-inc=off --mysql-engine-trx=yes --oltp-test-mod=complex --mysql-host=192.168.222.120 --mysql-port=3306 --mysql-user=root --oltp-user-delay-min=10 --oltp-user-delay-max=100 --report-interval=10 --forced-shutdown=1 run

OLTP ORDER

/home/sysbench-0.5/sysbench/sysbench --test=/home/sysbench-0.5/sysbench/tests/db/oltp.lua --db-driver=mysql --debug=off --mysql-db=sysbench --mysql-password=123456 --oltp-tables-count=100 --oltp-distinct-ranges=0 --oltp-index-updates=0 --oltp-non-index-updates=0 --oltp-order-ranges=1 --oltp-point-selects=0 --oltp-simple-ranges=0 --oltp-sum-ranges=0 --oltp_delete_inserts=0 --oltp-table-size=1000000 --num-threads=512 --max-requests=0 --max-time=60 --oltp-auto-inc=off --mysql-engine-trx=yes --oltp-test-mod=complex --mysql-host=192.168.222.120 --mysql-port=3306 --mysql-user=root --oltp-user-delay-min=10 --oltp-user-delay-max=100 --report-interval=10 --forced-shutdown=1 run

OLTP POINT

/home/sysbench-0.5/sysbench/sysbench --test=/home/sysbench-0.5/sysbench/tests/db/oltp.lua --db-driver=mysql --debug=off --mysql-db=sysbench --mysql-password=123456 --oltp-tables-count=100 --oltp-distinct-ranges=0 --oltp-index-updates=0 --oltp-non-index-updates=0 --oltp-order-ranges=0 --oltp-point-selects=1 --oltp-simple-ranges=0 --oltp-sum-ranges=0 --oltp_delete_inserts=0 --oltp-table-size=1000000 --num-threads=512 --max-requests=0 --max-time=60 --oltp-auto-inc=off --mysql-engine-trx=yes --oltp-test-mod=complex --mysql-host=192.168.222.120 --mysql-port=3306 --mysql-user=root --oltp-user-delay-min=10 --oltp-user-delay-max=100 --report-interval=10 --forced-shutdown=1 run

OLTP SIMPLE

/home/sysbench-0.5/sysbench/sysbench --test=/home/sysbench-0.5/sysbench/tests/db/oltp.lua --db-driver=mysql --debug=off --mysql-db=sysbench --mysql-password=123456 --oltp-tables-count=100 --oltp-distinct-ranges=0 --oltp-index-updates=0 --oltp-non-index-updates=0 --oltp-order-ranges=0 --oltp-point-selects=0 --oltp-simple-ranges=1 --oltp-sum-ranges=0 --oltp_delete_inserts=0 --oltp-table-size=1000000 --num-threads=512 --max-requests=0 --max-time=60 --oltp-auto-inc=off --mysql-engine-trx=yes --oltp-test-mod=complex --mysql-host=192.168.222.120 --mysql-port=3306 --mysql-user=root --oltp-user-delay-min=10 --oltp-user-delay-max=100 --report-interval=10 --forced-shutdown=1 run

OLTP SUM

/home/sysbench-0.5/sysbench/sysbench --test=/home/sysbench-0.5/sysbench/tests/db/oltp.lua --db-driver=mysql --debug=off --mysql-db=sysbench --mysql-password=123456 --oltp-tables-count=100 --oltp-distinct-ranges=0 --oltp-index-updates=0 --oltp-non-index-updates=0 --oltp-order-ranges=0 --oltp-point-selects=0 --oltp-simple-ranges=0 --oltp-sum-ranges=1 --oltp_delete_inserts=0 --oltp-table-size=1000000 --num-threads=512 --max-requests=0 --max-time=60 --oltp-auto-inc=off --mysql-engine-trx=yes --oltp-test-mod=complex --mysql-host=192.168.222.120 --mysql-port=3306 --mysql-user=root --oltp-user-delay-min=10 --oltp-user-delay-max=100 --report-interval=10 --forced-shutdown=1 run

OLTP DELETE

/home/sysbench-0.5/sysbench/sysbench --test=/home/sysbench-0.5/sysbench/tests/db/oltp.lua --db-driver=mysql --debug=off --mysql-db=sysbench --mysql-password=123456 --oltp-tables-count=100 --oltp-distinct-ranges=0 --oltp-index-updates=0 --oltp-non-index-updates=0 --oltp-order-ranges=0 --oltp-point-selects=0 --oltp-simple-ranges=0 --oltp-sum-ranges=0 --oltp_delete_inserts=1 --oltp-table-size=1000000 --num-threads=512 --max-requests=0 --max-time=60 --oltp-auto-inc=off --mysql-engine-trx=yes --oltp-test-mod=complex --mysql-host=192.168.222.120 --mysql-port=3306 --mysql-user=root --oltp-user-delay-min=10 --oltp-user-delay-max=100 --report-interval=10 --forced-shutdown=1 run

OLTP MIX

/home/sysbench-0.5/sysbench/sysbench --test=/home/sysbench-0.5/sysbench/tests/db/oltp.lua --db-driver=mysql --debug=off --mysql-db=sysbench --mysql-password=123456 --oltp-tables-count=100 --oltp-table-size=1000000 --num-threads=512 --max-requests=0 --max-time=60 --oltp-auto-inc=off --mysql-engine-trx=yes --oltp-test-mod=complex --mysql-host=192.168.222.120 --mysql-port=3306 --mysql-user=root --oltp-user-delay-min=10 --oltp-user-delay-max=100 --report-interval=10 --forced-shutdown=1 run

Table 3 Parameters in the commands

Parameter

Description

--mysql-db

Database to which data is loaded, which must be the same as the tested database. Otherwise, an error is reported indicating that the MySQL server cannot be connected.

--num-threads

Number of threads. If the message is displayed indicating that there are too many connections, set this parameter to a smaller value.

--test:

Test model

--oltp-tables-count:

Number of generated tables

--oltp-table-size:

Size of each generated table

--num-threads:

Number of threads to be tested

--mysql-password:

Password for logging in to the MySQL server

--mysql-user:

User name for logging in to the MySQL server

--mysql-port:

Port number for logging in to the MySQL server

--mysql-host:

IP address of the MySQL server

--max-time

Duration of a test, in seconds