+ All Categories
Home > Documents > Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes...

Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes...

Date post: 06-May-2018
Category:
Upload: truongxuyen
View: 220 times
Download: 3 times
Share this document with a friend
23
Exploring Distributed Replay
Transcript
Page 1: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring

Distributed

Replay

Page 2: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay

Contents

Verify Distributed Replay setup ...................................... 3

Setup the linked servers for tracing .............................12

Trace query execution with SQL Server Profiler ........15

Replay trace using Distributed Replay .........................18

Terms of use ..................................................................... 22

Page 3: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 3

Estimated time to complete lab is 30 minutes

When considering updating your database environments, you will to

understand the performance impact on your workloads. The

Distributed Replay Concurrency feature allows you to capture the trace

in one environment, then deploy it to another. Distributed replay

captures an environment-wide workload trace by running on one

controller computer which orchestrates one or more client computers’

actions. The captured trace is then run against a target server. The

configuration files control which computers are linked as clients and

what is logged in the trace. For this tutorial, there is one client which is

the same computer as the controller

You will now check the controller configuration.

Connect to SQLONE computer

1. Click on SQLONE button on right side of the screen to connect

to the SQLONE computer. If you see the following in the lower

right corner of the screen, you can jump to step 5 below to set

your screen resolution.

2. Click Send Ctrl-Alt-Del for SQLONE computer and then click

Switch user.

3. Click Send Ctrl-Alt-Del for SQLONE computer again and then

click Other user.

4. Log on to SQLONE computer as labuser with password

pass@word1

Note, if you have a monitor that supports a larger screen resolution than

1024 x 768, you can change the screen resolution for the lab to go as

high as 1920 x 1080. By going to a higher screen resolution, it will be

easier to use SQL Server Management Studio.

Verify Distributed Replay setup

Page 4: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 4

5. Right click on the desktop and click on Screen resolution.

6. Select 1366 x 786 (a good minimum screen size for using

SSMS) and click OK.

7. Click Keep Changes.

8. Resize the client holLaunchPad Online window for the lab to

fit your screen resolution.

Set up Distributed Replay

9. Click on the Windows Start button

10. Type Notepad

11. Notepad will now show under search, right-click on notepad

and select Run as administrator

12. Click on Yes if prompted for User Access Control

13. In the File menu of Notepad, select Open…

14. Change the document filter drop-down box from Text

Documents (*.txt) to All Files (*.*)

15. Navigate to C:\Program Files (x86)\Microsoft SQL

Server\120\Tools\DReplayController

16. Highlight DReplayController.config and then click Open

17. Verify the contents read (update and save if necessary):

Page 5: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 5

The log will only record critical events, suppressing information and

warning events. This is the default setting

Set up the Client configuration

1. In the File menu of Notepad, select Open…

2. Change the document filter drop-down box from Text

Documents (*.txt) to All Files (*.*)

3. Navigate up one folder level to the folder DReplayClient

4. Highlight DReplayClient.config and then click Open

5. Verify the contents read (update and save if necessary):

This tells the client to respond to the controller on the localhost, save its

files into the directories specified and also to only log critical events

Check the Preprocess configuration.

The preprocess configuration defines settings for when the controller is

preparing the captured trace data for replay

6. In the File menu of Notepad, select Open…

Page 6: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 6

7. Change the document filter drop-down box from Text

Documents (*.txt) to All Files (*.*)

8. Navigate up one folder level to the folder Binn

9. Highlight DReplay.Exe.Preprocess.config and then click on

Open

10. Verify the contents read (update and save if necessary):

Check the Replay Configuration file

11. In the File menu of Notepad, select Open…

12. Change the document filter drop-down box from Text

Documents (*.txt) to All Files (*.*)

13. Double-click on DReplay.Exe.Replay.config to open it

14. Verify the contents read (update and save if necessary):

Page 7: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 7

15. Close Notepad

Check the client has access to the controller

During installation, this client was set up to use the local user account for

simplicity’s sake, meaning the client, controller and target server must all

be on the same computer. However, a network user role or service role

could be used instead in a more-extensible installation

16. Click on the Windows Start button

17. Type Services.msc

18. Services will now show under search, right-click on Services

and select Run as administrator

Page 8: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 8

19. Scroll down to SQL Server Distributed Replay Client and

right-click on it and select Properties

20. Click on the Log On tab

21. Ensure This account: is showing contoso\labuser. If not, give

contoso\labuser as the account name and pass@word1 as the

password and confirm password.

22. Click OK

23. Click on the Windows Start button

Page 9: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 9

24. Type Component Services

25. Component Services will now show under search, right-click on

Component Services and select Run as administrator

26. Expand Component Services in the left-most pane and then

Computers and then My Computer

27. Expand DCOM Config in the left-hand pane

28. Scroll-down to DReplayController and then right-click on it

and select Properties

29. Click on the Security tab

30. Ensure Customize is selected for Launch and Activation

Permissions and then click Edit

31. Verify LabUser is listed with the Local Activation box ticked

Page 10: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 10

32. Click OK

33. Close all Component Services pop-up boxes and its main

window

If the client and computer were not on the same machine, you would

also have to configure the firewall and network transport method. This is

not covered in this tutorial

Start the controller and client services running

34. In Services, scroll down to SQL Server Distributed Replay

Controller and then right-click on it, then select Start

Page 11: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 11

35. Right-click on SQL Server Distributed Replay Client and

select Start

If the client starts then immediately stops, check you have correctly set

the configuration file as typos in the directory names can cause this

behavior.

Page 12: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 12

SQL Server Replay is not able to playback sessions that include Linked

Servers. In this scenario, you will setup a linked server environment

between SQLONE and SQLTHREE instances and then prepare to

execute a query for tracing and replay using Distributed Replay.

Set and enable SQLTHREE sa password

1. Log in to SQLONE

2. On SQLONE, open SQL Server Management Studio and

connect to SQLTHREE database engine using Windows

authentication

3. Expand Security and then Logins

4. Right-click on sa and select Properties

5. Change the password and confirm password to Password1

6. Click on Status and ensure Enabled is selected next to Login

Setup the linked servers for tracing

Page 13: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 13

7. Click OK

8. Do not close Management Studio

Create a Linked server on SQLONE

1. In Management Studio, click the Connect drop-down at the

top of Object Explorer pane and select Database Engine

2. Give SQLONE as the server name and ensure Windows

Authentication is selected, then click Connect

3. Right-click on Server Objects under the SQLONE connection

in the Object Explorer and then click on New and then Linked

Server

4. Enter SQLTHREE in Linked server and select SQL Server radio

button

Page 14: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 14

5. Click on Security and select Be made using this security

context

6. In Remote login enter sa

7. In With password enter Password1

8. Click OK

Create a Linked server on SQLTHREE

1. Right-click on Server Objects under the SQLTHREE

connection in the Object Explorer and then click on New and

then Linked Server

2. Enter SQLONE in Linked server and ensure SQL Server radio

button is selected

Page 15: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 15

3. Click on Security and select Be made using this security

context

4. In Remote login enter sa

5. In With password enter Password1

6. Click OK

Open the query file used for the trace and replay

7. Click on SQLONE server in Object Explorer

8. Select File menu, select Open then File…

9. Navigate to C:\SQLSCRIPTS\E2 and select E2B-4#1-

MultiServer Query

10. Click Open

11. Press Execute to see the results. The query should return 2517

rows.

Create the trace to replay

1. Open SQL Server 2014 Management Studio

2. In server name enter SQLONE and ensure Authentication is set

to Windows Authentication

3. Click Connect

4. In the Tools menu, select SQL Server Profiler

Trace query execution with SQL Server Profiler

Page 16: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 16

5. In server name enter SQLONE and ensure Authentication is set

to Windows Authentication

6. Click Connect

7. Enter Trace as the trace name

8. Select TSQL_Replay in Use the Template

9. Check the Save to file checkbox

10. Navigate to C:\DRTraces

NOTE: this should currently be an empty folder.

11. Click Save

12. Click the Events Selection tab in the Trace Properties window

You are going to filter the trace to only record events completed by the

query, so the trace is more readable.

Page 17: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 17

13. Scroll right until you see the NTUserName column

14. Click on the NTUserName column header to open an Edit

Filter dialog

15. Expand the Like filter in the middle and type labuser into the

textbox

16. Click OK to create the filter.

17. Click Run to start the tracer running

Run the trace workload

1. Switch back to SQL Server 2014 Management Studio

Page 18: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 18

2. Click in side the Multi-server query editor.

3. Click Execute

This script connects to multiple servers within the environment, so its

trace could not be replayed with Profiler. However, Distributed Replay is

designed to cope with such complicated, environment-wide traces.

NOTE: this query was run against existing linked servers.

4. Return to SQL Profiler and stop the trace by clicking on

5. Leave SQL Profiler open

Replay the Trace

1. Click on the Windows Start button

2. Type cmd

3. Command Prompt will now show under search, right-click on

Command Prompt and select Run as administrator then click

Yes

4. Type

and then press the ENTER key

5. Type

and then press the Enter key

This processes the trace data in C:\DRTraces\trace.trc into a

replayable form (stored in C:\DRControllerWorkingDir) based on the

SQLONE distributed replay controller.

Replay trace using Distributed Replay

cd "C:\Program Files (x86)\Microsoft SQL

Server\120\Tools\Binn"

dreplay preprocess -m SQLONE -i C:\DRTraces\trace.trc -d

C:\DRControllerWorkingDir

Page 19: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 19

6. Type

and then press the Enter key.

This actually does the replay using the localhost controller, the input

form in C:\DRControllerWorkingDir, creates output (in the default

folder of the specified controller) replayed with SQLTHREE as the host

server and SQLONE as a client, with status updates ever 10 units.

NOTE: there should be a space between the f and the 10.

NOTE: this step will take up to a minute to complete. The output lines

are current-status updates, so a line saying 0 events replayed is not a

problem, it merely means no events have been replayed yet. The

command has finished once the command prompt C:\Program Files

(86)\Microsoft SQL Server\120\Tools\Binn> has reappeared as the latest

line.

If this step results in an error (the first line of output is not Dispatching

in progress) double-check that the Config files are correct.

You are expecting the pass rate in the second-to-last line of output to be

100%.

dreplay replay -m localhost -d C:\DRControllerWorkingDir

-o -s SQLTHREE -w SQLONE -f 10

Page 20: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 20

See the Results

1. Open File Explorer and browse to C:\DRResultDir

2. Double-click on ReplayResult which will open it in SQL Server

Profiler.

3. Find the batch completed line in the middle of the trace.

Note the duration and RowCounts values for this query. You will need to

scroll sideways to find these values.

4. Go back to the other SQL Server Profiler window

5. Scroll through the trace in this window (the input into the

distributed replay) and find the same BatchCompleted row as

in the output trace.

Page 21: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 21

Compare the RowCounts value and the duration (calculable as EndTime

– StartTime) with the values from the result trace. The RowCounts values

should be the same, and the durations should be similar as the two

servers you ran the trace against are identically configured

Note the duration values would likely be different if the servers were

differently-configured

You can now be confident that you can replay traces involving

complicated environments using Distributed Replay Concurrency.

6. Close everything without saving.

Page 22: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 22

© 2014 Microsoft Corporation. All rights reserved.

By using this Hands-on Lab, you agree to the following terms:

The technology/functionality described in this Hands-on Lab is

provided by Microsoft Corporation in a “sandbox” testing environment

for purposes of obtaining your feedback and to provide you with a

learning experience. You may only use the Hands-on Lab to evaluate

such technology features and functionality and provide feedback to

Microsoft. You may not use it for any other purpose. You may not

modify, copy, distribute, transmit, display, perform, reproduce, publish,

license, create derivative works from, transfer, or sell this Hands-on Lab

or any portion thereof.

COPYING OR REPRODUCTION OF THE HANDS-ON LAB (OR ANY

PORTION OF IT) TO ANY OTHER SERVER OR LOCATION FOR FURTHER

REPRODUCTION OR REDISTRIBUTION IS EXPRESSLY PROHIBITED.

THIS HANDS-ONLAB PROVIDES CERTAIN SOFTWARE

TECHNOLOGY/PRODUCT FEATURES AND FUNCTIONALITY,

INCLUDING POTENTIAL NEW FEATURES AND CONCEPTS, IN A

SIMULATED ENVIRONMENT WITHOUT COMPLEX SET-UP OR

INSTALLATION FOR THE PURPOSE DESCRIBED ABOVE. THE

TECHNOLOGY/CONCEPTS REPRESENTED IN THIS HANDS-ON LAB

MAY NOT REPRESENT FULL FEATURE FUNCTIONALITY AND MAY NOT

WORK THE WAY A FINAL VERSION MAY WORK. WE ALSO MAY NOT

RELEASE A FINAL VERSION OF SUCH FEATURES OR CONCEPTS. YOUR

EXPERIENCE WITH USING SUCH FEATURES AND FUNCITONALITY IN A

PHYSICAL ENVIRONMENT MAY ALSO BE DIFFERENT.

FEEDBACK. If you give feedback about the technology features,

functionality and/or concepts described in this Hands-on Lab to

Microsoft, you give to Microsoft, without charge, the right to use, share

and commercialize your feedback in any way and for any purpose. You

also give to third parties, without charge, any patent rights needed for

their products, technologies and services to use or interface with any

specific parts of a Microsoft software or service that includes the

feedback. You will not give feedback that is subject to a license that

requires Microsoft to license its software or documentation to third

parties because we include your feedback in them. These rights survive

this agreement.

MICROSOFT CORPORATION HEREBY DISCLAIMS ALL WARRANTIES

AND CONDITIONS WITH REGARD TO THE HANDS-ON LAB ,

INCLUDING ALL WARRANTIES AND CONDITIONS OF

MERCHANTABILITY, WHETHER EXPRESS, IMPLIED OR STATUTORY,

FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-

INFRINGEMENT. MICROSOFT DOES NOT MAKE ANY ASSURANCES OR

Terms of use

Page 23: Exploring Distributed Replay€¦ ·  · 2014-11-20Estimated time to complete lab is 30 minutes ... Exploring Distributed Replay 5 ... execute a query for tracing and replay using

Exploring Distributed Replay 23

REPRESENTATIONS WITH REGARD TO THE ACCURACY OF THE

RESULTS, OUTPUT THAT DERIVES FROM USE OF THE VIRTUAL LAB, OR

SUITABILITY OF THE INFORMATION CONTAINED IN THE VIRTUAL LAB

FOR ANY PURPOSE.

DISCLAIMER

This lab contains only a portion of new features and enhancements in

Microsoft SQL Server 2014. Some of the features might change in

future releases of the product. In this lab, you will learn about some,

but not all, new features.


Recommended