|
| 1 | + |
| 2 | +# Benchmarking PostgreSQL database server using sysbench client |
| 3 | + |
| 4 | +# sysbench |
| 5 | + |
| 6 | +sysbench is a scriptable multi-threaded benchmark tool based on |
| 7 | +LuaJIT. It is most frequently used for database benchmarks, but can also |
| 8 | +be used to create arbitrarily complex workloads that do not involve a |
| 9 | +database server. |
| 10 | + |
| 11 | +sysbench comes with the following bundled benchmarks: |
| 12 | + |
| 13 | +- `oltp_*.lua`: a collection of OLTP-like database benchmarks |
| 14 | +- `fileio`: a filesystem-level benchmark |
| 15 | +- `cpu`: a simple CPU benchmark |
| 16 | +- `memory`: a memory access benchmark |
| 17 | +- `threads`: a thread-based scheduler benchmark |
| 18 | +- `mutex`: a POSIX mutex benchmark |
| 19 | + |
| 20 | +# |
| 21 | +For more information on sysbench, please visit [https://github.com/akopytov/sysbench](https://github.com/akopytov/sysbench). |
| 22 | + |
| 23 | +# PostgreSQL |
| 24 | + |
| 25 | +PostgreSQL is a powerful, open source object-relational database system |
| 26 | +that uses and extends the SQL language combined with many features that |
| 27 | +safely store and scale the most complicated data workloads. |
| 28 | + |
| 29 | +# |
| 30 | +For more information on postgresql, please visit [https://www.postgresql.org/](https://www.postgresql.org/). |
| 31 | + |
| 32 | +# start the docker container with PostgreSQL server image |
| 33 | + |
| 34 | +``` shell |
| 35 | +$ docker run --name postgres-instance -e POSTGRES_PASSWORD=mypass -e POSTGRES_USER=sbtest -p 8001:5432 -d postgres-img -c min_dynamic_shared_memory=128 |
| 36 | +``` |
| 37 | + |
| 38 | +# If you need to use hugepages use following command |
| 39 | + |
| 40 | +``` shell |
| 41 | +$ docker run --name postgres-instance -e POSTGRES_PASSWORD=mypass -e POSTGRES_USER=sbtest -p 8001:5432 -d postgres-img -c huge_pages=on -c huge_page-size=2MB -c min_dynamic_shared_memory=128 |
| 42 | +``` |
| 43 | + |
| 44 | + |
| 45 | +** You can start multiple containers listening at different port number |
| 46 | +visible to the external sysbench client. |
| 47 | + |
| 48 | +# prepare data and tables |
| 49 | + |
| 50 | +``` shell |
| 51 | +$ sysbench --db-driver=pgsql --pgsql-user=sbtest --pgsql_password=mypass --pgsql-db=sbtest --pgsql-port=8001 --tables=16 --table-size=10000 --threads=256 --time=0 --events=0 --report-interval=1 --time=300 /usr/share/sysbench/oltp_read_write.lua prepare |
| 52 | +``` |
| 53 | + |
| 54 | +# Run benchmark |
| 55 | + |
| 56 | +``` shell |
| 57 | +$ sysbench --db-driver=pgsql --pgsql-user=sbtest --pgsql_password=mypass --pgsql-db=sbtest --pgsql-port=8001 --tables=16 --table-size=10000 --threads=256 --time=0 --events=0 --report-interval=1 --time=300 /usr/share/sysbench/oltp_read_write.lua run |
| 58 | +``` |
| 59 | + |
| 60 | + |
0 commit comments