Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Profiler is bringing production to a halt

Author  Topic 

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2011-07-20 : 13:29:28
Hi,

I'm running profiler on a different server (connecting remotely to our production box) but it is still causing our web application to become unusable. I could use staging but then the profile would be simulated and I want a real world profile. Are there any settings I can change to still capture the necessary data but still make the application usable?

Thanks,
Craig

sql_er
Constraint Violating Yak Guru

267 Posts

Posted - 2011-07-20 : 13:34:08
Try using server side tracing.

Also, are you only recording the data you really need in your traces?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-07-20 : 14:00:57
Best practices: http://weblogs.sqlteam.com/tarad/archive/2008/08/06/SQL-Profiler-best-practices.aspx

You are likely saving the results to a table, which is a big no no.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-07-20 : 14:51:06
Yeah, profiler does that. Very bad idea to use the profiler GUI to any production server.

Server-side trace to a file on a fast, local drive (one that's not used by the databases), minimum events, minimum columns.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2011-07-20 : 15:20:39
quote:
Originally posted by GilaMonster

Yeah, profiler does that. Very bad idea to use the profiler GUI to any production server.

Server-side trace to a file on a fast, local drive (one that's not used by the databases), minimum events, minimum columns.

--
Gail Shaw
SQL Server MVP



Cool. Any idea which events and columns can be turned off without compromising the value of the results in terms of feeding it through the tuning advisor?

I am writing to file on a local drive that is on its own RAID.
Go to Top of Page

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2011-07-20 : 15:29:14
I should have clarified that the purpose of the trace is to run it through the tuning adviser. I'd like about 3 hours of data from a fairly high traffic time.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-07-20 : 15:41:37
Based on the Tuning template from Profiler:
-- Create a Queue
declare @rc int
declare @TraceID int
declare @maxfilesize bigint
declare @DateTime datetime

set @DateTime = Dateadd(hour, 3, GETDATE()) -- change hour duration if needed
set @maxfilesize = 128 -- megabytes, change if needed

-- Please replace the text InsertFileNameHere, with an appropriate
-- filename prefixed by a path, e.g., c:\MyFolder\MyTrace. The .trc extension
-- will be appended to the filename automatically.

exec @rc = sp_trace_create @TraceID output, 2, N'InsertFileNameHere', @maxfilesize, @Datetime
if (@rc != 0) goto error

-- Set the events
declare @on bit
set @on = 1
exec sp_trace_setevent @TraceID, 10, 1, @on
exec sp_trace_setevent @TraceID, 10, 3, @on
exec sp_trace_setevent @TraceID, 10, 11, @on
exec sp_trace_setevent @TraceID, 10, 35, @on
exec sp_trace_setevent @TraceID, 10, 12, @on
exec sp_trace_setevent @TraceID, 10, 13, @on
exec sp_trace_setevent @TraceID, 45, 1, @on
exec sp_trace_setevent @TraceID, 45, 3, @on
exec sp_trace_setevent @TraceID, 45, 11, @on
exec sp_trace_setevent @TraceID, 45, 35, @on
exec sp_trace_setevent @TraceID, 45, 12, @on
exec sp_trace_setevent @TraceID, 45, 28, @on
exec sp_trace_setevent @TraceID, 45, 13, @on
exec sp_trace_setevent @TraceID, 12, 1, @on
exec sp_trace_setevent @TraceID, 12, 3, @on
exec sp_trace_setevent @TraceID, 12, 11, @on
exec sp_trace_setevent @TraceID, 12, 35, @on
exec sp_trace_setevent @TraceID, 12, 12, @on
exec sp_trace_setevent @TraceID, 12, 13, @on

-- Set the Filters
declare @intfilter int
declare @bigintfilter bigint

-- Set the trace status to start
exec sp_trace_setstatus @TraceID, 1

-- display trace id for future references
select TraceID=@TraceID
goto finish

error:
select ErrorCode=@rc

finish:
go
Make sure to put the real file name in. The trace will automatically roll over to a new file. You'd run this script in a query window at the start of the time interval you want to measure.

If you have any other events, columns or filters you want to apply, you can add them in Profiler, then Export the trace definition to a SQL file. Be advised that the exported script DOES NOT properly set the trace rollover setting (sets 0 instead of 2), you'll have to fix that by hand.
Go to Top of Page

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2011-07-20 : 15:44:30
Awesome. So running it as a script instead of through the GUI is much better for performance? Seems odd - but I'll give it a try!
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-07-20 : 15:55:37
Much. The GUI requires latches and network delays and time to process. The file is just a direct write. Much less overhead.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -