Real Application Testing
Real Application Testing
Using 11g Real Application Testing to analyse the impact of making the following
changes:
One of the best new features in Oracle 11g is the Real Application Testing option
which enables us to test the result of a change without actually implementing the same
in a production environment. Changes such as database version upgrades, optimizer
changes, hardware and storage changes all carry with them an element of risk and
uncertainty. Using this feature much of that uncertainty and guesswork can be
avoided.
a) Database Replay
b) SQL Performance Analyzer (SPA)
SPA enables us to test the impact of a change at the level of a particular SQL
statement to see if any improvements or regressions occurred in the execution of the
SQL statement because of the change.
This feature will afford businesses increased confidence and surety when faced with a
system change as well as significantly reducing the costs as well as resources
associated with the testing phase.
Database Capture is now supported in versions 9.2.0.8 as well as 10.2.0.3 and 10.2.0.4
enabling us to test the impact of upgrades from both 9i as well as 10g to 11g. Note,
however, that replay can only be performed in a Oracle 11g database.
At a very high level, the database capture and replay will involve the following steps:
Scenario
We will create a directory to hold the captured workload files and then also create a
filter so that only database operations of the user ‘SOE’ are captured.
Directory created.
Grant succeeded.
SQL> exec
dbms_workload_capture.add_filter('swingbench_filter','USER','SOE');
SQL> exec
dbms_workload_capture.start_capture('10204_TO_11g,'CAPTURE_DIR',NULL,
'EXCLUDE');
BEGIN
dbms_workload_capture.start_capture('10204_TO_11g','CAPTURE_DIR',NULL
, 'EXCLUDE'); END;
*
ERROR at line 1:
ORA-15591: cannot start capture because parameter
"PRE_11G_ENABLE_CAPTURE" is
not enabled
ORA-06512: at "SYS.DBMS_WORKLOAD_CAPTURE", line 799
ORA-06512: at line 1
SQL> show parameter PRE_11G_ENABLE_CAPTURE
System altered.
SQL> exec
dbms_workload_capture.start_capture('10204_TO_11g','CAPTURE_DIR',NULL
, 'EXCLUDE');
testdb:/u02/oradata/capture> ls -l
total 16
-rw-r--r-- 1 oracle dba 995 Sep 11 08:56
wcr_4pad09400280u.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:56
wcr_cap_0001n.start
-rw-r--r-- 1 oracle dba 130 Sep 11 08:56
wcr_scapture.wmd
testdb:/u01/oracle> cd /u01/oracle/loadgen/swingbench/bin
testdb:/u01/oracle/loadgen/swingbench/bin>
testdb:/u01/oracle/loadgen/swingbench/bin> export
DISPLAY=10.107.105.179:0.0
testdb:/u01/oracle/loadgen/swingbench/bin> ./swingbench
Started Swingbench, Version 2.3.0.422. Using config file
swingconfig.xml
BI Beans Graph version [2.7.5.32] Engine version [2.7.5.32]
If we query the database, we can see an number of PL/SQL calls are
being made by the 25 connected user sessions
SU TXT
----------
---------------------------------------------------------------------
-----------
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.browseproducts(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.browseproducts(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.browseproducts(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.browseproducts(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.processorders(:2,:3); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.processorders(:2,:3); END;
SOE BEGIN :1 := orderentry.browseproducts(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.processorders(:2,:3); END;
SOE BEGIN :1 := orderentry.browseproducts(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.browseandupdateorders(:2,:3,:4);
END;
SOE BEGIN :1 := orderentry.browseproducts(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.browseproducts(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
SOE BEGIN :1 := orderentry.neworder(:2,:3,:4); END;
25 rows selected.
testdb:/u02/oradata/capture> ls -lrt
total 16
-rw-r--r-- 1 oracle dba 130 Sep 11 08:56
wcr_scapture.wmd
-rw-r--r-- 1 oracle dba 0 Sep 11 08:56
wcr_cap_0001n.start
-rw-r--r-- 1 oracle dba 995 Sep 11 08:56
wcr_4pad09400280u.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs003w2h.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs003s3q.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs003h66.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs003h5f.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs00347u.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs00300u.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs002w0w.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs002s6c.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs00284n.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs002812.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs003s34.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs003s00.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs003n5k.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs003854.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs00383f.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs00342n.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs00341k.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs002n5n.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs002h0h.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs002c6k.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs002846.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs00243q.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs00201q.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs003h3c.rec
-rw-r--r-- 1 oracle dba 0 Sep 11 08:57
wcr_4pad0fs002w3n.rec
The Swingbench tool has been configured to run for 35 minutes and
will automatically logoff the 25 SOE user sessions once that time
period has elapsed.
SQL> declare
capture_id number;
begin
select max(id) into capture_id
from dba_workload_captures
where status = 'COMPLETED';
dbms_workload_capture.export_awr(capture_id);
end;
/
testdb:/u02/oradata/capture> ls -lrt
total 25544
-rw-r--r-- 1 oracle dba 130 Sep 11 08:56
wcr_scapture.wmd
-rw-r--r-- 1 oracle dba 995 Sep 11 08:56
wcr_4pad09400280u.rec
-rw-r--r-- 1 oracle dba 71 Sep 11 08:58
wcr_4pad0qc003c2k.rec
-rw-r--r-- 1 oracle dba 71 Sep 11 08:58
wcr_4pad0qc002n00.rec
-rw-r--r-- 1 oracle dba 71 Sep 11 09:21
wcr_4pad60n002s70.rec
-rw-r--r-- 1 oracle dba 981 Sep 11 09:23
wcr_4pad1t800202f.rec
-rw-r--r-- 1 oracle dba 254839 Sep 11 09:27
wcr_4pad0fs003s34.rec
-rw-r--r-- 1 oracle dba 234486 Sep 11 09:27
wcr_4pad0fs00300u.rec
-rw-r--r-- 1 oracle dba 208884 Sep 11 09:27
wcr_4pad0fs002s6c.rec
-rw-r--r-- 1 oracle dba 216954 Sep 11 09:27
wcr_4pad0fs002h0h.rec
-rw-r--r-- 1 oracle dba 210586 Sep 11 09:27
wcr_4pad0fs002c6k.rec
-rw-r--r-- 1 oracle dba 222085 Sep 11 09:27
wcr_4pad0fs003s00.rec
-rw-r--r-- 1 oracle dba 218768 Sep 11 09:27
wcr_4pad0fs00347u.rec
-rw-r--r-- 1 oracle dba 236026 Sep 11 09:27
wcr_4pad0fs002w3n.rec
-rw-r--r-- 1 oracle dba 222652 Sep 11 09:27
wcr_4pad0fs00284n.rec
-rw-r--r-- 1 oracle dba 238417 Sep 11 09:27
wcr_4pad0fs002846.rec
-rw-r--r-- 1 oracle dba 239365 Sep 11 09:27
wcr_4pad0fs003n5k.rec
-rw-r--r-- 1 oracle dba 224863 Sep 11 09:27
wcr_4pad0fs003h3c.rec
-rw-r--r-- 1 oracle dba 230934 Sep 11 09:27
wcr_4pad0fs00243q.rec
-rw-r--r-- 1 oracle dba 227368 Sep 11 09:27
wcr_4pad0fs00201q.rec
-rw-r--r-- 1 oracle dba 231523 Sep 11 09:27
wcr_4pad0fs00342n.rec
-rw-r--r-- 1 oracle dba 226836 Sep 11 09:27
wcr_4pad0fs00341k.rec
-rw-r--r-- 1 oracle dba 227811 Sep 11 09:27
wcr_4pad0fs003s3q.rec
-rw-r--r-- 1 oracle dba 222510 Sep 11 09:27
wcr_4pad0fs003h5f.rec
-rw-r--r-- 1 oracle dba 223408 Sep 11 09:27
wcr_4pad0fs003854.rec
-rw-r--r-- 1 oracle dba 221885 Sep 11 09:27
wcr_4pad0fs00383f.rec
-rw-r--r-- 1 oracle dba 239250 Sep 11 09:27
wcr_4pad0fs002n5n.rec
-rw-r--r-- 1 oracle dba 229125 Sep 11 09:27
wcr_4pad0fs002w0w.rec
-rw-r--r-- 1 oracle dba 242049 Sep 11 09:27
wcr_4pad0fs002812.rec
-rw-r--r-- 1 oracle dba 220770 Sep 11 09:27
wcr_4pad0fs003w2h.rec
-rw-r--r-- 1 oracle dba 222513 Sep 11 09:27
wcr_4pad0fs003h66.rec
-rw-r--r-- 1 oracle dba 983 Sep 11 09:33
wcr_4pad8uc00385n.rec
-rw-r--r-- 1 oracle dba 200 Sep 11 09:33
wcr_fcapture.wmd
-rw-r--r-- 1 oracle dba 47916 Sep 11 09:33 wcr_cr.html
-rw-r--r-- 1 oracle dba 23826 Sep 11 09:33 wcr_cr.text
-rw-r--r-- 1 oracle dba 20667 Sep 11 09:36 wcr_ca.log
-rw-r----- 1 oracle dba 7200768 Sep 11 09:36 wcr_ca.dmp
We will create the Replay directory and then move all the captured
workload files from the source machine (devu007) to the target
machine (10.1.210.21). This is one of the nodes in the cluster, the
other node being 10.1.210.22.
Directory created.
Grant succeeded.
Database Replay
While all the steps mentioned here can be performed using the
DBMS_WORKLOAD_REPLAY API, we will demonstrate the same using the GUI
11g Enterprise Manager (Database Control and not Grid Control)
We need to click on the ‘Software and Support’ tab and then go to the
‘Database Replay’ link.
Since we have already finished the Capture Workload and Preprocess
Captured Workload tasks, we need to click on the Replay Workload Go
to Task
Once we select the ‘REPLAY_DIR’ in the directory object drop down list, we find
that the page is then populated with the relevant capture details
We provide a name for the Workload Replay ……
We can customise certain options in the workload replay like the database connection
strings and the speed at which the replay is done among others. Note in this case the
tns connect alias is the one that has been enabled for the RAC database providing for
load balancing.using the service ‘bwdba’.
We then need to configure and start the Workload Replay Clients (WRC) on the
server using the wrc command.
The workload replay clients and responsible for parsing and sending the workload to
the server. The number of clients that need to be started depends on the amount of
workload that wil be run and the by running the wrc command in calibration mode, it
will help us determine how many clients we need for the job on hand.
In our case, it shows that we need the single workload client to replay the workload
that has been generated.
middba1:/u01/oracle/product/11.1.0/db/bin> wrc system/oracle mode=calibrate
replaydir=/u01/oracle/replay
Workload Replay Client: Release 11.1.0.6.0 - Production on Fri Sep 11 10:11:51 2009
Recommendation:
Consider using at least 1 clients divided among 1 CPU(s).
Workload Characteristics:
- max concurrency: 25 sessions
- total number of sessions: 25
Assumptions:
- 1 client process per 50 concurrent sessions
- 4 client process per CPU
- think time scale = 100
- connect time scale = 100
- synchronization = TRUE
We then start the Workload Replay Clients by using the wrc command . We see that
the workload replay client after it starts has spawned a database session and an OS
process as well
middba1:/u01/oracle/product/11.1.0/db/bin> wrc system/oracle
replaydir=/u01/oracle/replay
Workload Replay Client: Release 11.1.0.6.0 - Production on Fri Sep 11 10:13:58 2009
Workload Replay Client: Release 11.1.0.6.0 - Production on Fri Sep 11 10:13:58 2009
We can now go back to the Enterprise Manager session and view the progress of the
Workload Replay. We can see a graphical representation of the time that is being
taken for the replay as compared to the capture as well as the total work that is
remaining to be completed.
If we check after about 10 minutes we find that the replay on the RAC database is
happening almost 50% faster than the original capture time and by querying the
database we find that the load has been distributed between the two instances as well.
Of the 25 SOE sessions, 11 are connected to instance bwdba1 and 14 are connected
to instance bwdba2
BWDBA1
COUNT(*)
----------
11
BWDBA2
COUNT(*)
----------
14
Once the replay is fully completed, the workload replay clients will exit and in our
case we find just by using time taken as factor, the performance improvement on the
11g RAC database has been greater than 50%. Note that the replay clients ran for
about 21 minutes while the original workload capture took about 36 minutes.
middba1:/u01/oracle/product/11.1.0/db/bin> wrc system/oracle
replaydir=/u01/oracle/replay
Workload Replay Client: Release 11.1.0.6.0 - Production on Fri Sep 11 10:13:58 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
What stands out t he most is the % IO wait time of the second snapshot set which
pertains to the 11g RAC database is significantly lower than the first run. The RAC
database is hosted on ASM storage and this could clearly support the fact that IO
distribution and throughput in a well configured ASM system could outweigh other
conventional file systems.
A look at the Wait Events section will also indicate that we had I/O issues in the first
run on the 10g source system which is found in the fact that db file sequential reads
and log file sync and log file parallel writes events are the main wait events. These are
not found in the second run on the 11g RAC on ASM environment.
Based on just this workload report, we can safely conclude that the upgrade
from 10g to 11g on a cluster database hosted on an ASM storage environment
will not cause any real performance digressions – in fact, on the contrary there is
evidence to show that significant performance benefits will be attained by
making the change.