Re: [HACKERS] 2nd Level Buffer Cache

2011-04-26 Thread Bruce Momjian
Josh Berkus wrote: > > > Was it really all that bad? IIRC we replaced ARC with the current clock > > sweep due to patent concerns. (Maybe there were performance concerns as > > well, I don't remember). > > Yeah, that was why the patent was frustrating. Performance was poor and > we were planni

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-31 Thread Greg Smith
On 03/24/2011 03:36 PM, Jim Nasby wrote: On Mar 23, 2011, at 5:12 PM, Tom Lane wrote: Robert Haas writes: It looks like the only way anything can ever get put on the free list right now is if a relation or database is dropped. That doesn't seem too good. Why not? AIUI the

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-26 Thread Jeff Janes
On Fri, Mar 25, 2011 at 8:07 AM, Gurjeet Singh wrote: > On Tue, Mar 22, 2011 at 3:53 PM, Robert Haas wrote: >> >> On Tue, Mar 22, 2011 at 11:24 AM, Jeff Janes wrote: >> > On Fri, Mar 18, 2011 at 9:19 AM, Robert Haas >> > wrote: >> >> >> >> A related area that could use some looking at is why pe

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-25 Thread Robert Haas
On Mar 25, 2011, at 11:58 AM, Jim Nasby wrote: > Related to that... after talking to Greg Smith at PGEast last night, he felt > it would be very valuable just to profile how much time is being spent > waiting/holding the freelist lock in a real environment. I'm going to see if > we can do that

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-25 Thread Jeff Janes
On Thu, Mar 24, 2011 at 7:51 PM, Greg Stark wrote: > On Thu, Mar 24, 2011 at 11:33 PM, Jeff Janes wrote: >> I tried under the circumstances I thought were mostly likely to show a >> time difference, and I was unable to detect a reliable difference in >> timing between free list and clock sweep. >

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-25 Thread Jim Nasby
On Mar 25, 2011, at 10:07 AM, Gurjeet Singh wrote: > On Tue, Mar 22, 2011 at 3:53 PM, Robert Haas wrote: > On Tue, Mar 22, 2011 at 11:24 AM, Jeff Janes wrote: > > On Fri, Mar 18, 2011 at 9:19 AM, Robert Haas wrote: > >> On Fri, Mar 18, 2011 at 11:14 AM, Kevin Grittner > >> wrote: > >>> Maybe th

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-25 Thread Gurjeet Singh
On Tue, Mar 22, 2011 at 3:53 PM, Robert Haas wrote: > On Tue, Mar 22, 2011 at 11:24 AM, Jeff Janes wrote: > > On Fri, Mar 18, 2011 at 9:19 AM, Robert Haas > wrote: > >> On Fri, Mar 18, 2011 at 11:14 AM, Kevin Grittner > >> wrote: > >>> Maybe the thing to focus on first is the oft-discussed "be

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-24 Thread Greg Stark
On Thu, Mar 24, 2011 at 11:33 PM, Jeff Janes wrote: > I tried under the circumstances I thought were mostly likely to show a > time difference, and I was unable to detect a reliable difference in > timing between free list and clock sweep. It strikes me that it shouldn't be terribly hard to add a

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-24 Thread Jeff Janes
On Thu, Mar 24, 2011 at 12:36 PM, Jim Nasby wrote: > On Mar 23, 2011, at 5:12 PM, Tom Lane wrote: >> Robert Haas writes: >>> It looks like the only way anything can ever get put on the free list >>> right now is if a relation or database is dropped.  That doesn't seem >>> too good. >> >> Why not?

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-24 Thread Radosław Smogura
Robert Haas Thursday 24 March 2011 22:41:19 > On Thu, Mar 24, 2011 at 5:34 PM, Greg Stark wrote: > > On Thu, Mar 24, 2011 at 8:59 PM, Robert Haas wrote: > >> It seems at least plausible that buffer allocation could be > >> significantly faster if it need only pop the head of a list, rather > >>

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-24 Thread Robert Haas
On Thu, Mar 24, 2011 at 5:34 PM, Greg Stark wrote: > On Thu, Mar 24, 2011 at 8:59 PM, Robert Haas wrote: >> It seems at least plausible that buffer allocation could be >> significantly faster if it need only pop the head of a list, rather >> than scanning until it finds a suitable candidate.  Mov

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-24 Thread Greg Stark
On Thu, Mar 24, 2011 at 8:59 PM, Robert Haas wrote: > It seems at least plausible that buffer allocation could be > significantly faster if it need only pop the head of a list, rather > than scanning until it finds a suitable candidate.  Moving as much > buffer allocation work as possible into the

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-24 Thread Robert Haas
On Wed, Mar 23, 2011 at 6:12 PM, Tom Lane wrote: > Robert Haas writes: >> It looks like the only way anything can ever get put on the free list >> right now is if a relation or database is dropped.  That doesn't seem >> too good. > > Why not?  AIUI the free list is only for buffers that are total

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-24 Thread Radosław Smogura
Jim Nasby Thursday 24 March 2011 20:36:48 > On Mar 23, 2011, at 5:12 PM, Tom Lane wrote: > > Robert Haas writes: > >> It looks like the only way anything can ever get put on the free list > >> right now is if a relation or database is dropped. That doesn't seem > >> too good. > > > > Why not?

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-24 Thread Jim Nasby
On Mar 23, 2011, at 5:12 PM, Tom Lane wrote: > Robert Haas writes: >> It looks like the only way anything can ever get put on the free list >> right now is if a relation or database is dropped. That doesn't seem >> too good. > > Why not? AIUI the free list is only for buffers that are totally d

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-23 Thread Tom Lane
Robert Haas writes: > It looks like the only way anything can ever get put on the free list > right now is if a relation or database is dropped. That doesn't seem > too good. Why not? AIUI the free list is only for buffers that are totally dead, ie contain no info that's possibly of interest to

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-23 Thread Radosław Smogura
Greg Stark Wednesday 23 March 2011 21:30:04 > On Wed, Mar 23, 2011 at 8:00 PM, Robert Haas wrote: > > It looks like the only way anything can ever get put on the free list > > right now is if a relation or database is dropped. That doesn't seem > > too good. I wonder if the background writer sh

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-23 Thread Greg Stark
On Wed, Mar 23, 2011 at 8:00 PM, Robert Haas wrote: > It looks like the only way anything can ever get put on the free list > right now is if a relation or database is dropped.  That doesn't seem > too good.  I wonder if the background writer shouldn't be trying to > maintain the free list.  That

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-23 Thread Robert Haas
On Wed, Mar 23, 2011 at 1:53 PM, Jim Nasby wrote: > When we started using 192G servers we tried switching our largest OLTP > database (would have been about 1.2TB at the time) from 8GB shared buffers to > 28GB. Performance went down enough to notice; I don't have any solid metrics, > but I'd ba

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-23 Thread Jim Nasby
On Mar 22, 2011, at 2:53 PM, Robert Haas wrote: > On Tue, Mar 22, 2011 at 11:24 AM, Jeff Janes wrote: >> On Fri, Mar 18, 2011 at 9:19 AM, Robert Haas wrote: >>> On Fri, Mar 18, 2011 at 11:14 AM, Kevin Grittner >>> wrote: Maybe the thing to focus on first is the oft-discussed "benchmark

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-23 Thread Radosław Smogura
Merlin Moncure Tuesday 22 March 2011 23:06:02 > On Tue, Mar 22, 2011 at 4:28 PM, Radosław Smogura > > wrote: > > Merlin Moncure Monday 21 March 2011 20:58:16 > > > >> On Mon, Mar 21, 2011 at 2:08 PM, Greg Stark wrote: > >> > On Mon, Mar 21, 2011 at 3:54 PM, Merlin Moncure > > > > wrote: > >

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-23 Thread Radosław Smogura
Merlin Moncure Monday 21 March 2011 20:58:16 > On Mon, Mar 21, 2011 at 2:08 PM, Greg Stark wrote: > > On Mon, Mar 21, 2011 at 3:54 PM, Merlin Moncure wrote: > >> Can't you make just one large mapping and lock it in 8k regions? I > >> thought the problem with mmap was not being able to detect ot

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-22 Thread Merlin Moncure
On Tue, Mar 22, 2011 at 4:28 PM, Radosław Smogura wrote: > Merlin Moncure Monday 21 March 2011 20:58:16 >> On Mon, Mar 21, 2011 at 2:08 PM, Greg Stark wrote: >> > On Mon, Mar 21, 2011 at 3:54 PM, Merlin Moncure > wrote: >> >> Can't you make just one large mapping and lock it in 8k regions? I >>

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-22 Thread Radosław Smogura
Merlin Moncure Monday 21 March 2011 20:58:16 > On Mon, Mar 21, 2011 at 2:08 PM, Greg Stark wrote: > > On Mon, Mar 21, 2011 at 3:54 PM, Merlin Moncure wrote: > >> Can't you make just one large mapping and lock it in 8k regions? I > >> thought the problem with mmap was not being able to detect ot

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-22 Thread Josh Berkus
Radek, I have implemented initial concept of 2nd level cache. Idea is to keep some segments of shared memory for special buffers (e.g. indices) to prevent overwrite those by other operations. I added those functionality to nbtree index scan. The problem with any "special" buffering of database

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-22 Thread Devrim GÜNDÜZ
On Tue, 2011-03-22 at 15:53 -0400, Robert Haas wrote: > > To be honest, I'm mostly just reporting what I've heard Greg Smith say > on this topic. I don't have any machine with that kind of RAM. I thought we had a machine for hackers who want to do performance testing. Mark? -- Devrim GÜNDÜZ P

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-22 Thread Robert Haas
On Tue, Mar 22, 2011 at 11:24 AM, Jeff Janes wrote: > On Fri, Mar 18, 2011 at 9:19 AM, Robert Haas wrote: >> On Fri, Mar 18, 2011 at 11:14 AM, Kevin Grittner >> wrote: >>> Maybe the thing to focus on first is the oft-discussed "benchmark >>> farm" (similar to the "build farm"), with a good mix o

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-22 Thread Andrew Dunstan
On 03/22/2011 12:47 PM, Jeff Janes wrote: Maybe the thing to focus on first is the oft-discussed "benchmark farm" (similar to the "build farm"), with a good mix of loads, so that the impact of changes can be better tracked for multiple workloads on a variety of platforms and configurations.

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-22 Thread Jeff Janes
On Fri, Mar 18, 2011 at 8:14 AM, Kevin Grittner wrote: > rsmogura wrote: > >> Yes, there is some change, and I looked at this more carefully, as >> my performance results wasn't such as I expected. I found PG uses >> BufferAccessStrategy to do sequence scans, so my test query took >> only 32 buff

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-22 Thread Jeff Janes
On Fri, Mar 18, 2011 at 9:19 AM, Robert Haas wrote: > On Fri, Mar 18, 2011 at 11:14 AM, Kevin Grittner > wrote: >> Maybe the thing to focus on first is the oft-discussed "benchmark >> farm" (similar to the "build farm"), with a good mix of loads, so >> that the impact of changes can be better tra

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-22 Thread KONDO Mitsumasa
Hi, hackers. I am interested in this discussion! So I surveyed current buffer algorithms around other software. I share about it. (sorry, it is easy survey..) CLOCK-PRO and LIRS are popular in current buffer algorithms in my easy survey. Their algorithms are same author that is Song Jiang. CLOCK

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread Radosław Smogura
Merlin Moncure Monday 21 March 2011 20:58:16 > On Mon, Mar 21, 2011 at 2:08 PM, Greg Stark wrote: > > On Mon, Mar 21, 2011 at 3:54 PM, Merlin Moncure wrote: > >> Can't you make just one large mapping and lock it in 8k regions? I > >> thought the problem with mmap was not being able to detect ot

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread Merlin Moncure
On Mon, Mar 21, 2011 at 2:08 PM, Greg Stark wrote: > On Mon, Mar 21, 2011 at 3:54 PM, Merlin Moncure wrote: >> Can't you make just one large mapping and lock it in 8k regions? I >> thought the problem with mmap was not being able to detect other >> processes >> (http://www.mail-archive.com/pgsql

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread Josh Berkus
> Was it really all that bad? IIRC we replaced ARC with the current clock > sweep due to patent concerns. (Maybe there were performance concerns as > well, I don't remember). Yeah, that was why the patent was frustrating. Performance was poor and we were planning on replacing ARC in 8.2 anyway

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread Alvaro Herrera
Excerpts from Josh Berkus's message of lun mar 21 13:47:21 -0300 2011: > We already did that, actually, when we implemented ARC: effectively gave > PostgreSQL a 3-level cache. The results were not very good, although > the algorithm could be at fault there. Was it really all that bad? IIRC we r

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread Greg Stark
On Mon, Mar 21, 2011 at 4:47 PM, Josh Berkus wrote: > You're missing my point ... Postgres already *has* a 2-level cache: > shared_buffers and the FS cache.  Anything we add to that will be adding > levels. I don't think those two levels are interesting -- they don't interact cleverly at all. I

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread Greg Stark
On Mon, Mar 21, 2011 at 3:54 PM, Merlin Moncure wrote: > Can't you make just one large mapping and lock it in 8k regions? I > thought the problem with mmap was not being able to detect other > processes > (http://www.mail-archive.com/pgsql-general@postgresql.org/msg122301.html) > compatibility is

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread Josh Berkus
On 3/21/11 3:24 AM, Greg Stark wrote: >> 2-level caches work well for a variety of applications. > > I think 2-level caches with simple heuristics like "pin all the > indexes" is unlikely to be helpful. At least it won't optimize the > average case and I think that's been proven. It might be helpf

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread Heikki Linnakangas
On 21.03.2011 17:54, Merlin Moncure wrote: Can't you make just one large mapping and lock it in 8k regions? I thought the problem with mmap was not being able to detect other processes (http://www.mail-archive.com/pgsql-general@postgresql.org/msg122301.html) compatibility issues (possibly obsole

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread Merlin Moncure
On Mon, Mar 21, 2011 at 5:24 AM, Greg Stark wrote: > On Fri, Mar 18, 2011 at 11:55 PM, Josh Berkus wrote: >>> To take the opposite approach... has anyone looked at having the OS just >>> manage all caching for us? Something like MMAPed shared buffers? Even if we >>> find the issue with large sh

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread rsmogura
On Mon, 21 Mar 2011 10:24:22 +, Greg Stark wrote: On Fri, Mar 18, 2011 at 11:55 PM, Josh Berkus wrote: To take the opposite approach... has anyone looked at having the OS just manage all caching for us? Something like MMAPed shared buffers? Even if we find the issue with large shared buffe

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-21 Thread Greg Stark
On Fri, Mar 18, 2011 at 11:55 PM, Josh Berkus wrote: >> To take the opposite approach... has anyone looked at having the OS just >> manage all caching for us? Something like MMAPed shared buffers? Even if we >> find the issue with large shared buffers, we still can't dedicate serious >> amounts

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-18 Thread Josh Berkus
On 3/18/11 11:15 AM, Jim Nasby wrote: > To take the opposite approach... has anyone looked at having the OS just > manage all caching for us? Something like MMAPed shared buffers? Even if we > find the issue with large shared buffers, we still can't dedicate serious > amounts of memory to them b

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-18 Thread Radosław Smogura
"Kevin Grittner" Thursday 17 March 2011 22:02:18 > Rados*aw Smogura wrote: > > I have implemented initial concept of 2nd level cache. Idea is to > > keep some segments of shared memory for special buffers (e.g. > > indices) to prevent overwrite those by other operations. I added > > those function

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-18 Thread Robert Haas
On Fri, Mar 18, 2011 at 2:15 PM, Jim Nasby wrote: > +1 > > To take the opposite approach... has anyone looked at having the OS just > manage all caching for us? Something like MMAPed shared buffers? Even if we > find the issue with large shared buffers, we still can't dedicate serious > amounts

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-18 Thread Jim Nasby
On Mar 18, 2011, at 11:19 AM, Robert Haas wrote: > On Fri, Mar 18, 2011 at 11:14 AM, Kevin Grittner > wrote: > A related area that could use some looking at is why performance tops > out at shared_buffers ~8GB and starts to fall thereafter. InnoDB can > apparently handle much larger buffer pools

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-18 Thread Alvaro Herrera
Excerpts from rsmogura's message of vie mar 18 11:57:48 -0300 2011: > Actually idea of this patch was like this: > Some operations requires many buffers, PG uses "clock sweep" to get > next free buffer, so it may overwrite index buffer. From point of view > of good database design We should

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-18 Thread Robert Haas
On Fri, Mar 18, 2011 at 11:14 AM, Kevin Grittner wrote: > Maybe the thing to focus on first is the oft-discussed "benchmark > farm" (similar to the "build farm"), with a good mix of loads, so > that the impact of changes can be better tracked for multiple > workloads on a variety of platforms and

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-18 Thread Kevin Grittner
rsmogura wrote: > Yes, there is some change, and I looked at this more carefully, as > my performance results wasn't such as I expected. I found PG uses > BufferAccessStrategy to do sequence scans, so my test query took > only 32 buffers from pool and didn't overwritten index pool too > much. T

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-18 Thread rsmogura
On Thu, 17 Mar 2011 16:02:18 -0500, Kevin Grittner wrote: Rados*aw Smogura wrote: I have implemented initial concept of 2nd level cache. Idea is to keep some segments of shared memory for special buffers (e.g. indices) to prevent overwrite those by other operations. I added those functionality

Re: [HACKERS] 2nd Level Buffer Cache

2011-03-17 Thread Kevin Grittner
Rados*aw Smogura wrote: > I have implemented initial concept of 2nd level cache. Idea is to > keep some segments of shared memory for special buffers (e.g. > indices) to prevent overwrite those by other operations. I added > those functionality to nbtree index scan. > > I tested this with doing

[HACKERS] 2nd Level Buffer Cache

2011-03-17 Thread Radosław Smogura
Hi, I have implemented initial concept of 2nd level cache. Idea is to keep some segments of shared memory for special buffers (e.g. indices) to prevent overwrite those by other operations. I added those functionality to nbtree index scan. I tested this with doing index scan, seq read, drop sys