Performing A Distributed Replay With Multiple Clients Using SQL Server 2012 Distributed Replay
Performing A Distributed Replay With Multiple Clients Using SQL Server 2012 Distributed Replay
https://www.sqlskills.com/blogs/jonathan/performing-a-distributed-replay-with-multiple-clients-
using-sql-server-2012-distributed-replay/
In the first post in this blog series on using SQL Server 2012 Distributed Replay, Installing and
Configuring SQL Server 2012 Distributed Replay, we looked at how to configure a Distributed
Replay environment using multiple clients and a dedicated replay controller. In this post we’ll
actually make use of the previously configured servers to perform a distributed replay using a
random workload that has been generated against the AdventureWorks2008R2 database installed
on our Replay SQL Server.
Verbs:
preprocess Apply filters and prepare trace data for intermediate file on controller.
replay Transfer the dispatch files to the clients, launch and synchronize replay.
status Query and display the current status of the controller.
cancel Cancel the current operation on the controller.
-? Display the command syntax summary.
Options:
dreplay preprocess [-m controller] -i input_trace_file -d controller_working_dir [-c config_file]
[-f status_interval]
dreplay replay [-m controller] -d controller_working_dir [-o] [-s target_server] -w clients [-c
config_file] [-f status_interval]
dreplay status [-m controller] [-f status_interval]
dreplay cancel [-m controller] [-q]
Run dreplay <verb> -? for detailed help on each verb.
To perform the preprocessing, you will need to do a couple of different steps. The first thing you
need to do is edit any options that you want to set for the pre-processing by editing the
DReplay.Exe.Preproces.config file in the C:\Program Files (x86)\Microsoft SQL
Server\110\Tools\Binn path on the server. There are two configuration files for DReplay.Exe as
highlighted below. At this time make sure that you are only editing the Preprocess.config file.
Then execute the following command from within the Binn path to actually preprocess the trace
file and output:
This will process the trace file and output the working files for performing the Distributed
Replay to the C:\DReplay path. Below is a screenshot of the full window for preprocessing the
trace file.
Note: The dreplay executable can be called from any path within the server because the Binn
path is a part of the Path Environmental variables. However, the executable has to be called
from within the Binn folder to access the necessary .config files and .xsd schema files for the
configuration. If you want to be able to run this executable from another location on the server,
you will need to copy the .config and .xsd files out of the Binn folder to the folder that you want
to be able to run dreplay within for it to work.
Performing the Replay
The first step in performing the replay is to start the “SQL Server Distributed Replay Client”
service on each of the replay clients using NET START.
You will want to verify that each of the clients was able to successfully connect to the controller
in the logs as shown in the previous post in this series. Once this has been done, your
environment is almost ready for replay. For the purposes of this blog series, a SELECT only
workload has been generated for replay against AdventureWorks2008R2. However, in most
environments you won’t have a SELECT only workload, so you will have to plan for and
prepare your replay environment using a BACKUP/RESTORE of the production database from a
point within the captured workload so that the database can be replayed against without having
problems associated with Primary Key constraint violations during the replay.
If you want to change any of the parameters associated with the replay operation, you can edit
the DReplay.Exe.Replay.config file in the C:\Program Files (x86)\Microsoft SQL
Server\110\Tools\Binn path. The default contents of the configuration file are shown below:
Before performing the actual replay, make sure that the account being used to run the SQL
Server Distributed Replay Client service has been granted appropriate access to the target SQL
Server and database to be able to perform the replay operations. Once this has been done replay
can be performed using the command line options for DReplay.Exe by providing the appropriate
switches, or you can alternately provide the –c command line switch to specify the configuration
file that should be used for performing the replay. If you change any of the default values listed
above in the DReplay.Exe.Replay.config file, you will need to specify the –c command line
switch for those to take effect. To perform a replay with the defaults, the following command
line execution can be run:
Once this is executed, the Distributed Replay Controller will take read in the preprocessed replay
file, and then synchronize the replay across all of the clients specified with the –w command line
parameter. While the replay operation occurs, the command window for the controller will
output periodic updates about the current status of the replay process.
The frequency of the status updates can be controlled using the –f command line switch to
specify the number of seconds between each of the updates. Each of the status updates will
provide information about each of the clients including the total number of events that have been
replayed, the success rate of the replay operations per client, as well as an estimate for the total
amount of time remaining to complete the replay operation. When the replay completes the total
elapsed time and pass rate for the events is output.
In the next and final post in this series, we’ll look at some of the common problems with using
Distributed Replay and how to resolve them, including manually configuring the Controller and
add additional Client Service accounts to the environment after Setup has been completed.
Related Posts
Posted in: Benchmarking, Database Administration, Distributed Replay, SQL Server 2012, SQL
Server Denali
19 Comments
Hi Jonathan,
I’m about to try this to see if possible, however thought i would see if you have any ideas.
i am currently stress testing a bespoke application using Dreplay. I have captured a trace
file from an end to end system that had 5 users running random UI activity. However
when i fire this off from 5 VM’s each one of those 5 users activities are going to fire at
the same time across 5 dreplay clients ( same queries execute synchonously across 5
VM’s) Is it in anyway possible to fire up 5 cmd line windows each to control one of the
vm’s replay activities and offset the start time with teh config file by 5 seconds on each
one? this will mean there is some offset between each dreplay client to avoid inducing
locking on certain resources caused by executing the same session queries 5 times in
parralel
Reply
Hey Jay,
If you do a synchronized replay, then it will fire off exactly like it did for the
capture so you wouldn’t need to offset each of the machines during the replay,
you would just need to offset them during your initial workload generation period.
Reply
Hi Jonathan I followed your steps but got the error message above. I went into
component services and added permissions for DReplay for launch and activate, access
and configuration permissions. I was able to preproces my trace file and and can see from
the. The log file here C:\Program Files (x86)\Microsoft SQL
Server\110\Tools\DReplayClient\Log that the client is registered with the controller. Can
you think of anything I can try?
Reply
never mind it looks like DReply does not like the FQDN. That is why I got that error.
Reply
4. Srdjan says:
Can you leverage the TSQL or a custom Profiler template instead of the TSQL_Replay
for Distributed Replay?
Thank you.
Reply
You can, but if the events are not included like they are in the TSQL_Replay
profiler template, you won’t be able to perform a replay operation. Why do you
need to customize the TSQL_Replay template that ships with Profiler, except for
filtering on a specific database or user, which you can do in either an scripted
copy of the template or when setting up the trace to begin with?
Reply
Srdjan says:
Thank you Jonathan. Our existing server traces are not based on the
TSQL_Replay profile. Instead of matching them, we developed a custom
Replay application.
Reply
Hey Johnathon,
Great article as always!!! Excellent detail and easy to follow. My one question is I’d like
to simulate what the response times would look if I doubled or tripled the workload on
the server. Is that possible through Distributed Replay? Is that what the Connect Time
Scale and Think Time Scale are for? Or should I be upping the threads per workstation?
I’ve tried a couple things with no luck. However my problem could also be that I only
have 3 workstation clients. If you could point me in the right direction, I’d really
appreciate it.
Reply
Hey Jason,
You can drive higher volumes of load with stress mode and scaling the connect
and think time, but it’s not necessarily going to be linear or predictable like you
might hope. You may just have to play with the values to see where you get the
double/triple TPS from the captured workload.
Reply
6. Akshay says:
Hi Jonathan,
I want to read the extended events(.xel) file through distributed replay. I have used the
readtrace RML utility and converted .Xel file to .TRC file. I have used the standard
sample Extended event template which is part of RML utility.
The Preproccesss phase completes successfully, but when I run the replay process I am
getting some errors, I checked in the Controller log and the client log:
In Controller Log:
2016-01-05 16:52:52:129 OPERATIONAL [Controller Service] Event replay in
progress. Detailed options:
2016-01-05 16:52:52:129 OPERATIONAL [Controller Service] Target DB Server:
[DBTestServer].
2016-01-05 16:52:52:129 OPERATIONAL [Controller Service] Controller Working
Directory: [D:\DRDemo].
2016-01-05 16:52:52:129 OPERATIONAL [Controller Service] Generate Result Trace:
[No].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Sequencing Mode:
[STRESS].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Connect Time Scale:
[100].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Think Time Scale:
[100].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Healthmon Polling
Interval: [60].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Query Timeout: [3600].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Data Provider Type:
[ODBC].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Threads Per Client:
[255].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Record Row Count:
[Yes].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Record Result Set:
[Yes].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Connection Pooling
Enabled: [No].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Stress Scale Granularity:
[SPID].
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Replay Clients:
[DBTestServer].
2016-01-05 16:52:52:145 CRITICAL [Controller Service] [0xC821001D] Failed to
assign an event with connection ID [917561] to any client.
2016-01-05 16:52:52:145 OPERATIONAL [Controller Service] Event dispatch in
progress.
2016-01-05 16:52:52:145 CRITICAL [Controller Service] **** Critical Error ****
2016-01-05 16:52:52:145 CRITICAL [Controller Service] Machine Name:
DBTestServer
2016-01-05 16:52:52:161 CRITICAL [Controller Service] Error Code: 0xC8502100
2016-01-05 16:52:52:176 OPERATIONAL [Controller Service] Event replay completed.
2016-01-05 16:52:52:176 OPERATIONAL [Controller Service] Elapsed time: 0 day(s), 0
hour(s), 0 minute(s), 0 second(s).
2016-01-05 16:52:52:223 CRITICAL [Controller Service] [0xC8210003] Event manager
is not running.
2016-01-05 16:52:52:223 CRITICAL [Controller Service] **** Critical Error ****
2016-01-05 16:52:52:223 CRITICAL [Controller Service] Machine Name:
DBTestServer
2016-01-05 16:52:52:239 CRITICAL [Controller Service] Error Code: 0xC8502100
2016-01-05 16:52:52:239 CRITICAL [Controller Service] Unadvise callback interface –
failed, invalid arguments.
In Client Log:
2016-01-05 16:52:52:223 CRITICAL [Client Replay] [0xC8120004] Failed to receive
trace start time from controller with return code 0xC8502100.
2016-01-05 16:52:52:239 OPERATIONAL [Client Replay] Event replay completed.
2016-01-05 16:52:52:239 OPERATIONAL [Client Replay] 0 events replayed in total.
2016-01-05 16:52:52:254 CRITICAL [Client Service] Critical Error: code=[c8503101],
msg=Failed to receive replay data from controller, confirm network connectivity and
restart the Distributed Replay Utility services on both client and controller computers.
Reply
7. SQLDerp111 says:
Hi Jonathan,
I was wondering if you always pre-generate the .trc file through profiler or trace, or if you
have a way to tie this into Extended Events (i.e. is the above poster’s problem seen
often?)? You assume a .trc file to pre-process — could you link to your most recent
articles on how to efficiently create these?
Also, as far as I can see, there is no additional post on common problems… While I know
this is an older series, I was wondering if you could update it for SQL 2014/2016; maybe
just add a note if the basics still apply? Or point us in a new direction if there are newer
features/replacements for this functionality?
Thanks!
Reply
The basics still apply the same in 2014 and 2016. Nothing has changed with
Distributed Replay as far as I know since 2012 introduced it. You have to use a
.trc file for input into Distributed Replay and the Trace Replay template in profiler
has the correct events, but you should use a server side trace to file and not
Profiler to collect the trace data. READTRACE from RML Utilities can convert a
XEvent file to trc format for use with Distributed Replay but there is a current
issue where it doesn’t always work for replay so Trace is still your best bet.
Reply
8. Dan says:
Hi Everyone,
my english is bad but i hope you can understand.
I have some problem with distributed replay especially when i run : dreplay replay…
Here is my error :
Error DReplay Could not find any resources appropriate for the specified culture or the
neutral culture. Make sure
“Microsoft.SqlServer.Management.DistributedReplay.ExceptionTemplates.resources”
was correctly embedded or linked into assembly
“Microsoft.SqlServer.Management.DistributedReplay” at compile time, or that all the
satellite assemblies required are loadable and fully signed.
Thanks
Reply
Do you have multiple versions of SQL Server installed side-by-side on the same
machine? That is the only thing that I can think of that would lead to this problem.
Reply
Dan says:
Reply
9. SGouin says:
Hi Jonathan,
It works great for a single client but when I’m trying to register a second machine to the
controller it never show up in the status.
All Service use the same Domain account that have local admin privilege on SQLLab02
and SQLLab03.
DCOM Security has also been set to everyone (Allow local & Remote) on both server
(Computer access and Application access security)
Here is the Client log file of SQLLab03 when the service start:
2018-02-22 09:31:27:667 OPERATIONAL [Client Service] Microsoft SQL Server
Distributed Replay Client – 13.0.1601.5.
2018-02-22 09:31:27:667 OPERATIONAL [Client Service] © Microsoft Corporation.
2018-02-22 09:31:27:668 OPERATIONAL [Client Service] All rights reserved.
2018-02-22 09:31:27:671 OPERATIONAL [Client Service] Current edition is:
[Developer Edition].
2018-02-22 09:31:27:671 OPERATIONAL [Common] Initializing dump support.
2018-02-22 09:31:27:672 OPERATIONAL [Common] Failed to get DmpClient.
[HRESULT=0x8007007F]
2018-02-22 09:31:27:673 OPERATIONAL [Client Service] Windows service “Microsoft
SQL Server Distributed Replay Client” has started under service account
“XXXXXXXXXXXX”. Process ID is 7720.
2018-02-22 09:31:27:674 OPERATIONAL [Client Service] Time Zone: Eastern
Standard Time.
2018-02-22 09:31:27:676 OPERATIONAL [Client Service] Controller name is
“SQLLab02”.
2018-02-22 09:31:27:677 OPERATIONAL [Client Service] Working directory is
“C:\Program Files (x86)\Microsoft SQL Server\130\Tools\DReplayClient\WorkingDir”.
2018-02-22 09:31:27:677 OPERATIONAL [Client Service] Result directory is
“C:\Program Files (x86)\Microsoft SQL Server\130\Tools\DReplayClient\ResultDir”.
2018-02-22 09:31:27:678 OPERATIONAL [Client Service] Heartbeat Frequency(ms):
3000
2018-02-22 09:31:27:679 OPERATIONAL [Client Service] Heartbeats Before Timeout:
3
No error shown anywhere (Real Account has been replaced here by XXXXXXXXXXX)
Reply
Developer Edition only allows one replay client. The controller has to be a full
Enterprise Edition licensed install for multiple replay clients.
Reply
SGouin says:
Thanks Jonathan, I can also see that restriction in the SQL Server Edition
comparaison list.
I guess the main used case for that feature (with multiple clients) is to test
your production infrastructure in a maintenance windows.
Have you blogged (or intend to blog) about how to scale the charge with
distributed replay? It seems that there is not a lot of documentation on how
to play with those configuration parameters. Default value already seems
to be set to its maximum of 100%. in “DReplay.Exe.Replay.xml”
Thanks
Reply