简介
本文是Autonmous Transaction Processing的操作过程。
创建云实例并安装Swing Bench
建立yum metadata cache:
$ sudo yum makecache fast
Loaded plugins: langpacks, priorities, ulninfo, versionlock
ol7_UEKR5 | 2.8 kB 00:00
ol7_addons | 2.8 kB 00:00
ol7_developer | 2.8 kB 00:00
ol7_developer_EPEL | 3.4 kB 00:00
ol7_developer_golang113 | 2.8 kB 00:00
ol7_developer_nodejs10 | 2.8 kB 00:00
ol7_developer_php72 | 2.8 kB 00:00
ol7_ksplice | 2.8 kB 00:00
ol7_latest | 3.4 kB 00:00
ol7_oci_included | 2.9 kB 00:00
ol7_optional_latest | 2.8 kB 00:00
ol7_oracle_instantclient | 2.8 kB 00:00
ol7_software_collections | 2.8 kB 00:00
(1/27): ol7_UEKR5/x86_64/updateinfo | 23 kB 00:00
(2/27): ol7_developer/x86_64/primary_db | 454 kB 00:00
(3/27): ol7_developer_EPEL/x86_64/group_gz | 87 kB 00:00
(4/27): ol7_developer_EPEL/x86_64/updateinfo | 4.9 kB 00:00
(5/27): ol7_developer/x86_64/updateinfo | 71 B 00:00
(6/27): ol7_developer_golang113/x86_64/updateinfo | 71 B 00:00
(7/27): ol7_developer_golang113/x86_64/primary_db | 8.2 kB 00:00
(8/27): ol7_developer_nodejs10/x86_64/updateinfo | 71 B 00:00
(9/27): ol7_developer_nodejs10/x86_64/primary_db | 40 kB 00:00
(10/27): ol7_developer_php72/x86_64/updateinfo | 71 B 00:00
(11/27): ol7_addons/x86_64/primary_db | 139 kB 00:00
(12/27): ol7_addons/x86_64/updateinfo | 75 kB 00:00
(13/27): ol7_developer_php72/x86_64/primary_db | 408 kB 00:00
(14/27): ol7_ksplice/updateinfo | 5.0 kB 00:00
(15/27): ol7_UEKR5/x86_64/primary_db | 5.5 MB 00:00
(16/27): ol7_developer_EPEL/x86_64/primary_db | 11 MB 00:00
(17/27): ol7_ksplice/primary_db | 459 kB 00:00
(18/27): ol7_latest/x86_64/group_gz | 148 kB 00:00
(19/27): ol7_latest/x86_64/updateinfo | 2.6 MB 00:00
(20/27): ol7_oracle_instantclient/x86_64/updateinfo | 71 B 00:00
(21/27): ol7_oracle_instantclient/x86_64/primary_db | 10 kB 00:00
(22/27): ol7_latest/x86_64/primary_db | 18 MB 00:00
(23/27): ol7_optional_latest/x86_64/updateinfo | 883 kB 00:00
(24/27): ol7_oci_included/x86_64/primary_db | 81 kB 00:00
(25/27): ol7_optional_latest/x86_64/primary_db | 4.0 MB 00:00
(26/27): ol7_software_collections/x86_64/updateinfo | 8.7 kB 00:00
(27/27): ol7_software_collections/x86_64/primary_db | 4.8 MB 00:00
Metadata Cache Created
安装JDK:
$ sudo yum install java-1.8.0-openjdk-headless.x86_64
Loaded plugins: langpacks, priorities, ulninfo, versionlock
9 packages excluded due to repository priority protections
Excluding 2 updates due to versionlock (use "yum versionlock status" to show them)
Package 1:java-1.8.0-openjdk-headless-1.8.0.232.b09-0.el7_7.x86_64 already installed and latest version
Nothing to do
安装swingbench:
curl http://www.dominicgiles.com/swingbench/swingbenchlatest.zip -o swingbench.zip
unzip swingbench.zip
cd swingbench
创建 ATP实例并利用Swing Bench导入数据
创建一个自治交易数据库ATPDB,过程略。
下载Client Credentials,文件名为wallet_ATPDB.zip,并上传到刚才创建的云实例中。目标目录为默认,即opc用户的home目录(/home/opc
)。
$ unzip -l wallet_ATPDB.zip
Archive: wallet_ATPDB.zip
Length Date Time Name
--------- ---------- ----- ----
6733 12-23-2019 03:09 cwallet.sso
1851 12-23-2019 03:09 tnsnames.ora
3335 12-23-2019 03:09 truststore.jks
301 12-23-2019 03:09 ojdbc.properties
114 12-23-2019 03:09 sqlnet.ora
6688 12-23-2019 03:09 ewallet.p12
3275 12-23-2019 03:09 keystore.jks
--------- -------
22297 7 files
在目标数据库中创建schema并导入数据,挺快,2分多钟:
$ cd ~/swingbench/bin
$ export DB_PASSWORD=********
$ ./oewizard -cf ~/wallet_ATPDB.zip -cs ATPDB_medium -ts DATA -dbap $DB_PASSWORD -dba ADMIN -u soe -p $DB_PASSWORD -async_off -scale 0.1 -hashpart -create -cl -v
Operation is successfully completed.
Operation is successfully completed.
SwingBench Wizard
Author : Dominic Giles
Version : 2.6.0.1124
Running in Lights Out Mode using config file : ../wizardconfigs/oewizard.xml
Connecting to : jdbc:oracle:thin:@ATPDB_medium
Connected
Running script ../sql/soedgcreateuser.sql
Script completed in 0 hour(s) 0 minute(s) 0 second(s) 334 millisecond(s)
Starting run
Dec 23, 2019 3:23:16 AM oracle.simplefan.impl.FanManager configure
SEVERE: attempt to configure ONS in FanManager failed with oracle.ons.NoServersAvailable: Subscription time out
Starting script ../sql/soedgdrop2.sql
Script completed in 0 hour(s) 0 minute(s) 0 second(s) 75 millisecond(s)
Starting script ../sql/soedgcreatetableshash2.sql
Script completed in 0 hour(s) 0 minute(s) 0 second(s) 701 millisecond(s)
Starting script ../sql/soedgviews.sql
Script completed in 0 hour(s) 0 minute(s) 0 second(s) 26 millisecond(s)
Starting script ../sql/soedgsqlset.sql
Script completed in 0 hour(s) 0 minute(s) 0 second(s) 96 millisecond(s)
Inserting data into table PRODUCT_INFORMATION
Inserting data into table INVENTORIES
Inserting data into table ADDRESSES_75001
Inserting data into table ADDRESSES_2
Completed processing table PRODUCT_INFORMATION in 0:00:00
Inserting data into table CUSTOMERS_50001
Completed processing table ADDRESSES_2 in 0:00:09
Inserting data into table CUSTOMERS_2
Completed processing table ADDRESSES_75001 in 0:00:09
Inserting data into table ORDER_ITEMS_71490
Inserting data into table ORDERS_71491
Completed processing table CUSTOMERS_50001 in 0:00:09
Completed processing table INVENTORIES in 0:00:13
Inserting data into table ORDER_ITEMS_1
Inserting data into table ORDERS_2
Completed processing table CUSTOMERS_2 in 0:00:05
Completed processing table ORDERS_71491 in 0:00:17
Inserting data into table CARD_DETAILS_75001
Completed processing table ORDER_ITEMS_71490 in 0:00:19
Inserting data into table CARD_DETAILS_2
Completed processing table ORDERS_2 in 0:00:16
Inserting data into table LOGON_119151
Completed processing table CARD_DETAILS_75001 in 0:00:03
Inserting data into table LOGON_2
Completed processing table ORDER_ITEMS_1 in 0:00:18
Inserting data into table PRODUCT_DESCRIPTIONS
Completed processing table PRODUCT_DESCRIPTIONS in 0:00:00
Inserting data into table WAREHOUSES
Completed processing table CARD_DETAILS_2 in 0:00:03
Completed processing table WAREHOUSES in 0:00:00
Completed processing table LOGON_2 in 0:00:05
Connection cache closed
Starting script ../sql/soedganalyzeschema2.sql
Script completed in 0 hour(s) 0 minute(s) 56 second(s) 915 millisecond(s)
Starting script ../sql/soedgconstraints2.sql
Script completed in 0 hour(s) 0 minute(s) 5 second(s) 448 millisecond(s)
Starting script ../sql/soedgindexes2.sql
Script completed in 0 hour(s) 0 minute(s) 8 second(s) 16 millisecond(s)
Starting script ../sql/soedgsequences2.sql
Script completed in 0 hour(s) 0 minute(s) 0 second(s) 743 millisecond(s)
Starting script ../sql/soedgpackage2_header.sql
Script completed in 0 hour(s) 0 minute(s) 0 second(s) 207 millisecond(s)
Starting script ../sql/soedgpackage2_body.sql
Script completed in 0 hour(s) 0 minute(s) 0 second(s) 187 millisecond(s)
Starting script ../sql/soedgsetupmetadata.sql
Script completed in 0 hour(s) 0 minute(s) 0 second(s) 449 millisecond(s)
============================================
| Datagenerator Run Stats |
============================================
Connection Time 0:00:00.004
Data Generation Time 0:00:35.730
DDL Creation Time 0:01:43.236
Total Run Time 0:02:18.973
Rows Inserted per sec 33,983
Data Generated (MB) per sec 3.3
Actual Rows Generated 2,120,670
Commits Completed 126
Batch Updates Completed 10,625
Connecting to : jdbc:oracle:thin:@ATPDB_medium
Connected
Post Creation Validation Report
===============================
The schema appears to have been created successfully.
Valid Objects
=============
Valid Tables : 'ORDERS','ORDER_ITEMS','CUSTOMERS','WAREHOUSES','ORDERENTRY_METADATA','INVENTORIES','PRODUCT_INFORMATION','PRODUCT_DESCRIPTIONS','ADDRESSES','CARD_DETAILS'
Valid Indexes : 'PRD_DESC_PK','PROD_NAME_IX','PRODUCT_INFORMATION_PK','PROD_SUPPLIER_IX','PROD_CATEGORY_IX','INVENTORY_PK','INV_PRODUCT_IX','INV_WAREHOUSE_IX','ORDER_PK','ORD_SALES_REP_IX','ORD_CUSTOMER_IX','ORD_ORDER_DATE_IX','ORD_WAREHOUSE_IX','ORDER_ITEMS_PK','ITEM_ORDER_IX','ITEM_PRODUCT_IX','WAREHOUSES_PK','WHS_LOCATION_IX','CUSTOMERS_PK','CUST_EMAIL_IX','CUST_ACCOUNT_MANAGER_IX','CUST_FUNC_LOWER_NAME_IX','ADDRESS_PK','ADDRESS_CUST_IX','CARD_DETAILS_PK','CARDDETAILS_CUST_IX'
Valid Views : 'PRODUCTS','PRODUCT_PRICES'
Valid Sequences : 'CUSTOMER_SEQ','ORDERS_SEQ','ADDRESS_SEQ','LOGON_SEQ','CARD_DETAILS_SEQ'
Valid Code : 'ORDERENTRY'
Schema Created
验证schema创建成功:
$ ./sbutil -soe -cf ~/wallet_ATPDB.zip -cs ATPDB_medium -u soe -p $DB_PASSWORD -tables
Operation is successfully completed.
Operation is successfully completed.
Order Entry Schemas Tables
----------------------------------------------------------------------------------------------------------------------
|Table Name | Rows| Blocks| Size| Compressed?| Partitioned?|
----------------------------------------------------------------------------------------------------------------------
|CUSTOMERS | 100,000| 32,192| 256.0MB| | Yes|
|ORDERS | 142,979| 32,192| 256.0MB| | Yes|
|ORDER_ITEMS | 436,120| 32,192| 256.0MB| | Yes|
|CARD_DETAILS | 150,000| 32,192| 256.0MB| | Yes|
|ADDRESSES | 150,000| 32,192| 256.0MB| | Yes|
|LOGON | 238,299| 32,192| 256.0MB| | Yes|
|INVENTORIES | 900,272| 2,386| 19.0MB| Disabled| No|
|PRODUCT_DESCRIPTIONS | 1,000| 35| 320KB| Disabled| No|
|PRODUCT_INFORMATION | 1,000| 28| 256KB| Disabled| No|
|ORDERENTRY_METADATA | 0| 0| 64KB| Disabled| No|
|WAREHOUSES | 1,000| 5| 64KB| Disabled| No|
----------------------------------------------------------------------------------------------------------------------
Total Space 1.5GB
配置Swing Bench负载生成器
cd ~/swingbench/configs
vi SOE_Server_Side_V2.xml
做如下修改并保存:
...
<LogonGroupCount>4</LogonGroupCount>
...
<LogonDelay>300</LogonDelay>
...
<WaitTillAllLogon>false</WaitTillAllLogon>
...
确认:
$ grep Logon SOE_Server_Side_V2.xml
<LogonGroupCount>4</LogonGroupCount>
<LogonDelay>300</LogonDelay>
<WaitTillAllLogon>false</WaitTillAllLogon>
生成负载:
cd ~/swingbench/bin
./charbench -c ../configs/SOE_Server_Side_V2.xml -cf ~/wallet_ATPDB.zip -cs ATPDB_medium -u soe -p $DB_PASSWORD -v users,tpm,tps,vresp -intermin 0 -intermax 0 -min 0 -max 0 -uc 128 -di SQ,WQ,WA -rt 0:30.30
然后输出如下,其中第3列是TPM,第4列是TPS:
将ATPDB的OCPU由1调整到4,然后TPS和TPM大约变为以前的4倍:
最后清理环境。
遗留问题
第一个问题是,Auto Scaling是默认开启的,为何没有自动由1变为4?
第二个问题,Number of OCPUs allocated
需要在Service Console中看,但只显示1。是不是表示,虽然我分配了4,但实际只用到1呢?
后来发现是需要等一段时间,才会在图上反映。