40

Assuming you have a dedicated server explicitly for database functions -- how much memory should you reserve for the operating system?

I realize this will probably vary somewhat depending on the specific OS, the specific database software, and so forth. But, as memory is so important to database performance, I want the database to have the maximum reasonable level of memory, without starving the host OS.

So

  • what's a good rule of thumb to start with?
  • what counters or performance indicators should we look at to determine if we've gone too far and the host OS is being starved somehow by the database?
Leigh Riffel
  • 23,884
  • 17
  • 80
  • 155
Jeff Atwood
  • 2,374
  • 2
  • 21
  • 15

4 Answers4

30

Assuming Windows and SQL Server...

There are two schools of thought.

  1. Leave 2-4 Gigs for Windows (depending on what is installed besides SQL Server).
  2. Leave 10% of your available memory free. As you get over 64 Gigs this gets to be a crazy large amount of memory to leave for the OS, which it probably won't need.

Personally I'm in the first group. Windows usually just needs 2-4 gigs, sometimes up to 6.

Leigh Riffel
  • 23,884
  • 17
  • 80
  • 155
mrdenny
  • 27,106
  • 2
  • 44
  • 81
16

Assuming Linux, if you turn off swap and the kernel keeps killing your DB process because it's out of memory, that's a good indicator you're starving the OS for memory. Back off until that stops happening. A couple hundred megs is usually plenty.

Dan Grossman
  • 661
  • 1
  • 4
  • 8
8

You can leverage Amazon's experience running thousands of customers' database servers here: On Amazon Relational Database Service, they set MySQL's innodb buffer pool to 3/4 of the system's memory, regardless of how much memory that is. Add in up to a couple megs per connection for various query buffers, and they're likely leaving 10-20% of the memory to the OS.

Dan Grossman
  • 661
  • 1
  • 4
  • 8
5

You should read Brent Ozar's take on memory. He has some fairly standard answers on why you should be looking memory and why more memory equals better performance. Generally speaking 4 GB or 10% reserved for OS.

Troy
  • 400
  • 3
  • 7