From 8455372320df992c0d2013fa3b847390ecc5565d Mon Sep 17 00:00:00 2001 From: sthen Date: Tue, 15 Apr 2008 14:14:08 +0000 Subject: [PATCH] import sysbench: SysBench is a modular, cross-platform and multi-threaded benchmark tool for evaluating OS parameters that are important for a system running a database under intensive load. The idea of this benchmark suite is to quickly get an impression about system performance without setting up complex database benchmarks or even without installing a database at all. Current features allow to test the following system parameters: * file I/O performance * scheduler performance * memory allocation and transfer speed * POSIX threads implementation performance * database server performance (OLTP benchmark) Primarily written for MySQL server benchmarking, SysBench will be further extended to support multiple database backends, distributed benchmarks and third-party plug-in modules. from Jung (maintainer) with some tweaks. thanks to landry@ for testing and feedback. ok landry --- benchmarks/sysbench/Makefile | 58 +++++++++++++++++++ benchmarks/sysbench/distinfo | 5 ++ benchmarks/sysbench/patches/patch-configure | 12 ++++ .../sysbench/patches/patch-doc_Makefile_in | 12 ++++ .../sysbench/patches/patch-scripts_sb_run_sh | 44 ++++++++++++++ .../patches/patch-scripts_sb_test_ps_sh | 38 ++++++++++++ .../patches/patch-sysbench_sb_logger_c | 44 ++++++++++++++ .../patches/patch-sysbench_sysbench_c | 44 ++++++++++++++ benchmarks/sysbench/pkg/DESCR | 19 ++++++ benchmarks/sysbench/pkg/PLIST | 7 +++ 10 files changed, 283 insertions(+) create mode 100644 benchmarks/sysbench/Makefile create mode 100644 benchmarks/sysbench/distinfo create mode 100644 benchmarks/sysbench/patches/patch-configure create mode 100644 benchmarks/sysbench/patches/patch-doc_Makefile_in create mode 100644 benchmarks/sysbench/patches/patch-scripts_sb_run_sh create mode 100644 benchmarks/sysbench/patches/patch-scripts_sb_test_ps_sh create mode 100644 benchmarks/sysbench/patches/patch-sysbench_sb_logger_c create mode 100644 benchmarks/sysbench/patches/patch-sysbench_sysbench_c create mode 100644 benchmarks/sysbench/pkg/DESCR create mode 100644 benchmarks/sysbench/pkg/PLIST diff --git a/benchmarks/sysbench/Makefile b/benchmarks/sysbench/Makefile new file mode 100644 index 00000000000..beb73014e7e --- /dev/null +++ b/benchmarks/sysbench/Makefile @@ -0,0 +1,58 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2008/04/15 14:14:08 sthen Exp $ + +COMMENT = A modular, cross-platform and multi-threaded benchmark tool +DISTNAME = sysbench-0.4.8 +CATEGORIES = benchmarks +MASTER_SITES = ${MASTER_SITE_SOURCEFORGE:=sysbench/} + +HOMEPAGE = http://sysbench.sourceforge.net/ + +# GPL +PERMIT_DISTFILES_CDROM =Yes +PERMIT_DISTFILES_FTP = Yes +PERMIT_PACKAGE_CDROM = Yes +PERMIT_PACKAGE_FTP = Yes +WANTLIB = m c pthread + +MAINTAINER = Jung + +BUILD_DEPENDS = ::textproc/libxslt \ + ::textproc/docbook-xsl +NO_REGRESS = Yes + +CONFIGURE_STYLE = gnu +CONFIGURE_ENV = PREFIX=${PREFIX} + +USE_GMAKE = yes +USE_LIBTOOL = yes + +FLAVORS = mysql pgsql +FLAVOR ?= + +.if ${FLAVOR:L:Mmysql} +CONFIGURE_ARGS += --with-mysql +LIB_DEPENDS += lib/mysql/mysqlclient_r.>=10::databases/mysql +WANTLIB += crypto ssl z +.else +CONFIGURE_ARGS += --with-mysql=no +.endif + +.if ${FLAVOR:L:Mpgsql} +CONFIGURE_ARGS += --with-pgsql +LIB_DEPENDS += pq.>=3:postgresql-client-*:databases/postgresql +#crypto ssl +.else +CONFIGURE_ARGS += --with-pgsql=no +.endif + +pre-configure: + @rm ${WRKBUILD}/doc/manual.html + +do-install: + ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/sysbench + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/sysbench + ${INSTALL_DATA} ${WRKBUILD}/doc/manual.html ${PREFIX}/share/doc/sysbench + ${INSTALL_PROGRAM} ${WRKBUILD}/sysbench/sysbench ${PREFIX}/bin + ${INSTALL_SCRIPT} ${WRKBUILD}/scripts/sb_*.sh ${PREFIX}/share/examples/sysbench + +.include diff --git a/benchmarks/sysbench/distinfo b/benchmarks/sysbench/distinfo new file mode 100644 index 00000000000..3cd3fb80084 --- /dev/null +++ b/benchmarks/sysbench/distinfo @@ -0,0 +1,5 @@ +MD5 (sysbench-0.4.8.tar.gz) = 2he5ZU7Hy468C4qAYqQdzg== +RMD160 (sysbench-0.4.8.tar.gz) = p9Joal/gF7jRcP5Dh5RGLBxc2QI= +SHA1 (sysbench-0.4.8.tar.gz) = 2/d9mNk5nu7PDZ6Bxyoopd7iz1g= +SHA256 (sysbench-0.4.8.tar.gz) = VlNmLgNxx9s8/sD1xnGSZtkiev+0zOvV0gZnWtmC+KY= +SIZE (sysbench-0.4.8.tar.gz) = 469327 diff --git a/benchmarks/sysbench/patches/patch-configure b/benchmarks/sysbench/patches/patch-configure new file mode 100644 index 00000000000..7cdb3f95f71 --- /dev/null +++ b/benchmarks/sysbench/patches/patch-configure @@ -0,0 +1,12 @@ +$OpenBSD: patch-configure,v 1.1.1.1 2008/04/15 14:14:08 sthen Exp $ +--- configure.orig Tue Apr 15 11:36:17 2008 ++++ configure Tue Apr 15 11:36:48 2008 +@@ -19859,7 +19859,7 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' + XSLTPROC_FLAGS=--nonet + DOCBOOK_ROOT= + if test ! -f /etc/xml/catalog; then +- for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/; ++ for i in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh /usr/share/sgml/docbook/xsl-stylesheets/ ${PREFIX}/share/xsl/docbook/xhtml; + do + if test -d "$i"; then + DOCBOOK_ROOT=$i diff --git a/benchmarks/sysbench/patches/patch-doc_Makefile_in b/benchmarks/sysbench/patches/patch-doc_Makefile_in new file mode 100644 index 00000000000..8b177adb1d6 --- /dev/null +++ b/benchmarks/sysbench/patches/patch-doc_Makefile_in @@ -0,0 +1,12 @@ +$OpenBSD: patch-doc_Makefile_in,v 1.1.1.1 2008/04/15 14:14:08 sthen Exp $ +--- doc/Makefile.in.orig Tue Apr 15 12:13:50 2008 ++++ doc/Makefile.in Tue Apr 15 12:14:17 2008 +@@ -193,7 +193,7 @@ target_os = @target_os@ + target_vendor = @target_vendor@ + XHTML_STYLESHEET = $(srcdir)/xsl/xhtml.xsl + CHUNK_XHTML_STYLESHEET = $(srcdir)/xsl/xhtml-chunk.xsl +-XML_CATALOG_FILES = xsl/catalog.xml ++XML_CATALOG_FILES = ${PREFIX}/share/xsl/docbook/catalog.xml + htmldir = $(prefix)/share/doc/sysbench + dist_html_DATA = manual.html + EXTRA_DIST = manual.xml xsl/catalog.xml.in xsl/xhtml-chunk.xsl xsl/xhtml-common.xsl xsl/xhtml.xsl diff --git a/benchmarks/sysbench/patches/patch-scripts_sb_run_sh b/benchmarks/sysbench/patches/patch-scripts_sb_run_sh new file mode 100644 index 00000000000..716675d94ce --- /dev/null +++ b/benchmarks/sysbench/patches/patch-scripts_sb_run_sh @@ -0,0 +1,44 @@ +$OpenBSD: patch-scripts_sb_run_sh,v 1.1.1.1 2008/04/15 14:14:08 sthen Exp $ +--- scripts/sb_run.sh.orig Tue Jan 31 11:15:49 2006 ++++ scripts/sb_run.sh Tue Apr 15 12:52:29 2008 +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # File: sb_run.sh + # + # Copyright (C) 2004 Alexey Kopytov & MySQL AB +@@ -7,10 +7,10 @@ sbname=sysbench + + #Install signals handlers + trap 'echo "Got SIGINT, exiting..."; \ +- killall vmstat; killall iostat; killall mpstat' INT ++ pkill vmstat; pkill iostat' INT + + trap 'echo "Got SIGTERM, exiting..."; \ +- killall vmstat; killall iostat; killall mpstat' TERM ++ pkill vmstat; pkill iostat' TERM + + + # First try to find SysBench in the current dir +@@ -83,13 +83,13 @@ RUN_NUMBER=`expr $RUN_NUMBER + 1` + echo $RUN_NUMBER > .run_number + + # Start vmstat +-nohup vmstat -n $UPDATES_INTERVAL >$OUTPUT_DIR/vmstat.out 2>&1 & ++nohup vmstat $UPDATES_INTERVAL >$OUTPUT_DIR/vmstat.out 2>&1 & + + # Start iostat + nohup iostat $UPDATES_INTERVAL >$OUTPUT_DIR/iostat.out 2>&1 & + + # Start mpstat +-nohup mpstat $UPDATES_INTERVAL >$OUTPUT_DIR/mpstat.out 2>&1 & ++# nohup mpstat $UPDATES_INTERVAL >$OUTPUT_DIR/mpstat.out 2>&1 & + + cat >$OUTPUT_DIR/desc.txt <$OUTPUT_DIR/sysbench.out 2>&1 + +-killall vmstat; killall iostat; killall mpstat ++pkill vmstat; pkill iostat diff --git a/benchmarks/sysbench/patches/patch-scripts_sb_test_ps_sh b/benchmarks/sysbench/patches/patch-scripts_sb_test_ps_sh new file mode 100644 index 00000000000..97bff9cbd0c --- /dev/null +++ b/benchmarks/sysbench/patches/patch-scripts_sb_test_ps_sh @@ -0,0 +1,38 @@ +$OpenBSD: patch-scripts_sb_test_ps_sh,v 1.1.1.1 2008/04/15 14:14:08 sthen Exp $ +--- scripts/sb_test_ps.sh.orig Tue Jan 31 11:15:49 2006 ++++ scripts/sb_test_ps.sh Tue Apr 15 14:09:01 2008 +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # File: sb_test_ps.sh + # + # Copyright (C) 2004 Alexey Kopytov & MySQL AB +@@ -25,23 +25,24 @@ run_test() + { + tname="$1" + sbargs="--num-threads=$NUM_THREADS --max-requests=0 --max-time=60 \ +---test=oltp --oltp-table-size=100000 --mysql-table-type=myisam \ ++--test=oltp --oltp-table-size=100000 --mysql-table-engine=myisam \ + --oltp-point-selects=$point_selects \ + --oltp-simple-ranges=$simple_ranges + --oltp-sum-ranges=$sum_ranges + --oltp-order-ranges=$order_ranges + --oltp-distinct-ranges=$distinct_ranges + --oltp-index-updates=$index_updates +---oltp-non-index-updates=$non_index_updates" ++--oltp-non-index-updates=$non_index_updates ++--db-driver=mysql" + + echo -e "\n*** Running test for $tname (client-side PS) ***\n" + sysbench $sbargs prepare >/dev/null +- sb_run.sh -c "$tname (client-side PS)" $sbargs --db-ps-mode=disable run ++ $sbrun -c "$tname (client-side PS)" $sbargs --db-ps-mode=disable run + sysbench $sbargs cleanup >/dev/null + + echo -e "\n*** Running test for $tname (server-side PS)... ***\n" + sysbench $sbargs prepare >/dev/null +- sb_run.sh -c "$tname (server-side PS)" $sbargs run ++ $sbrun -c "$tname (server-side PS)" $sbargs run + sysbench $sbargs cleanup >/dev/null + } + diff --git a/benchmarks/sysbench/patches/patch-sysbench_sb_logger_c b/benchmarks/sysbench/patches/patch-sysbench_sb_logger_c new file mode 100644 index 00000000000..772c4e53ef7 --- /dev/null +++ b/benchmarks/sysbench/patches/patch-sysbench_sb_logger_c @@ -0,0 +1,44 @@ +$OpenBSD: patch-sysbench_sb_logger_c,v 1.1.1.1 2008/04/15 14:14:08 sthen Exp $ +--- sysbench/sb_logger.c.orig Mon Apr 3 12:39:09 2006 ++++ sysbench/sb_logger.c Tue Apr 15 12:10:58 2008 +@@ -441,15 +441,17 @@ int oper_handler_init(void) + + if (batch_mode) + { ++ int err; + pthread_mutex_init(&batch_mutex, NULL); + pthread_cond_init(&batch_cond, NULL); + + /* Create batch thread */ + pthread_attr_init(&batch_attr); +- if (pthread_create(&batch_thread, &batch_attr, &batch_runner_proc, NULL) +- != 0) ++ if ((err = pthread_create(&batch_thread, &batch_attr, ++ &batch_runner_proc, NULL)) != 0) + { +- log_errno(LOG_FATAL, "Batch thread creation failed"); ++ log_text(LOG_FATAL, "Batch thread creation failed errno = %d (%s)", ++ err, strerror(err)); + return 1; + } + batch_status = BATCH_STATUS_STOP; +@@ -541,15 +543,17 @@ int oper_handler_done(void) + + if (batch_mode) + { ++ int err; + /* Stop the batch thread */ + pthread_mutex_lock(&batch_mutex); + batch_status = BATCH_STATUS_STOP; + pthread_cond_signal(&batch_cond); + pthread_mutex_unlock(&batch_mutex); + +- if (pthread_join(batch_thread, NULL)) ++ if ((err = pthread_join(batch_thread, NULL))) + { +- log_errno(LOG_FATAL, "Batch thread join failed"); ++ log_text(LOG_FATAL, "Batch thread join failed errno = %d (%s)", ++ err, strerror(err)); + return 1; + } + diff --git a/benchmarks/sysbench/patches/patch-sysbench_sysbench_c b/benchmarks/sysbench/patches/patch-sysbench_sysbench_c new file mode 100644 index 00000000000..509e71ee1a1 --- /dev/null +++ b/benchmarks/sysbench/patches/patch-sysbench_sysbench_c @@ -0,0 +1,44 @@ +$OpenBSD: patch-sysbench_sysbench_c,v 1.1.1.1 2008/04/15 14:14:08 sthen Exp $ +--- sysbench/sysbench.c.orig Tue Jan 31 11:15:53 2006 ++++ sysbench/sysbench.c Tue Apr 15 12:10:58 2008 +@@ -423,12 +423,14 @@ int run_test(sb_test_t *test) + /* Starting the test threads */ + for(i = 0; i < sb_globals.num_threads; i++) + { ++ int err; + if (sb_globals.error) + return 1; +- if (pthread_create(&(threads[i].thread), &thread_attr, &runner_thread, +- (void*)&(threads[i])) != 0) ++ if ((err = pthread_create(&(threads[i].thread), &thread_attr, ++ &runner_thread, (void*)&(threads[i]))) != 0) + { +- log_errno(LOG_FATAL, "Thread #%d creation failed", i); ++ log_text(LOG_FATAL, "Thread #%d creation failed errno = %d (%s)", ++ i, err, strerror(err)); + return 1; + } + } +@@ -437,9 +439,11 @@ int run_test(sb_test_t *test) + log_text(LOG_INFO, "Threads started!"); + for(i = 0; i < sb_globals.num_threads; i++) + { +- if(pthread_join(threads[i].thread, NULL)) ++ int err; ++ if((err = pthread_join(threads[i].thread, NULL))) + { +- log_errno(LOG_FATAL, "Thread #%d join failed", i); ++ log_text(LOG_FATAL, "Thread #%d join failed errno = %d (%s)", ++ i, err, strerror(err)); + return 1; + } + } +@@ -508,7 +512,7 @@ int init(void) + return 1; + } + +- thread_stack_size = sb_get_value_int("thread-stack-size"); ++ thread_stack_size = sb_get_value_size("thread-stack-size"); + if (thread_stack_size <= 0) + { + log_text(LOG_FATAL, "Invalid value for thread-stack-size: %d.\n", thread_stack_size); diff --git a/benchmarks/sysbench/pkg/DESCR b/benchmarks/sysbench/pkg/DESCR new file mode 100644 index 00000000000..85583116275 --- /dev/null +++ b/benchmarks/sysbench/pkg/DESCR @@ -0,0 +1,19 @@ +SysBench is a modular, cross-platform and multi-threaded benchmark tool +for evaluating OS parameters that are important for a system running a +database under intensive load. + +The idea of this benchmark suite is to quickly get an impression about +system performance without setting up complex database benchmarks or +even without installing a database at all. + +Current features allow to test the following system parameters: + + * file I/O performance + * scheduler performance + * memory allocation and transfer speed + * POSIX threads implementation performance + * database server performance (OLTP benchmark) + +Primarily written for MySQL server benchmarking, SysBench will be +further extended to support multiple database backends, distributed +benchmarks and third-party plug-in modules. diff --git a/benchmarks/sysbench/pkg/PLIST b/benchmarks/sysbench/pkg/PLIST new file mode 100644 index 00000000000..6be44b01b2c --- /dev/null +++ b/benchmarks/sysbench/pkg/PLIST @@ -0,0 +1,7 @@ +@comment $OpenBSD: PLIST,v 1.1.1.1 2008/04/15 14:14:08 sthen Exp $ +bin/sysbench +share/doc/sysbench/ +share/doc/sysbench/manual.html +share/examples/sysbench/ +share/examples/sysbench/sb_run.sh +share/examples/sysbench/sb_test_ps.sh