简介

SwingBench是Oracle UK的一个员工在一个被抛弃的项目的基础上开发的。目前稳定版本2.6,基于JDK。该工具是免费的,可以在作者的网站上自由下载,并且拥有详细的使用文档。SwingBench 可以执行4种不同的标准测试(benchmark),拥有三种前端展示方式SwingBench/Charbench/Minibench,其中 Charbench是字符模式的,另外两种是GUI模式的。另外还可以通过ClusterOverview可以聚合显示所有的结果。SwingBench 的开发目的主要是用来展示RAC的负载和测试,但也可用于单实例环境。2.3版本开始支持TimesTen。

SwingBench consists of a load generator, a coordinator and a cluster overview. The software enables a load to be generated and the transactions/response times to be charted.

SwingBench can be used to demonstrate and test technologies such as Real Application Clusters, Online table rebuilds, Standby databases, Online backup and recovery etc.

The code that ships with SwingBench includes 6 benchmarks, OrderEntry, SalesHistory, TPC-DS Like, JSON, CallingCircle and StressTest..

  • OrderEntry is based on the “oe” schema that ships with Oracle 12c/Oracle 18c/Oracle 19c. It has been modified so that Spatial, Intermedia schema’s do not need to be installed. It can be run continuously (that is until you run out of space). It introduces heavy contention on a small number of tables and is designed to stress interconnects and memory. It is installed using the “oewizard” located in the bin directory. Both a pure jdbc and pl/sql (lower network overhead) variant exist of the benchmark.
  • SalesHistory is based on the “sh” schema that ships with Oracle 12c/Oracle 18c/Oracle 19c and is designed to test the performance of complicated queries when run against large tables. It is read only and can be scaled over a number of default sizes from 1GB to 1TB. A custom mode also allows for the creation of smaller and larger schemas
  • CallingCircle (deprecated) simulates the SQL that is generated for an online telco application. It requires data files to be generated and copied from the database server to the load generator before each run, it typically requires between 1 and 8 GB of disk space. Both benchmarks are heavily CPU intensive. Experience has shown that you require at least 1 processor of load generator to every 2 processors of database server. It is designed to stress the CPU and memory without the need for a powerful I/O subsystem. Its is installed using the “ccwizard” located in the bin directory
  • StressTest simply fires random inserts,updates,selects and updates against a well know table.
  • JSON Stresstest is based on simple JSON documents modelling people flying between airports. It follow a basic CRUD model
  • TPC-DS Like Benchmark is a benchmark similar to TPC-DS. It features both a query and transaction workload in separate configuration files.

The entire framework is developed in Java and as a result can be run on wide variety of platforms. It also provides a simple API to allow developers to build their own benchmarks.

安装

安装环境

系统:win10虚机

配置:4c8g,500G硬盘

安装包下载

官方下载地址:http://www.dominicgiles.com/downloads.html

安装流程

安装JDK 1.8

版本:jdk-8u131-windows-i586(链接:https://pan.baidu.com/s/1bBvyYNtrrzJTpFN9z0fnpg 提取码:4ztk)

系统环境变量:

  • JAVA_HOME:C:\Program Files (x86)\Java\jdk1.8.0_131
  • CLASSPATH:.;%JAVA_HOME%\bin;%JAVA_HOME%\lib\dt.jar%JAVA_HOME%\lib\tools.jar;
  • PATH:新增两行,%JAVA_HOME%\bin,%JAVA_HOME%\jre\lib

安装SwingBench

SwingBench压缩包下载完,解压即可使用。

Oewizard加载数据

运行Oewizard

进入.\SwingBench\winbin目录下,双击运行oewizard.bat

实验时,出现双击后无响应的情况,在cmd中运行oewizard.bat文件,报错如下:
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap

解决方式:系统环境变量中添加如下变量
变量名:JAVA_TOOL_OPTIONS 变量值:-Xms1024m
变量名:_JAVA_OPTIONS 变量值:-Xmx1024m

oewizard-1

Benchmark Version

选择默认选项,version 2.0

oewizard-2

Task

选择默认选项,Create the Order Entry Schema (User, Table, indexes, Data etc)

oewizard-3

Database Details

填写Oracle数据库的连接信息

  • Connect String:格式为ip[:port][:service name],eg:10.121.9.104:49161

  • Connection Type:使用默认选项,Type IV jdbc driver (Thin)

  • Administrator Username:sys as sysdba

  • Administrator Password:使用sys的密码,如果未设置,可在oracle中使用如下命令设置

1
alter user sys identified by "<new password>";

oewizard-4

Schema Details

  • Username:sys as sysdba

  • Password:sys的密码

  • Schema’s Tablespace:使用的是SYSTEM

  • Tablespaces’s Datafile:自动生成

oewizard-5

Database Options

全使用默认选项,直接下一步

  • Partitioning Model:No Partitioning

  • Compression Used:No Compression

  • Tablespace Type:Bigfile Tablespace

  • Indexing Used:All Indexes

oewizard-6

Sizing Details

加载的测试数据大小,根据需求选择。实验选择的最小数据量1GB,点击下一步

oewizard-7

ALL Details Entered

Level of Parallelism:设置导入时的并发,只影响数据导入速度,默认为4

oewizard-8

加载数据

SwingBench加载测试数据

SwingBench加载测试数据(完成)

SwingBench性能测试

开启SwingBench

进入.\SwingBench\winbin目录下,双击运行SwingBench.bat。界面功能区分布如下:

SwingBench-1

User Details

设置Oracle数据库的连接信息。注意:必须使用sysdba用户,普通用户获取不到数据库的性能数据

  • Username:sys as sysdba
  • Password:sys的密码
  • Connect String:格式为ip[:port][:service name],eg:10.121.9.104:49161
  • Driver Type:使用默认选项,Oracle jdbc Driver

填写完成后,进行连接测试,提示如下则表明连接正常

SwingBench-4

Load

设置压力参数

  • Number of Users:并发数,默认为4
  • Benchmark Run Time (hh:min):运行时长

Server Monitoring(ssh)

设置Oracle主机的ssh信息,SwingBench会ssh到主机,获取监控信息

SwingBench-2

Oracle AWR静态分析

  • 勾选Connect database statistics
  • 勾选Take AWR Snapshots at Start and End
  • Admin Username:sys as sysdba
  • Admin Password:sys的密码

性能图表

支持的图表如下

SwingBench-5

运行SwingBench

SwingBench-3

参考文档