Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Does this sound like a good place to enable "Optimize for ad-hoc workloads?" Expand / Collapse
Author
Message
Posted Friday, June 28, 2013 12:35 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 10:27 AM
Points: 988, Visits: 5,186
I recently ran the "Server Dashboard" report on a new server here. Imagine my reaction to seeing Adhoc Queries sucking up ~75% of the cumulative CPU Usage and 80-90% of the Logical IO!

So I started looking into the "Optimize for adhoc workloads." I read the articles by Kimberly Tripp, Technet stuff, and others, and it sounds like it may not be a bad idea to enable.

The server in question only has 4GB of RAM, and I suspect I could put in a request to get it doubled, but it's like pulling teeth from an angry hyena...

Running a couple queries agains dm_exec_cached_plans, out of 12975 cached plans, 10148 are adhoc, and 4910 of those are with usecounts of 1...

Now, I know enabling this won't immediately have an effect on the plan cache, and it will have something of a detrimental effect on the adhoc queries (no cached plan, takes longer to run.) I'd enable it in a test environment first, but the test server won't get hit as hard as the production...

So anyways, does it sound like it might provide some benefit to enable this option?

Thanks,
Jason
Post #1468676
Posted Friday, June 28, 2013 2:04 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 2:20 PM
Points: 1,228, Visits: 986
Hi,

Without knowing more about the server it is hard to make a call. How many and now big are the databases on it? What type of work load does it churn throughout one business cycle?

Andrew
Post #1468700
Posted Monday, July 1, 2013 1:30 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:27 PM
Points: 7,127, Visits: 12,657
jasona.work (6/28/2013)
I recently ran the "Server Dashboard" report on a new server here. Imagine my reaction to seeing Adhoc Queries sucking up ~75% of the cumulative CPU Usage and 80-90% of the Logical IO!

So I started looking into the "Optimize for adhoc workloads." I read the articles by Kimberly Tripp, Technet stuff, and others, and it sounds like it may not be a bad idea to enable.

The server in question only has 4GB of RAM, and I suspect I could put in a request to get it doubled, but it's like pulling teeth from an angry hyena...

Running a couple queries agains dm_exec_cached_plans, out of 12975 cached plans, 10148 are adhoc, and 4910 of those are with usecounts of 1...

Now, I know enabling this won't immediately have an effect on the plan cache, and it will have something of a detrimental effect on the adhoc queries (no cached plan, takes longer to run.) I'd enable it in a test environment first, but the test server won't get hit as hard as the production...

So anyways, does it sound like it might provide some benefit to enable this option?

Thanks,
Jason

Using a modified version of Kimberly's script helped me tame one SQL 2005 instance (no optimize for adhoc available) I had running on a 32-bit system with only 2.5 GBs of RAM set aside for the buffer pool: Plan cache, adhoc workloads and clearing the single-use plan cache bloat. If I had had the option I most definitely would have enabled optimize for adhoc.

Personally I do not see many downsides to enabling the setting, even on a system where stored procedures are predominantly used. The overhead of generating the stub-plan the first time around and deferring the full plan being cached until the second use has not proven to be detrimental to any of my systems. I enable the setting by default on all new instances.

If you are concerned or just simply want to see how it goes in a non-production environment you could run a Trace in production using the Replay template (server-side to a file though, not to a Profiler rowset) for as long as your system can stand it performance-wise. Then use that Trace file as a workload to run against a non-production database (after restarting the instance to slcear all caches) with the setting off, take your timings, and then run the workload again after enabling the setting and restarting the instance (to clear all caches again) to see if there is any negligible difference in performance or plan cache usage.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1469203
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse