SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Max Memory


Max Memory

Author
Message
gary1
gary1
SSCertifiable
SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)

Group: General Forum Members
Points: 5042 Visits: 2254
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
GilaMonster
GilaMonster
SSC Guru
SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)

Group: General Forum Members
Points: 231658 Visits: 46354
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

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


gary1
gary1
SSCertifiable
SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)

Group: General Forum Members
Points: 5042 Visits: 2254
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
gary1
gary1
SSCertifiable
SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)

Group: General Forum Members
Points: 5042 Visits: 2254
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..
GilaMonster
GilaMonster
SSC Guru
SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)

Group: General Forum Members
Points: 231658 Visits: 46354
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

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


gary1
gary1
SSCertifiable
SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)

Group: General Forum Members
Points: 5042 Visits: 2254
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?
gary1
gary1
SSCertifiable
SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)

Group: General Forum Members
Points: 5042 Visits: 2254
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?
GilaMonster
GilaMonster
SSC Guru
SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)

Group: General Forum Members
Points: 231658 Visits: 46354
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

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


gary1
gary1
SSCertifiable
SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)SSCertifiable (5K reputation)

Group: General Forum Members
Points: 5042 Visits: 2254
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 pressureCrying

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
GilaMonster
GilaMonster
SSC Guru
SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)SSC Guru (231K reputation)

Group: General Forum Members
Points: 231658 Visits: 46354
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

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


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search