September 11, 2013 at 5:12 pm
I have set Max Memory to 6 GB. But SQL Server is using only 2.9 GB
Query used:
SELECT object_name, counter_name, cntr_value AS 'Total Server Memory (KB)'
FROM sys.dm_os_performance_counters
WHERE counter_name = 'Total Server Memory (kB)'
So why SQL Server is not using all allocated Max memory i.e 6GB?
Is this normal? SQL Server should use all allocated Max memory right?
Thanks,
Gary
September 11, 2013 at 5:22 pm
Max server memory is just the upper limit that SQL is allowed to use. There's many cases where it won't reach that. Ones that immediately come to mind is it doesn't need that much memory or that that much memory is not available.
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
September 11, 2013 at 5:40 pm
Max server memory is just the upper limit that SQL is allowed to use. There's many cases where it won't reach that. Ones that immediately come to mind is it doesn't need that much memory or that that much memory is not available
.
Thanks Gail.
We have 2 SQL Serve instances on same server, SQL Server 2008 R2 with SP1. The server has 16 GB RAM
For both instances Max Memory is set 6GB and 4GB is left OS
But instance1 is using 2.9 GB out of 6GB and instance2 is using 763 MB out of 6GB.
Issue: PLE is dropping <5 minsfor every 15 to 20 mins and there is no much activity (no active sessions)on the server and also noticed CPU is going 80% when PLE drops to <5 mins
Please advise why SQL Server is not utilizing memory allocated to it? By design, SQL Sever should use all of its max memory right?
Thanks,
Gary
September 11, 2013 at 10:38 pm
Hi Gail.
I just noticed that instance1 is using 364 MB out of 6GB (it was 2.9 GB 6 hrs back) and instance2 is using 3.4 GB out of 6GB.(it was 763 MB 6 hrs back)
I did not understand why this is changed in last 6 hours. Please advice..
September 12, 2013 at 12:55 am
gary1 (9/11/2013)
By design, SQL Sever should use all of its max memory right?
As I said above, no. There is no guarantee that SQL will use max server memory, it's just a maximum. The default value for that setting (2000 TB) makes that clear enough
Can't diagnose what's happening, there's no where near enough information. Start by looking at what else is consuming memory on the server. You'll probably need run counter traces for hours. Also look at the ring buffers in SQL.
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
September 12, 2013 at 11:12 am
Thanks Gail,
I just noticed that instance1 is using 364 MB out of 6GB (it was 2.9 GB 6 hrs back) and instance2 is using 3.4 GB out of 6GB.(it was 763 MB 6 hrs back)
In which scenarios, sql server instance will release it's memory other than it's service restarts?
Min memory is set to zero. Do we need to set Min memory if we have multiple instances?
September 12, 2013 at 11:31 pm
Gail,
Issue got resolved after setting up the Min memory to 1gb for both the instances
Can you please shed some light on this Min memory setting? i.e which scenarios we need to set this?
September 13, 2013 at 5:03 am
gary1 (9/12/2013)
In which scenarios, sql server instance will release it's memory other than it's service restarts?
When windows is under memory pressure and requests SQL to reduce its memory usage.
Do we need to set Min memory if we have multiple instances?
No, not unless you're overcomitting memory (setting max server memory high enough that all instances cannot reach it given physical memory and what else is running)
Can you please shed some light on this Min memory setting? i.e which scenarios we need to set this?
The only time you really need it is when there's not enough memory on the server for everything running and for all the instances to reach max server memory and hence you want to prevent SQL from reducing its memory to nothing when Windows hits memory pressure. Of course, what's instead going to happen under severe memory pressure is either the OS pages SQL out or the OS crashes due to insufficient memory.
It's also useful in a multi-instance cluster when there's a chance that all instances will end up on one node and that node does not have enough memory for all the instances to reach their configured max server memory. That's usually a temporary situation, so it's there to make the best of what the server has, not for long-term configuration.
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
September 13, 2013 at 9:51 am
Thanks for the detailed information Gail.
instance1 is using 1.42GB out of 6GB and instance2 is using 554 MB out of 6GB.
But one thing I did not understand is, 2 the instances never went to their max memory and there are no other application running other then these two instances. 4 GB is left for OS. So where is the memory pressure:crying:
But all of sudden after setting Min memory to 1GB, I'm not seeing PLE and CPU issue.
Need to investigate more. I will try setting min memory to zero and see if the problem comes back.
This is 2-node active/passive cluster. 2 instances are on the same node
September 13, 2013 at 10:20 am
They wouldn't have reduced memory usage without a lowmem signal from windows, so if SQL is reducing memory usage, there's something outside of SQL allocating and requesting memory and causing windows to issue low memory signals which in turn cause SQL to reduce its memory usage.
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
September 13, 2013 at 10:27 am
what counters should we monitor to find out lowmem signal from windows?
thank you very much for your inputs
September 13, 2013 at 10:31 am
You're looking for something other than SQL allocating memory, probably lots of memory. The memory-based counters and/or the process object and its memory counters for each and every process running.
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
September 13, 2013 at 3:45 pm
after 1 day, I'm again seeing PLE going down <5 mins:crying:
September 13, 2013 at 3:47 pm
You need to figure out what is causing Windows to issue low memory alerts. SQL will not reduce its memory usage unless Windows tells it to.
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
September 13, 2013 at 5:56 pm
Gail, I want to capture the sql statements when PLE drops. what is the best method?
We have spot light, I'm able capture queries from spotlight but they are not complete. for example, I captured the below query when PLE dropped suddenly. But I can not run this query in SSMS and see what it's execution plan. How to get the complete query? Please advise.
(@TOTAL_RECORDS_OUT INT OUTPUT)
CREATE TABLE #TEMPDEALS
( ROWID INT
,[ID_VW] INT
,[ID_DEL] INT
,TOTAL_REOCRDS INT
)
;WITH CTE_DEALS AS (
SELECT ROW_NUMBER() OVER(ORDER BY MODIFIED_DATE_DEL ASC ) AS ROWID,[ID_VW],[ID_DEL]
FROM (SELECT MAX(VWDEAL.[ID_VW]) AS [ID_VW],VWDEAL.[ID_DEL] ,max([MODIFIED_DATE_DEL]) as [MODIFIED_DATE_DEL]
FROM [ew].[VW_ALLDEALDETAILS] VWDEAL
INNER JOIN [ew].[VW_DEAL_TRANSACTION] TRNVW ON TRNVW.ID_DEL = VWDEAL.[ID_DEL]
LEFT JOIN [ew].[DEAL_STATUS_HISTORY_DSH] DSH ON VWDEAL.ID_DEL =DSH.ID_DEL_DSH
WHERE ([IS_DELETE]=0)
AND (VWDEAL.VERSION_OFR <> -1 AND VWDEAL.OFFERTYPE_OFR <> 'OutOfSequence' AND VWDEAL.OFFERTYPE_OFR <> 'MTOOS') AND (VWDEAL.ID_OFR IN (SELECT X.ID_OFR FROM ew.VW_OFFER_XML X INNER JOIN #TEMP_OFFER T
ON X.XML_NAME=T.XML_NODE_NAME AND X.XML_NAME='AgencyCode' AND X.XML_VALUE LIKE T.XML_NODE_VALUE )) AND (VWDEAL.ID_OFR IN (SELECT X.ID_OFR FROM ew.VW
Viewing 15 posts - 1 through 15 (of 22 total)
You must be logged in to reply to this topic. Login to reply