PSR(Performance,Scalability and Reliability)测试用于测试产品功能的性能,可扩展性和可靠性。测试期间记录关键步骤消耗的时间,并生成 AWR(Automated Workload Repository) report,STS(Sql Tuning) report 和 JFR(Java Flight Record) report。
一 AWR report和STS report
1 在orcle DB安装的目录下如(D:Oracleproduct11.2.0dbhome_1NETWORKADMIN)下修改tnsnames.ora文件
sid =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname )(PORT = post))
)
(CONNECT_DATA =
(SERVICE_NAME =sid)
)
2 准备数据库连接:PSR_SYS 和 PSR_Sqlreq
PSR_SYS 用于生成 AWR report,PSR_Sqlreq 用于生成 STS report.
每个数据库连接都包含 hostname:post/sid,usename和password。其中PSR_SYS的role是SYSDBA.
3 建立cmd连接
sys:
$ set NLS_LANG=AMERICAN_AMERICA.UTF8
$ cd C:oraclexeapporacleproduct11.2.0server dbmsadmin
$ sqlplus usename/password@sid as sysdba
rep
$ set NLS_LANG=AMERICAN_AMERICA.UTF8
$ cd C:oraclexeapporacleproduct11.2.0server dbmsadmin
$ sqlplus usename/password@sid
4 在sqldevelop中
sys
set serveroutput on
declare
l_snap_id number(18);
l_create_snap_time timestamp;
begin
dbms_workload_repository.create_snapshot('ALL');
select systimestamp into l_create_snap_time from dual;
select max(snap_id) into l_snap_id from dba_hist_snapshot;
dbms_output.put_line('Current snapshot id:' || l_snap_id);
dbms_output.put_line('Current time:' || l_create_snap_time);
end;
测试开始时,运行上面的script两次,记录第二次的snap_id作为测试开始的snap_id
测试结束后,运行上面的script一次,记录snap_id作为测试结束的snap_id
req:
exec sqlrep.start_capture ('b1_20144404a', 'FUSION_RUNTIME,FUSION,ORAESS'); //测试开始时运行该语句
exec sqlrep.stop_capture(''b1_20144404a') //测试结束时运行该语句
5 cmd中生成report
sys:
@awrrpt.sql
根据提示,输入start snap_id和end snap_id以及report name
req:
@sqlreprpt.sql b1_20144404a
二. JFR report
在终端进入到jcmd的目录下
1 ./jcmd //check Weblogic Server pid
10323 weblogic.Server
8925 sun.tools.jcmd.JCmd
2 测试开始的时候运行指令
./jcmd 10323 JFR.start duration=60m maxsize=60M filename=/scratch/jfr/xxx.jfr
3 测试结束时运行./jcmd 10323 JFR.stop recording=3
在/scratch/jfr/目录下就能找到这次测试过程的jfr report
过程中生成三种report
1 AWR Reprot(Automated Workload Repository Report)
2 STS Report(Sql Tuning Report)
3 JFR Report