Wednesday, 2 September 2015

Does my MS SQL Server have enough RAM?

MS SQL Server RAM - Reommendations

People often ask "How much RAM does my SQL server need". The usual answer is "As much as you can give it".

While yes, usually you won't find that RAM will go to waste if you give it all the RAM you have, sometimes it just isn't necessary.

Rule number 1 I've found is that it's nice to aim to have as much RAM as you have for the size of your database. Usually this won't be feasible though.

The other thing you can look at is the Page Life Expectancy (PLE) performance counter that is installed along with SQL Server. To check this, launch Performance Monitor and add the counter Page Life Expectancy found under SQL server:Buffer Manager.

This value should never drop below 300. If it does then this means that the buffer is flushing out pages too often. This will mean that data will need to be read from disk more often rather than being stored and read from memory. What you want is for your frequently accessed data to be stored in memory as it will always be faster than disks. 300 really is a bare minimum and will mean that pages are being kept for 300 seconds before being flushed out. If you have enough RAM though, pages will be kept for longer. To put into perspective, some of my production database servers sit at a PLE value of over 30,000.

You also want to make sure that you are assigning a maximum amount of memory for SQL server to be allowed to use rather than letting it consume all the memory allocated to the server. Try to give at least 5gb RAM for the operating system and non SQL server processes to use. To limit the amount SQL can use, open SQL Management Studio, connect to you database engine instance and right click the top level in Object Explorer where the name of the instance is. Go into properties and open the memory tab. In here, set the Maximum server memory (in MB) as appropriate. For example if you have given your server 60GB of RAM, you may want to set SQL to be allowed a maximum of 50000 MB (just under 50GB) leaving just over 10GB for your operating system and any non SQL Server processes.

No comments:

Post a Comment