On Wed, Aug 13, 2014 at 4:25 PM, Andres Freund <and...@2ndquadrant.com> wrote: > > On 2014-08-13 09:51:58 +0530, Amit Kapila wrote: > > Overall, the main changes required in patch as per above feedback > > are: > > 1. add an additional counter for the number of those > > allocations not satisfied from the free list, with a > > name like buffers_alloc_clocksweep. > > 2. Autotune the low and high threshold values for buffers > > in freelist. In the patch, I have kept them as hard-coded > > values. > > 3. For populating freelist, have a separate process (bgreclaim) > > instead of doing it by bgwriter. > > I'm not convinced that 3) is the right way to go to be honest. Seems > like a huge bandaid to me.
Doing both (populating freelist and flushing dirty buffers) via bgwriter isn't the best way either because it might not be able to perform both the jobs as per need. One example is it could take much longer time to flush a dirty buffer than to move it into free list, so if there are few buffers which we need to flush, then I think task of maintaining buffers in freelist will get hit even though there are buffers in list which can be moved to free list(non-dirty buffers). Another is maintaining the current behaviour of bgwriter which is to scan the entire buffer pool every few mins (assuming default configuration). We can attempt to solve this problem as suggested by Robert upthread but I am not completely sure if that can guarantee that the current behaviour will be retained as it is. I am not telling that having a separate process won't have any issues, but I think we can tackle them without changing or complicating current bgwriter behaviour. With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com