Using Workload Folding

This section describes how to use workload folding with Consolidated Database Replay, and assumes a scenario where you want to use workload folding to triple a captured workload. The scenario demonstrates how to use workload folding for scale-up testing. For more information about workload folding, see "About Workload Folding".

This scenario uses the following assumptions:

  • The original workload was captured from 2 a.m. to 8 p.m. and folded into three capture subsets.

  • The first capture subset contains part of the original workload from 2 a.m. to 8 a.m.

  • The second capture subset contains part of the original workload from 8 a.m. to 2 p.m.

  • The third capture subset contains part of the original workload from 2 p.m. to 8 p.m.

  • To triple the workload during replay, workload folding is performed by replaying the three capture subsets simultaneously.

To perform workload folding in this scenario:

  1. On the replay system where you plan to perform scale-up testing, create a directory object for the root directory where the captured workloads are stored:

    CREATE OR REPLACE DIRECTORY cons_dir AS '/u01/test/cons_dir';
    
  2. Create a directory object for the directory where the original workload is stored:

    CREATE OR REPLACE DIRECTORY cap_monday AS '/u01/test/cons_dir/cap_monday';
    
  3. Create directory objects for the directories where you are planning to store the capture subsets:

    1. Create a directory object for the first capture subset:

      CREATE OR REPLACE DIRECTORY cap_mon_2am_8am
                                 AS '/u01/test/cons_dir/cap_monday_2am_8am';
      
    2. Create a directory object for the second capture subset:

      CREATE OR REPLACE DIRECTORY cap_mon_8am_2pm
                                 AS '/u01/test/cons_dir/cap_monday_8am_2pm';
      
    3. Create a directory object for the third capture subset:

      CREATE OR REPLACE DIRECTORY cap_mon_2pm_8pm
                                 AS '/u01/test/cons_dir/cap_monday_2pm_8pm';
      
  4. Create the capture subsets:

    1. Generate the first capture subset for the time period from 2 a.m. to 8 a.m.:

      EXEC DBMS_WORKLOAD_REPLAY.GENERATE_CAPTURE_SUBSET ('CAP_MONDAY',
                                'CAP_MON_2AM_8AM', 'mon_2am_8am_wkld',
                                0, TRUE, 21600, FALSE, 1);
      
    2. Generate the second capture subset for the time period from 8 a.m. to 2 p.m.:

      EXEC DBMS_WORKLOAD_REPLAY.GENERATE_CAPTURE_SUBSET ('CAP_MONDAY',
                                'CAP_MON_8AM_2PM', 'mon_8am_2pm_wkld',
                                21600, TRUE, 43200, FALSE, 1);
      
    3. Generate the third capture subset for the time period from 2 p.m. to 8 p.m.:

      EXEC DBMS_WORKLOAD_REPLAY.GENERATE_CAPTURE_SUBSET ('CAP_MONDAY',
                                'CAP_MON_2PM_8PM', 'mon_2pm_8pm_wkld',
                                43200, TRUE, 0, FALSE, 1);
      
  5. Preprocess the capture subsets:

    EXEC DBMS_WORKLOAD_REPLAY.PROCESS_CAPTURE ('CAP_MON_2AM_8AM');
    EXEC DBMS_WORKLOAD_REPLAY.PROCESS_CAPTURE ('CAP_MON_8AM_2PM');
    EXEC DBMS_WORKLOAD_REPLAY.PROCESS_CAPTURE ('CAP_MON_2PM_8PM');
    
  6. Set the replay directory to the root directory:

    EXEC DBMS_WORKLOAD_REPLAY.SET_REPLAY_DIRECTORY ('CONS_DIR');
    
  7. Create a replay schedule and add the capture subsets:

    EXEC DBMS_WORKLOAD_REPLAY.BEGIN_REPLAY_SCHEDULE ('monday_folded_schedule');
    SELECT DBMS_WORKLOAD_REPLAY.ADD_CAPTURE ('CAP_MON_2AM_8AM') FROM dual;
    SELECT DBMS_WORKLOAD_REPLAY.ADD_CAPTURE ('CAP_MON_8AM_2PM') FROM dual;
    SELECT DBMS_WORKLOAD_REPLAY.ADD_CAPTURE ('CAP_MON_2PM_8PM') FROM dual;
    EXEC DBMS_WORKLOAD_REPLAY.END_REPLAY_SCHEDULE;
    
  8. Initialize the consolidated replay:

    EXEC DBMS_WORKLOAD_REPLAY.INITIALIZE_CONSOLIDATED_REPLAY (
                              'monday_folded_replay', 'monday_folded_schedule');
    
  9. Remap connections:

    1. Query the DBA_WORKLOAD_CONNECTION_MAP view for the connection mapping information:

      SELECT schedule_cap_id, conn_id, capture_conn, replay_conn
        FROM dba_workload_connection_map;
      
    2. Remap the connections:

      EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 1,
           conn_id => 1, replay_connection => 'inst1');
      EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 1,
           conn_id => 2, replay_connection => 'inst1');
      EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 2,
           conn_id => 1, replay_connection => 'inst2');
      EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 2,
           conn_id => 2, replay_connection => 'inst2');
      EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 3,
           conn_id => 1, replay_connection => 'inst3');
      EXEC DBMS_WORKLOAD_REPLAY.REMAP_CONNECTION (schedule_cap_id => 3,
           conn_id => 2, replay_connection => 'inst3');
      

      The replay_connection parameter represents the services that are defined on the test system.

    3. Verify the connection remappings:

      SELECT schedule_cap_id, conn_id, capture_conn, replay_conn
        FROM dba_workload_connection_map;
      
  10. Prepare the consolidated replay:

    EXEC DBMS_WORKLOAD_REPLAY.PREPARE_CONSOLIDATED_REPLAY;
    
  11. Start replay clients:

    1. Estimate the number of replay clients that are required:

      wrc mode=calibrate replaydir=/u01/test/cons_dir/cap_monday_2am_8am
      wrc mode=calibrate replaydir=/u01/test/cons_dir/cap_monday_8am_2pm
      wrc mode=calibrate replaydir=/u01/test/cons_dir/cap_monday_2pm_8pm
      
    2. Add the output to determine the number of replay clients required.

      You will need to start at least one replay client per workload capture contained in the consolidated workload.

    3. Start the required number of replay clients by repeating this command:

      wrc username/password mode=replay replaydir=/u01/test/cons_dir
      

      The replaydir parameter is set to the root directory in which the workload captures are stored.

  12. Start the consolidated replay:

    EXEC DBMS_WORKLOAD_REPLAY.START_CONSOLIDATED_REPLAY;