Link to home
Start Free TrialLog in
Avatar of finance_teacher
finance_teacher

asked on

Microsoft SQL Server 2016 -- MEMORY usage at 100% ?

Someone told me Microsoft SQL Server 2016 is setup to use "All available memory", therefore my Microsoft SQL Server's Windows Server 2016 TASK MANAGER will always show 100% memory use of the 128GB I have.

1. Is that true ?
2. If not, how can I get TASK MANAGER to show me the current MEMORY Microsoft SQL Server 2016 is using ?
Avatar of Sean Bravener
Sean Bravener

disclaimer:  I am not a DBA
that being said, yes SQL will utilize all available memory on a system unless your DBA sets it differently.  
the easiest way to look at memory on a sql box is open up taskmgr and go to performance mgr.
then pull up the sql process and see what the % of memory is for that process.  then break open calculator and do the math.  total memory * percent of memory used by sql.

a DBA could tell you a better way but this is the quick and dirty way.
ASKER CERTIFIED SOLUTION
Avatar of Mal Osborne
Mal Osborne
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SQL is a memory consumer that will consume as much as available, how big is your databases?
You can configure SQL to limit how much it can consume.

The more of the DB it can keep in memory, the faster the SQL response.

Other than the 100 what issues do you see in terms of perfomance that needs addressing.
Let me be clear for you.

If this is a dedicated SQL instance..set your SQL memory to 80% of the sql.

There are more discreet formulas that take cpu into consideration but 80% for dedicated SQL is still good formula.

MAX memory is never recommended.

You do not want SQL Server eating your windows memory for OS operations or other apps running on server.

If you are not a dedicated SQL Server then reduce the 80% down accordingly but you will need to decide how much RAM your system needs to have maximum for a set of processes.
You need to use the 'max memory' setting to restrict the amount of RAM that SQL uses.  Starting at 80% of total RAM is a decent-enough rough guideline.

EXEC sys.sp_configure 'max server memory', <memory_size_in_mb>

For example, to limit SQL to, say, 40GB, you'd use 40960.
2. If not, how can I get TASK MANAGER to show me the current MEMORY Microsoft SQL Server 2016 is using ?


This would be useful to determine your processors but as I stated earlier if this is dedicated SQL Server use 80%.

So 16gb...I would leave 4 for operating system and use the other 12 as max memory on sql.

If this is not set...then I also imagine you need to setup the Cost threshold of Parallism and the Max Degree Of parallism.  

Auto shrink = true
And autostart = false


These are all common settings missed on a new sql instance that will affect performance.
To be clear, the correct setting for autoshrink is off/false, and for autoclose it's off [and for autostart it's on, not usually an issue].

You can only get accurate SQL memory usage from SQL itself: Windows and related tasks don't really know how SQL is using memory.  For example:

SELECT type AS clerk_type,
    CAST(SUM(pages_kb) / 1024.0 AS decimal(9, 1)) AS size_mb
FROM sys.dm_os_memory_clerks WITH (NOLOCK)
GROUP BY type
HAVING SUM(pages_kb) / 1024.0 >= 1.0
ORDER BY size_mb DESC, clerk_type
@Scott...thanks for clarifying my comment.  Its always good to check