Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to PostgreSQL DBA (8)-sysbench

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Pgbench is an open source benchmark tool that supports multithreading and multiple databases (including MySQL, PostgreSQL, etc.); CPU, disk IO, memory, POSIX thread performance and database performance of the operating system can be measured by testing.

I. installation

Download sysbench. The latest version is 1.0.15.

Cd / tmp/installwget https://github.com/akopytov/sysbench/archive/1.0.15.zip-O "sysbench-1.0.15.zip" unzip sysbench-1.0.15.zipcd sysbench-1.0.15

Perform installation

Yum install automake libtool mysql-devel postgresql-devel-y./autogen.sh./configure-with-pgsql--with-pgsql-includes=/appdb/atlasdb/pg11beta2/include-with-pgsql-libs=/appdb/atlasdb/pg11beta2/libmakemake install

Installation succeeded

[root@localhost sysbench-1.0.15] # sysbench--versionsysbench 1.0.15 II. Parameter description

You can view the detailed parameter settings through the sysbench-- help command.

[root@localhost include] # sysbench-- helpUsage: sysbench [options]. [testname] [command] Commands implemented by most tests: prepare run cleanup helpGeneral options:-- threads=N number of threads to use [1].

Where:

Oltp-tables-count

Number of test tables generated

-- threads=N

Number of worker threads used by sysbench

-- time=N

Execution time in seconds

-- report-interval=N

Reporting interval in seconds

-- config-file=FILENAME

Configuration file

-- db-driver=STRING

Database driven mysql/pgsql

Pgsql options:

-- pgsql-host=STRING PostgreSQL server host [localhost]

-- pgsql-port=N PostgreSQL server port [5432]

-- pgsql-user=STRING PostgreSQL user [sbtest]

-- pgsql-password=STRING PostgreSQL password []

-- pgsql-db=STRING PostgreSQL database name [sbtest]

III. Basic use

Connect to the database and create a test database sysbench

$createdb sysbench

Preparation stage

Execute the following command and sysbench executes the test script that comes with it

Sysbench/ usr/local/share/sysbench/tests/include/oltp_legacy/oltp.lua\-oltp-tables-count=10-- oltp-table-size=500000\-- db-driver=pgsql-- pgsql-host=192.168.26.103-- pgsql-port=5432\-- pgsql-user=atlasdb-- pgsql-db=sysbench\ prepare

Command output

Creating table 'sbtest1'...Inserting 500000 records into' sbtest1'Creating secondary indexes on 'sbtest1'...Creating table' sbtest2'...Inserting 500000 records into 'sbtest2'Creating secondary indexes on' sbtest2'...Creating table 'sbtest3'...Inserting 500000 records into' sbtest3'Creating secondary indexes on 'sbtest3'...Creating table' sbtest4'...Inserting 500000 records into 'sbtest4'Creating secondary indexes on' sbtest4'...Creating table 'sbtest5'...Inserting 500000 records into' sbtest5'Creating secondary indexes on' Sbtest5'...Creating table 'sbtest6'...Inserting 500000 records into' sbtest6'Creating secondary indexes on 'sbtest6'...Creating table' sbtest7'...Inserting 500000 records into 'sbtest7'Creating secondary indexes on' sbtest7'...Creating table 'sbtest8'...Inserting 500000 records into' sbtest8'Creating secondary indexes on 'sbtest8'...Creating table' sbtest9'...Inserting 500000 records into 'sbtest9'Creating secondary indexes on' sbtest9'...Creating table 'sbtest10'...Inserting 500000 records into' sbtest10'Creating secondary indexes on 'sbtest10'..

Run the benchmark

Sysbench/ usr/local/share/sysbench/tests/include/oltp_legacy/oltp.lua\-report-interval=5\-threads=4-time=120-db-driver=pgsql-pgsql-host=192.168.26.103-pgsql-port=5432\-pgsql-user=atlasdb-pgsql-db=sysbench\ run

After the execution is completed, the execution process and results of the 4 threads are as follows:

Sysbench 1.0.15 (using bundled LuaJIT 2.1.0-beta2) Running the test with following options:Number of threads: 4Report intermediate results every 5 second (s) Initializing random number generator from current timeInitializing worker threads...Threads started! [5s] thds: 4 tps: 107.50 qps: 2160.56 (r/w/o: 1513.97) lat (ms) 95%): 51.94 err/s: 0.00 reconn/s: 0.00 [10s] thds: 4 tps: 80.79 qps: 1611.00 (r/w/o: 1126.26 tps 323.16 qps: 161.58) lat (ms,95%): 71.83 err/s: 0.00 reconn/s: 0.00 [15s] thds: 4 tps: 105.45 qps: 2114.74 (r/w/o: 1482.66 thds 421.19) lat (ms: 210.89) 95%): 61.08 err/s: 0.00 reconn/s: 0.00. [120s] thds: 4 tps: 88.00 qps: 1762.33 (r/w/o: 1232.95max 353.39max 175.99) lat (ms Err/s: 0.00 reconn/s: 0.00SQL statistics: queries performed: read: 181496 write: 51856 other: 25928 total: 259280 transactions: 12964 (108.00 per sec.) Queries: 259280 (2160.08 per sec.) Ignored errors: 0 (0.00 per sec.) Reconnects: 0 (0.00 per sec.) General statistics: total time: 120.0312s total number of events: 12964Latency (ms): min: 18.34 avg: 37. 02 max: 122.90 95th percentile: 58.92 sum: 479962.76Threads fairness: events (avg/stddev): 3241.0000 execution time 6.96 execution time (avg/stddev): 119.9907 references

How to Benchmark Performance of MySQL & MariaDB using SysBench

How to Benchmark PostgreSQL Performance Using Sysbench

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report