SERVER CONFIGURATION:
1. How to set correct value for SQL Server Max server memory?
1. How to set correct value for SQL Server Max server memory?
There is no magic formula for this. Estimate the memory required by other applications running on same server, Operating system, Drivers , SQL Server Non- bPool allocations, jobs, anti virus etc.. Make sure you have acceptable available physical memory even when the system is under heavy load.
1. Consider the operating system memory requirement.
Approximately 1 GB (Would increase if it is DC, cluster etc.)
2. Consider the memory requirements by other applications/processes running on the server.
You have to derive it based on applications/processes/AV’s running on the system and their memory requirements. (Perfmon Process-> Private bytes and Working set can help)
3. Consider the memory requirements of the drivers/firmwares.
You have to derive it based on memory requirements by drivers installed on the system. (RAMMAP can help)
4. Consider the NonbPool (aka MTL or MTR) memory requirements by SQL Server.
select sum(multi_pages_kb)/1024 as multi_pages_mb from sys.dm_os_memory_clerks
(You can skip above query if your SQL Server version is 2012)
+
Max worker threads * 2MB
+
Memory for direct Windows allocations approximately 0 to 300 MB in most of the cases but you may have to increase it if there are many 3 party components loaded in SQL Server process (Including linked server dll’s, 3rd party backup dll’s etc.)
+
If you are using CLR extensively add some additional memory for CLR.
5. Consider the memory requirement by jobs (Including replication agents, Log shipping etc. ) and packages that will run on the server.
You have to derive (May vary from few Mb’s to GB’s)
6. Consider SSAS and RS memory requirements.
You have to derive
7. Make sure there is good enough free space for operating system.
Approximately (100 MB for each GB till 4G) + (50 MB for each additional GB till 12GB) + (25 MB for each additional GB till your RAM size)
8. Other memory requirements.
If you have any other memory requirement specific to your environment.
Once you have calculated a reasonable value for all the above memory requirements take the sum of all the above requirements and deduct it with total physical memory to derive an ideal value for your max server memory.
Max server memory= Total physical memory – (1+2+3+4+5+6+7+8)
2. Calculate the size of MemtoLeave and reserve it using the algorithm below
MTL (Memory to Leave)= (Stack size * max worker threads) + Additional space (By default 256 MB and can be controlled by -g).
Stack size =512 KB per thread for 32 Bit SQL Server and 904 KB for 32Bit SQL Server running on 64-Bit systems.
I.e = (256 *512 KB) + 256MB =384MB
-g switch is used to increase the additional space from 256 to any desired value.
No comments:
Post a Comment