Re: Scaling shared buffer eviction
От | Robert Haas |
---|---|
Тема | Re: Scaling shared buffer eviction |
Дата | |
Msg-id | CA+TgmoZsWZcQnfCj1jUfSOkH0zkiYO_HOfutA7kHrU5mBtEFmg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Scaling shared buffer eviction (Amit Kapila <amit.kapila16@gmail.com>) |
Ответы |
Re: Scaling shared buffer eviction
(Amit Kapila <amit.kapila16@gmail.com>)
|
Список | pgsql-hackers |
On Tue, Sep 16, 2014 at 8:18 AM, Amit Kapila <amit.kapila16@gmail.com> wrote:
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
In most cases performance with patch is slightly less as compareto HEAD and the difference is generally less than 1% and in a caseor 2 close to 2%. I think the main reason for slight difference is thatwhen the size of shared buffers is almost same as data size, the numberof buffers it needs from clock sweep are very less, as an example in firstcase (when size of shared buffers is 12286MB), it actually needs at most256 additional buffers (2MB) via clock sweep, where as bgreclaimerwill put 2000 (high water mark) additional buffers (0.5% of shared buffersis greater than 2000 ) in free list, so bgreclaimer does some extra workwhen it is not required and it also leads to condition you mentioneddown (freelist will contain buffers that have already been touched sincewe added them). Now for case 2 (12166MB), we need buffers morethan 2000 additional buffers, but not too many, so it can also havesimilar effect.
So there are two suboptimal things that can happen and they pull in opposite directions. I think you should instrument the server how often each is happening. #1 is that we can pop a buffer from the freelist and find that it's been touched. That means we wasted the effort of putting it on the freelist in the first place. #2 is that we can want to pop a buffer from the freelist and find it empty and thus be forced to run the clock sweep ourselves. If we're having problem #1, we could improve things by reducing the water marks. If we're having problem #2, we could improve things by increasing the water marks. If we're having both problems, then I dunno. But let's get some numbers on the frequency of these specific things, rather than just overall tps numbers.
I think we have below options related to this observationa. Some further tuning in bgreclaimer, so that instead of puttingthe buffers up to high water mark in freelist, it puts just 1/4th or1/2 of high water mark and then check if the free list still containslesser than equal to low water mark, if yes it continues and if notthen it can wait (or may be some other way).
That sounds suspiciously like just reducing the high water mark.
b. Instead of waking bgreclaimer when the number of buffers fallbelow low water mark, wake when the number of times backendsdoes clock sweep crosses certain threshold
That doesn't sound helpful.
c. Give low and high water mark as config knobs, so that in somerare cases users can use them to do tuning.
Yuck.
d. Lets not do anything as if user does such a configuration, he shouldbe educated to configure shared buffers in a better way and or theperformance hit doesn't seem to be justified to do any furtherwork.
At least worth entertaining.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: