Sql server 2008 R2 --- procedure Cache

  • Hi

    We have a sql server 2008 R2 on physical server with RAM-- 512 gb.

    we have around 300 gb of data in disk, the sql server memory has been set to 485gb.

    sql server is using around 300gb of the memory.

    the question here is, the plan cache hit ratio is only 65%.

    can u please help me resolve this and increase the plan cache hit ratio to 100%

    we are doing around 7000 batches/sec

    we have enabled optimize for ad-hoc workloads to true and forced parameterization.

    thanks for the help,

  • Are you having performance problems due to the compiles?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • kind of..

    the compiles/sec are almost half of the batches/sec

    but as we don't have much load on the system, it is not really affecting.

    the end user may see a delay if the query that came in was huge and has to be compiled again.

    but we need to fix the compiles. i feel as the proc cache is being cleared, the compiles are going up.

  • I guess then that you are not using stored procedures?

    I've looked at a couple of apps we have which don't use procs and I notice that often plan reuse just doesn't happen.

    You probably need to examine the queries in the cache to see what's not being reused, probably a fairly tedious task. The proc cache will only grow to a certain %age of size so maybe you're actually getting what can be best described as cache paging.

    Although the reuse of sql plans/ad hoc queries is much better now it's still not perfect - it's amazing sometimes to see the volume of queries which parametise for msdb.

    [font="Comic Sans MS"]The GrumpyOldDBA[/font]
    www.grumpyolddba.co.uk
    http://sqlblogcasts.com/blogs/grumpyolddba/

  • That's true, we don't use SP's a lot. Most of the queries are ad-hoc.

    why i am concerned about this memory is, we see CMEMTHREAD waits only in this server( version sql server 2008 R2).the other servers( version sql server 2008 sp1) have the same application code and the plan cache hit is low, but there is no CMEMTHREAD wait.

    can you please help resolving the CMEMTHREAD waits.

  • I'm not an expert by any means on waits, but you could find this very useful : http://download.microsoft.com/download/4/7/a/47a548b9-249e-484c-abd7-29f31282b04d/Performance_Tuning_Waits_Queues.doc

  • Having 512GB of memory lets me think you have a lot of CPUs in that box as well.

    If you're seeing loads of CMEMTHREAD waits in SQL Server 2008 R2 on ad-hoc compiles on a server with more than 16 CPU cores, you are likely suffering from a bug in R2. (We dealt with this on a 48-core box)

    Update to the latest hotfix. If that doesn't solve it, you may need a specific hotfix from MS Support.

    -Eddie

    Eddie Wuerch
    MCM: SQL

  • Eddie Wuerch (8/10/2011)


    Having 512GB of memory lets me think you have a lot of CPUs in that box as well.

    If you're seeing loads of CMEMTHREAD waits in SQL Server 2008 R2 on ad-hoc compiles on a server with more than 16 CPU cores, you are likely suffering from a bug in R2. (We dealt with this on a 48-core box)

    Update to the latest hotfix. If that doesn't solve it, you may need a specific hotfix from MS Support.

    -Eddie

    Do you have the kb link?

  • Ninja's_RGR'us (8/10/2011)


    Eddie Wuerch (8/10/2011)


    Having 512GB of memory lets me think you have a lot of CPUs in that box as well.

    If you're seeing loads of CMEMTHREAD waits in SQL Server 2008 R2 on ad-hoc compiles on a server with more than 16 CPU cores, you are likely suffering from a bug in R2. (We dealt with this on a 48-core box)

    Update to the latest hotfix. If that doesn't solve it, you may need a specific hotfix from MS Support.

    -Eddie

    Do you have the kb link?

    This looks similar, it may be the actual problem. I don't remember the particulars, but we did get the PSS hotfix around the time this KB article was published:

    http://support.microsoft.com/kb/2492381

    FIX: SQL Server 2008 R2 performs poorly when most threads wait for the CMEMTHREAD wait type if the threads use table variables or temp tables to load or update rowsets

    Eddie Wuerch
    MCM: SQL

  • We have concluded the same

    we are planning to apply SP1.

    Thanks for the help, I will let you know about the results after applying the service pack.

  • thirulok_t (8/10/2011)


    We have concluded the same

    we are planning to apply SP1.

    Thanks for the help, I will let you know about the results after applying the service pack.

    we have 32 cores..

  • Can you provid us the details on if the service pack resolved your issue.

    Regards,

    Nawaz.

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply