SQL Server Distributed Replay
SQL Server Distributed Replay
Summary: The Microsoft SQL Server Distributed Replay feature helps you assess the
impact of future SQL Server upgrades. You can also use it to help assess the impact of
hardware and operating system upgrades, and SQL Server tuning.
The example companies, organizations, products, domain names, email addresses, logos, people, places, and events
depicted herein are fictitious. No association with any real company, organization, product, domain name, email address,
logo, person, place, or event is intended or should be inferred.
This book expresses the author’s views and opinions. The information contained in this book is provided without any
express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will
be held liable for any damages caused or alleged to be caused either directly or indirectly by this book.
Contents
SQL Server Distributed Replay ................................................................................................................................... 4
4
Tool Use When…
Breakpoint commands.
• You want to replay an Analysis Services
trace.
Distributed Replay • You want to evaluate application
compatibility. For example, you want to
test SQL Server and operating system
upgrade scenarios, hardware upgrades,
or index tuning.
• The concurrency in the captured trace
is so high that a single replay client
cannot sufficiently simulate it.
5
Distributed Replay Tasks
6
• Client configuration file
• Preprocess configuration file
• Replay configuration file
Example
This example shows a controller configuration file that has been modified to suppress
INFORMATION and WARNING log entries.
<?xml version='1.0'?>
<Options>
<LoggingLevel>CRITICAL</LoggingLevel>
</Options>
8
Setting XML Element Description Allowed Values Required
the next the client
replay. service will not
start.
Logging <LoggingLevel> Is the logging INFORMATION | No. By default,
level level for the WARNING | the value is
client service. CRITICAL CRITICAL.
Example
This example shows a client configuration file that has been modified to specify that the
controller service is running on a different computer, a computer named Controller1.
The WorkingDirectory and ResultDirectory elements have been configured to use
folders c:\ClientWorkingDir and c:\ResultTraceDir, respectively. The logging level
has been changed from the default value to suppress INFORMATION and WARNING log
entries.
<?xml version='1.0'?>
<Options>
<Controller>Controller1</Controller>
<WorkingDirectory>c:\ClientWorkingDir</WorkingDirectory>
<ResultDirectory>c:\ResultTraceDir</ResultDirectory>
<LoggingLevel>CRITICAL</LoggingLevel>
</Options>
9
The preprocess configuration settings are specified in XML elements that are children of
the <PreprocessModifiers> element in the preprocess configuration file. These
settings include the following:
Example
The default preprocess configuration file:
<?xml version='1.0'?>
10
<Options>
<PreprocessModifiers>
<IncSystemSession>No</IncSystemSession>
<MaxIdleTime>-1</MaxIdleTime>
</PreprocessModifiers>
</Options>
<ReplayOptions> Element
The settings specified by the replay configuration file in the <ReplayOptions> element
include the following:
13
Setting XML Element Description Allowed Values Required
row has
been
returned.
Threads <ThreadsPerClient> Specifies the An integer between 1 No. If not
per client number of and 512. specified,
replay Distributed
threads to Replay will
use for each use a value
replay client. of 255.
<OutputOptions> Element
The settings specified by the replay configuration file in the <OutputOptions> element
include the following:
Example
The default replay configuration file:
<?xml version='1.0'?>
<Options>
<ReplayOptions>
<Server></Server>
14
<SequencingMode>stress</SequencingMode>
<ConnectTimeScale></ConnectTimeScale>
<ThinkTimeScale></ThinkTimeScale>
<HealthmonInterval>60</HealthmonInterval>
<QueryTimeout>3600</QueryTimeout>
<ThreadsPerClient></ThreadsPerClient>
</ReplayOptions>
<OutputOptions>
<ResultTrace>
<RecordRowCount>Yes</RecordRowCount>
<RecordResultSet>No</RecordResultSet>
</ResultTrace>
</OutputOptions>
</Options>
See Also
Administration Tool Command-line Options (Distributed Replay)
SQL Server Distributed Replay
For more information about the preprocess stage, see SQL Server Distributed Replay.
Note
15
The input trace data must be captured in a version of SQL Server that is
compatible with Distributed Replay. The input trace data must also be compatible
with the target server that you want to replay the trace data against. For more
information about version requirements, see Distributed Replay Requirements.
Procedures
16
configuration file if you have modified a copy of the default preprocess
configuration file.
f. (Optional) Use the status_interval parameter, -f, to specify if you want the
administration tool to display status messages at a frequency different than
30 seconds.
For example, initiating the preprocess stage on the same computer as the
controller service, for a trace file located at c:\trace1.trc, a controller working
directory located at c:\WorkingDir , and a status message displayed at the
default value of 30 seconds, requires the syntax: dreplay preprocess -i
c:\trace1.trc -d c:\WorkingDir
3. After the preprocess stage is complete, the intermediate file is stored in the
controller working directory. To initiate the event replay stage, you must run the
administration tool with the replay option. For more information, see How to:
Replay the Trace.
See Also
SQL Server Distributed Replay
Distributed Replay Requirements
Administration Tool Command-line Options (Distributed Replay)
Distributed Replay Configuration Files
17
You can replay trace data in one of two sequencing modes: stress mode or
synchronization mode. The default behavior is to replay trace data in stress mode. For
more information about the event replay stage and sequencing modes, see SQL Server
Distributed Replay
Note
The input trace data must be captured in a version of SQL Server that is
compatible with Distributed Replay. The input trace data must also be compatible
with the target server that you want to replay the trace data against. For more
information about version requirements, see Distributed Replay Requirements.
Procedures
18
b. Modify the replay configuration settings in the new configuration file.
c. When initiating the event replay stage (the next step), use the config_file
parameter of the replay option to specify the location of the modified
configuration file.
For more information about the replay configuration file, see Distributed Replay
Configuration Files.
2. Initiate the event replay stage: To start the distributed replay, you must run the
administration tool with the replay option. For more information, see dreplay
replay Command.
a. Open the Windows Command Prompt utility (CMD.exe), and navigate to the
installation location of the Distributed Replay administration tool
(DReplay.exe).
b. (Optional) Use the controller parameter, -m, to specify the controller, if the
controller service is running on a computer different from the administration
tool.
c. Use the controller_working_directory parameter, -d, to specify where the
intermediate file was saved on the controller during the preprocess stage.
d. (Optional) Use the -o parameter to capture the replay activity in a result trace
file on each client.
e. (Optional) Use the target_server parameter, -s, to specify the instance of SQL
Server where the distributed replay clients should replay the trace workload.
This parameter is not required if you used the <Server> element to specify
the target server in the <ReplayOptions> element of the replay
configuration file.
f. Use the clients parameter, -w, to specify the distributed replay clients that
should participate in the replay. List the client computer names, separated by
commas. Note: IP addresses are not allowed.
g. (Optional) Use the config_file parameter, -c, to specify location of the replay
configuration file. Use this parameter to point to the new configuration file if
you have modified a copy of the default replay configuration file.
h. (Optional) Use the status_interval parameter, -f, to specify if you want the
administration tool to display status messages at a frequency other than 30
seconds.
For example, the following syntax initiates the replay stage on the same
computer as the controller service, uses a controller working directory located at
c:\WorkingDir, captures the replay activity on each participating client, uses
clients client1 and client2 to perform the replay, and obtains the remaining
replay configuration settings from a modified replay configuration file located at
c:\modifiedreplay.config:
dreplay replay -d c:\WorkingDir -o -w client1,client2 -c
19
c:\modifiedreplay.config
3. When the distributed replay has finished, the administration tool returns
summary information. If you specified the -o option, the replay activity has been
saved in result trace files on each client. For more information about the result
trace files, see How to: Review the Result Trace.
See Also
Distributed Replay Requirements
Administration Tool Command-line Options (Distributed Replay)
Distributed Replay Configuration Files
Replayable Audit Login One time for each Audit Upon successful
Events Login event in the completion or
original trace data failure of the
event
20
Category EventClass Name Capture Frequency Point of Capture
21
Category EventClass Name Capture Frequency Point of Capture
22
Column Descriptions for Result Trace
The following table describes the columns of the result trace data.
23
Data Column Name Data Type Description Column ID
• Total number of replayable
events
• The number of provider errors
• The number of internal errors
• Internal warnings
• Total number of errors
• Overall pass rate
• The replay time
(HH:MM:SS:MMM)
For Replay Result Set Event, this
shows the list of return result
column headers.
For Replay Result Row Event, this
shows the return value of all
columns for that row.
For Replay Internal Warning and
Replay Provider Error, this column
contains the provider warnings or
errors.
Attention bigint The attention duration (in 5
microseconds) for the event. This
is calculated from the Attention
event from the capture trace. If
there was no query time-out
specified for the event, this
column is not populated (null).
SubmitTime datetime The time when the event was 6
submitted to SQL Server.
IsSuccessful int A Boolean flag that indicates 7
whether a particular event was
successfully executed, and that
result sets were returned to the
client-side.
An event that generates a warning
(such as when an event is
cancelled because of Attention or
a user-specified time-out) is
24
Data Column Name Data Type Description Column ID
considered successful.
IsSuccessful can be one of the
following:
• 1 = successful
• 0 = failed
Duration [microsec] bigint Response time duration (in 8
microseconds) for the event. The
measurement starts when the
logon/log off/RPC/Language
event was submitted to SQL
Server.
If the event succeeds, the
measurement ends when the
complete result set has been
consumed.
If the event does not succeed, the
measurement ends at the time of
event failure or cancellation.
RowCount bigint Populated depending on the value 9
of <RecordRowCount> in the
replay configuration file:
• If <RecordRowCount> equals
Yes, this cell contains the
number of rows in the result
set that are returned by SQL
Server.
• If <RecordRowCount> equals
No, this cell is not populated
(null).
CaptureSPID int The ID of the capture session for 10
the event.
ConnectionID int The ID of the capture connection 11
for the event.
ReplaySPID int The ID of the replay session for 12
the event.
DatabaseName nvarchar The name of the database in 13
which the user statement is
25
Data Column Name Data Type Description Column ID
running.
LoginName nvarchar The user login name. This can be 14
either a SQL Server security login
or the Microsoft Windows login
credentials, in the
format domain_name\user_name.
CaptureHostName nvarchar The name of the computer on 15
which the client service is running
during capture.
ReplayHostName nvarchar The name of the computer on 16
which the client is running during
replay.
ApplicationName nvarchar The name of the client application 17
that created the SQL
Server connection during capture.
See Also
SQL Server Distributed Replay
Distributed Replay Requirements
Administration Tool Command-line Options (Distributed Replay)
Distributed Replay Configuration Files
26
User Account Requirements
SQL Server Distributed Replay controller Can be a domain user account or local user
service account account. If you use a local user account, the
administration tool, controller, and client
must all be running on the same computer.
noteDXDOC112778PADS Security
Note
We recommend that the account is
not a member of the local
Administrators group in Windows.
SQL Server Distributed Replay client service Can be a domain user account or local user
account account. If you use a local user account, the
controller, client, and target SQL Server
must all be running on the same computer.
noteDXDOC112778PADS Security
Note
We recommend that the account is
not a member of the local
Administrators group in Windows.
Interactive user account that is used to run Can be either a local user or a domain user
the Distributed Replay administration tool account. To use a local user account, the
administration tool and controller must be
running on the same computer.
Important: When you configure Distributed Replay controller, you can specify one or
more user accounts that will be used to run the Distributed Replay client services. The
following is the list of supported accounts:
• Domain user account
• User created local user account
• Administrator
• Virtual account and MSA (Managed Service Account)
• Network Services, Local Services, and System
Group accounts (local or domain) and other built-in accounts (like Everyone) are not
accepted.
27
To set the service accounts or their passwords after you install Distributed Replay, you
can use the Windows Services tool. To change the service accounts associated with the
Distributed Replay controller or client services, follow these steps:
1. Do either of the following, depending on the operating system:
• Click Start, type services.msc in the Search box, and then press ENTER.
• Click Start, click Run, type services.msc, and then press ENTER.
2. In the Services dialog box, right-click the service that you want to configure, and
then click Properties.
3. On the Log On tab, click This account.
4. Configure the user account that you want to use.
DCOM Permissions
DCOM is used for remote procedure call (RPC) communication between the controller
and the administration tool, and between the controller and all clients. You must
configure computer-wide and application-specific DCOM permissions on the controller
after the Distributed Replay features have been installed.
To configure the controller DCOM permissions, follow these steps:
1. Open dcomcnfg.exe, the Component Services snap-in: This is the tool that is used
to configure DCOM permissions.
a. On the controller computer, click Start.
28
b. Type dcomcnfg.exe in the Search box.
c. Press ENTER.
2. Configure computer-wide DCOM permissions: Grant the corresponding
computer-wide DCOM permissions for each account listed in the following table. For
more information about how to set computer-wide permissions, see Checklist:
Manage DCOM Applications.
3. Configure application-specific DCOM permissions: Grant the corresponding
application-specific DCOM permissions for each account listed in the following table.
The DCOM application name for the controller service is ProfilerServer. For more
information about how to set application-specific permissions, see Checklist: Manage
DCOM Applications.
The following table describes which DCOM permissions are required for the
administration tool interactive user account and the client service accounts:
Important
To help protect against malicious queries or denial of service attacks, make sure
that you only use a trusted user account for the client service account. This
account will be able to connect and replay workloads against the target instance
of SQL Server.
29
SQL Server Permissions
The SQL Server Distributed Replay client service accounts are used to connect to the
workload's target instance of SQL Server. Only Windows Authentication mode is
supported for these connections.
After you install the SQL Server Distributed Replay client service on a set of computers,
the security principal used for those service accounts must be granted the
sysadmin server role on the instance of SQL Server that you intend to replay the trace
workload against. This step is not performed automatically during Distributed Replay
Setup.
Data Protection
In the Distributed Replay environment, the following user accounts are granted full
access to the target server instance of SQL Server, the input trace data and result trace
files:
• The interactive user account that is used to run the administration tool.
• The controller service account.
• The client service account.
• Members of the local Administrators group on the controller.
• Members of the local Administrators group on the clients.
Important
These accounts have full access to any personally identifiable information (PII)
or sensitive information that is contained in the trace, intermediate, dispatch,
or SQL Server data files that were used by Distributed Replay.
We recommend that you take the following security precautions:
• Store the input trace data, output trace results, and database files in a location that
uses the NTFS file system (NTFS), and apply the appropriate access control lists
(ACLs). If it is needed, encrypt the data that is stored on the SQL Server computer. Be
aware that SQL Server Profiler does not apply ACLs to the trace files, or perform any
kind of data masking or obfuscation. You should delete these files quickly after use.
• Apply the appropriate ACLs and retention policy to all intermediate and dispatch files
that are generated by Distributed Replay.
• Use Secure Sockets Layer (SSL) to help secure the network transport.
30
• Delete any trace, intermediate, dispatch, and SQL Server database files that were
used for testing. The intermediate and dispatch files are stored in the working
directory on the controller and client, respectively.
See Also
SQL Server Distributed Replay
Distributed Replay Installation How-to Topics
Syntax
Usage:
31
Remarks
You can issue the following command-line options with DReplay.exe:
preprocess
Initiates the preprocess stage. The controller prepares the input trace data, which you
captured from the production environment, for replay against the target server.
replay
Initiates the event replay stage. The controller dispatches replay data to the specified
clients, launches the distributed replay, and synchronizes the clients. Optionally, each
client that was selected records the replay activity and saves result trace files locally.
status
Queries the controller and displays the current status.
cancel
Cancels the current operation that is running on the controller.
For detailed syntax information that includes the command arguments and examples,
see the following topics:
• dreplay preprocess Command
• dreplay replay Command
• dreplay status Command
• dreplay cancel Command
RPCs are replayed as RPCs and not as language events.
Permissions
You must run the administration tool as an interactive user, as either a local user or a
domain user account. To use a local user account, the administration tool and controller
must be running on the same computer.
For more information, see Distributed Replay Security.
See Also
SQL Server Distributed Replay
32
The preprocess option initiates the preprocess stage. During this stage, the controller
prepares the input trace data for replay against the target server.
For more information about the syntax conventions that are used with the
administration tool syntax, see Transact-SQL Syntax Conventions (Transact-SQL).
Syntax
Parameter Description
Note
If you are using the administration tool on a different
computer than the controller, you will need to copy the
input trace files to the controller so that a local path
can be used for this parameter.
33
with a drive letter (for example,
c:\WorkingDir).
• The path must not end with a backslash
"\".
• UNC paths are not supported.
Examples
In this example, the preprocess stage is initiated with all of the default settings. The value
localhost indicates that the controller service is running on the same computer as the
administration tool. The input_trace_file parameter specifies the location of the input
trace data, c:\mytrace.trc. Because there is no trace file filtering involved, the -c
parameter does have to be specified.
dreplay preprocess –m localhost -i c:\mytrace.trc -d c:\WorkingDir
In this example, the preprocess stage is initiated and a modified preprocess
configuration file is specified. Unlike the previous example, the -c parameter is used to
point to the modified configuration file, if you have stored it in a different location. For
example:
dreplay preprocess –m localhost -i c:\mytrace.trc -d c:\WorkingDir -c
c:\DReplay.exe.preprocess.config
In the modified preprocess configuration file, a filter condition is added that filters out
system sessions during distributed replay. The filter is added by modifying the
34
<PreprocessModifiers> element in the preprocess configuration file,
DReplay.exe.preprocess.config.
The following shows an example of the modified configuration file:
<?xml version='1.0'?>
<Options>
<PreprocessModifiers>
<IncSystemSession>No</IncSystemSession>
<MaxIdleTime>-1</MaxIdleTime>
</PreprocessModifiers>
</Options>
Permissions
You must run the administration tool as an interactive user, as either a local user or a
domain user account. To use a local user account, the administration tool and controller
must be running on the same computer.
For more information, see Distributed Replay Security.
See Also
Distributed Replay
How to: Preprocess the Trace
SQL Server Distributed Replay
Distributed Replay Configuration Files
35
dreplay replay [-m controller] -d controller_working_dir [-o]
[-s target_server] -w clients [-c config_file]
[-f status_interval]
Parameters
Parameter Description
36
You cannot use "localhost" or "." as the
target server.
The -s parameter is not required if the
<Server> element is specified in the
<ReplayOptions> section of the replay
configuration file,
DReplay.exe.replay.config.
If the -s parameter is used, the <Server>
element in the <ReplayOptions> section
of the replay configuration file will be ignored.
Note
Each client registers with the controller that is specified
in the client configuration file when the client service
starts.
Examples
In this example, the distributed replay derives much of its behavior from a modified
replay configuration file, DReplay.exe.replay.config.
• The -m parameter specifies that a computer named controller1 acts as the
controller. The computer name must be specified when the controller service is
running on a different computer.
37
• The -d parameter specifies the location of the intermediate file on the controller,
c:\WorkingDir.
• The -o parameter specifies that each specified client capture the replay activity and
save it to a result trace file. Note: The <ResultTrace> element in the configuration
file can be used to specify if row count and result set be recorded.
• The -w parameter specifies that computers client1 through client4 participate as
clients in the distributed replay.
• The -c parameter is used to point to the modified configuration file,
DReplay.exe.replay.config.
• The -s parameter is not required because the <Server> element is specified in the
<ReplayOptions> element of the replay configuration file,
DReplay.exe.replay.config.
The event replay stage is initiated with the following syntax, when the administration tool
is run from a different computer than the controller:
dreplay replay -m controller1 -d c:\WorkingDir -o -w
client1,client2,client3,client4 -c c:\DReplay.exe.replay.config
To specify a synchronous sequencing mode, the <SequencingMode> element of the
DReplay.exe.replay.config file is set equal to the value synchronization. The
<ResultTrace> section of the replay configuration file is modified to specify that row
count be recorded. These changes are shown in the following XML example:
<?xml version='1.0'?>
<Options>
<ReplayOptions>
<Server>server_name\replay_target_instance</Server>
<SequencingMode>synchronization</SequencingMode>
<ConnectTimeScale></ConnectTimeScale>
<ThinkTimeScale></ThinkTimeScale>
<HealthmonInterval>60</HealthmonInterval>
<QueryTimeout>3600</QueryTimeout>
<ThreadsPerClient></ThreadsPerClient>
</ReplayOptions>
<OutputOptions>
<ResultTrace>
<RecordRowCount>Yes</RecordRowCount>
<RecordResultSet>No</RecordResultSet>
</ResultTrace>
38
</OutputOptions>
</Options>
To specify a stress sequencing mode, the <SequencingMode> element of the
DReplay.exe.replay.config file is set equal to the value stress. The
<ConnectTimeScale> and <ThinkTimeScale> elements are set to the value 50 (to
specify 50 percent). For more information about connect time and think time, see SQL
Server Distributed Replay. These changes are shown in the following XML example:
<?xml version='1.0'?>
<Options>
<ReplayOptions>
<Server>server_name\replay_target_instance_name</Server>
<SequencingMode>stress</SequencingMode>
<ConnectTimeScale>50</ConnectTimeScale>
<ThinkTimeScale>50</ThinkTimeScale>
<HealthmonInterval>60</HealthmonInterval>
<QueryTimeout>3600</QueryTimeout>
<ThreadsPerClient></ThreadsPerClient>
</ReplayOptions>
<OutputOptions>
<ResultTrace>
<RecordRowCount>Yes</RecordRowCount>
<RecordResultSet>No</RecordResultSet>
</ResultTrace>
</OutputOptions>
</Options>
Permissions
You must run the administration tool as an interactive user, as either a local user or a
domain user account. To use a local user account, the administration tool and controller
must be running on the same computer.
For more information, see Distributed Replay Security.
See Also
How to: Replay the Trace
How to: Review the Result Trace
SQL Server Distributed Replay
Distributed Replay Configuration Files
39
Status Option (Distributed Replay Administration
Tool)
The Microsoft SQL Server Distributed Replay administration tool, DReplay.exe, is a
command-line tool that you can use to communicate with the distributed replay
controller. This topic describes the status command-line option and corresponding
syntax.
The status option queries the controller and displays the current status.
For more information about the syntax conventions that are used with the
administration tool syntax, see Transact-SQL Syntax Conventions (Transact-SQL).
Syntax
Parameter Description
Examples
In the following example, the current status is displayed every 60 seconds. The value
localhost indicates that the controller service is running on the same computer as the
administration tool.
dreplay status –m localhost -f 60
Permissions
You must run the administration tool as an interactive user, as either a local user or a
domain user account. To use a local user account, the administration tool and controller
must be running on the same computer.
For more information, see Distributed Replay Security.
40
See Also
Distributed Replay
Transact-SQL Debugger
Parameter Description
Examples
In the following example, a cancel request is submitted in quiet mode. The value
localhost indicates that the controller service is running on the same computer as the
administration tool.
dreplay cancel –m localhost -q
Permissions
41
You must run the administration tool as an interactive user, as either a local user or a
domain user account. To use a local user account, the administration tool and controller
must be running on the same computer.
For more information, see Distributed Replay Security.
See Also
SQL Server Distributed Replay
42