Re: shared_buffers/effective_cache_size on 96GB server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shaun,

running these commands:

#sysctl vm.dirty_ratio
vm.dirty_ratio = 40
# sysctl vm.dirty_background_ratio
vm.dirty_background_ratio = 10

shows that these values are even higher by default. When you said RAID buffer size, you meant the controllers cache memory size?

Regards,
Strahinja


On Wed, Oct 10, 2012 at 3:09 PM, Shaun Thomas <sthomas@xxxxxxxxxxxxxxxx> wrote:
On 10/10/2012 02:12 AM, Strahinja Kustudić wrote:

          total    used   free  shared   buffers     cached
Mem:      96730   96418    311       0        71      93120

Wow, look at all that RAM. Something nobody has mentioned yet, you'll want to set some additional kernel parameters for this, to avoid getting occasional IO storms caused by dirty memory flushes.

vm.dirty_background_ratio = 1
vm.dirty_ratio = 5

Again, these would go in sysctl.conf, or /etc/sysctl.d/10-dbserver.conf or something. If you have a newer kernel, look into vm.dirty_background_bytes, and vm.dirty_bytes.

The why of this is brought up occasionally here, but it comes down to your vast amount of memory. The defaults for even late Linux kernels is 5% for dirty_background_ratio, and 10% for dirty_ratio. So if you multiply it out, the kernel will allow about 4.8GB of dirty memory before attempting to flush it to disk. If that number reaches 9.6, the system goes synchronous, and no other disk writes can take place until *all 9.6GB* is flushed. Even with a fast disk subsystem, that's a pretty big gulp.

The idea here is to keep it writing in the background by setting a low limit, so it never reaches a critical mass that causes it to snowball into the more dangerous upper limit. If you have a newer kernel, the ability to set "bytes" is a much more granular knob that can be used to match RAID buffer sizes. You'll probably want to experiment with this a bit before committing to a setting.


So it did a little swapping, but only minor, still I should probably
decrease shared_buffers so there is no swapping at all.

Don't worry about that amount of swapping. As others have said here, you can reduce that to 0, and even then, the OS will still swap something occasionally. It's really just a hint to the kernel how much swapping you want to go on, and it's free to ignore it in cases where it knows some data won't be accessed after initialization or something, so it swaps it out anyway.


--
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604
312-444-8534
sthomas@xxxxxxxxxxxxxxxx

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux