AW: [HACKERS] CommitDelay performance improvement

2001-02-27 Thread Zeugswetter Andreas SB
I agree that 30k looks like the magic delay, and probably 30/5 would be a good conservative choice. But now I think about the choice of number, I think it must vary with the speed of the machine and length of the transactions; at 20tps, each TX is completing in around 50ms. I think disk

Re: AW: [HACKERS] CommitDelay performance improvement

2001-02-27 Thread Philip Warner
At 10:56 27/02/01 +0100, Zeugswetter Andreas SB wrote: I agree that 30k looks like the magic delay, and probably 30/5 would be a good conservative choice. But now I think about the choice of number, I think it must vary with the speed of the machine and length of the transactions; at

AW: [HACKERS] CommitDelay performance improvement

2001-02-26 Thread Zeugswetter Andreas SB
One thing that I remember from a performance test we once did is, that the results are a lot more realistic, better and more stable, if you try to decouple the startup of the different clients a little bit, so they are not all in the same section of code at the same time. We inserted random

Re: [HACKERS] CommitDelay performance improvement

2001-02-25 Thread Nathan Myers
On Sun, Feb 25, 2001 at 12:41:28AM -0500, Tom Lane wrote: Attached are graphs from more thorough runs of pgbench with a commit delay that occurs only when at least N other backends are running active transactions. ... It's not entirely clear what set of parameters is best, but it is

Re: [HACKERS] CommitDelay performance improvement

2001-02-25 Thread Philip Warner
At 00:42 25/02/01 -0800, Nathan Myers wrote: The only really bad performers were (0), (10k,1), (100k,20). The best were (30k,1) and (30k,10), although (30k,5) also did well except at 40. Why would 30k be a magic delay, regardless of siblings? What happened at 40? I had assumed that 40 was

RE: [HACKERS] CommitDelay performance improvement

2001-02-25 Thread Hiroshi Inoue
-Original Message- From: Tom Lane Attached are graphs from more thorough runs of pgbench with a commit delay that occurs only when at least N other backends are running active transactions. My initial try at this proved to be too noisy to tell much. The noise seems to be

Re: [HACKERS] CommitDelay performance improvement

2001-02-25 Thread Tom Lane
"Hiroshi Inoue" [EMAIL PROTECTED] writes: How about the case with scaling factor 1 ? i.e Could your proposal detect lock conflicts in reality ? The code is set up to not count backends that are waiting on locks. That is, to do a commit delay there must be at least N other backends that are in

Re: [HACKERS] CommitDelay performance improvement

2001-02-25 Thread Tom Lane
Philip Warner [EMAIL PROTECTED] writes: At 00:42 25/02/01 -0800, Nathan Myers wrote: The only really bad performers were (0), (10k,1), (100k,20). The best were (30k,1) and (30k,10), although (30k,5) also did well except at 40. Why would 30k be a magic delay, regardless of siblings? What

Re: [HACKERS] CommitDelay performance improvement

2001-02-25 Thread Tom Lane
[EMAIL PROTECTED] (Nathan Myers) writes: At low loads, it seems (100k,1) (brown +) did best by far, which seems very odd. Even more odd, it did pretty well at very high loads but had problems at intermediate loads. In theory, all these variants should behave exactly the same for a single

Re: [HACKERS] CommitDelay performance improvement

2001-02-25 Thread Hiroshi Inoue
Tom Lane wrote: Philip Warner [EMAIL PROTECTED] writes: At 00:42 25/02/01 -0800, Nathan Myers wrote: The only really bad performers were (0), (10k,1), (100k,20). The best were (30k,1) and (30k,10), although (30k,5) also did well except at 40. Why would 30k be a magic delay, regardless

Re: [HACKERS] CommitDelay performance improvement

2001-02-25 Thread Dominique Quatravaux
Basically, I am not sure how much we lose by doing the delay after returning COMMIT, and I know we gain quite a bit by enabling us to group fsync calls. If included, this should be an option only, and not the default option. Sure it should never become the default, because the "D" in

Re: [HACKERS] CommitDelay performance improvement

2001-02-24 Thread Nathan Myers
On Sat, Feb 24, 2001 at 01:07:17AM -0500, Tom Lane wrote: [EMAIL PROTECTED] (Nathan Myers) writes: I see, I had it backwards: N=0 corresponds to "always delay", and N=infinity (~0) is "never delay", or what you call zero delay. N=1 is not interesting. N=M/2 or N=sqrt(M) or N=log(M)

Re: [HACKERS] CommitDelay performance improvement

2001-02-24 Thread Tom Lane
Attached are graphs from more thorough runs of pgbench with a commit delay that occurs only when at least N other backends are running active transactions. My initial try at this proved to be too noisy to tell much. The noise seems to be coming from WAL checkpoints that occur during a run and

Re: [HACKERS] CommitDelay performance improvement

2001-02-24 Thread Philip Warner
At 00:41 25/02/01 -0500, Tom Lane wrote: Comments anyone? Don't suppose you could post the original data? Philip Warner| __---_ Albatross Consulting Pty. Ltd. |/ - \ (A.B.N. 75 008 659

Re: [HACKERS] CommitDelay performance improvement

2001-02-24 Thread Tom Lane
Philip Warner [EMAIL PROTECTED] writes: Don't suppose you could post the original data? Sure. regards, tom lane commit_delay = 0 commit_siblings = 1 CHECKPOINT transaction type: TPC-B (sort of) scaling factor: 10 number of clients: 1 number of transactions per client:

[HACKERS] CommitDelay performance improvement

2001-02-23 Thread Tom Lane
Looking at the XLOG stuff, I notice that we already have a field (logRec) in the per-backend PROC structures that shows whether a transaction is currently in progress with at least one change made (ie at least one XLOG entry written). It would be very easy to extend the existing code so that the

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
Bruce Momjian [EMAIL PROTECTED] writes: Why not just set a flag in there when someone nears commit and clear when they are about to commit? Define "nearing commit", in such a way that you can specify where you plan to set that flag. Is there significant time between entry of

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
Looking at the XLOG stuff, I notice that we already have a field (logRec) in the per-backend PROC structures that shows whether a transaction is currently in progress with at least one change made (ie at least one XLOG entry written). It would be very easy to extend the existing code so

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: Why not just set a flag in there when someone nears commit and clear when they are about to commit? Define "nearing commit", in such a way that you can specify where you plan to set that flag. regards, tom lane

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
Bruce Momjian [EMAIL PROTECTED] writes: Is there significant time between entry of CommitTransaction() and the fsync()? Maybe not. I doubt it. No I/O anymore, anyway, unless the commit record happens to overrun an xlog block boundary. That's what I was afraid of. Since we don't write

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Nathan Myers
On Fri, Feb 23, 2001 at 11:32:21AM -0500, Tom Lane wrote: A further refinement, still quite cheap to implement since the info is in the PROC struct, would be to not count backends that are blocked waiting for locks. These guys are less likely to be ready to commit in the next few

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
On Fri, Feb 23, 2001 at 11:32:21AM -0500, Tom Lane wrote: A further refinement, still quite cheap to implement since the info is in the PROC struct, would be to not count backends that are blocked waiting for locks. These guys are less likely to be ready to commit in the next few

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Tom Lane
[EMAIL PROTECTED] (Nathan Myers) writes: Comments? What should the threshold N be ... or do we need to make that a tunable parameter? Once you make it tuneable, you're stuck with it. You can always add a knob later, after somebody discovers a real need. If we had a good idea what the

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
[EMAIL PROTECTED] (Nathan Myers) writes: Comments? What should the threshold N be ... or do we need to make that a tunable parameter? Once you make it tuneable, you're stuck with it. You can always add a knob later, after somebody discovers a real need. If we had a good idea what

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
And if they have, should we be more likely to fsync() in the future? I meant more likely to sleep(). You mean less likely. My thought for a self-adjusting delay was to ratchet the delay up a little every time it succeeds in avoiding an fsync, and down a little every time it fails to do

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: A self-adjusting delay might well be a great idea, BTW, but I'm trying to be conservative about how much complexity we should add right now. OH, so you are saying N backends should have dirtied buffers before doing the delay? Hmm, that seems almost

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: It could be tough. Imagine the delay increasing to 3 seconds? Seems there has to be an upper bound on the sleep. The more you delay, the more likely you will be to find someone to fsync you. Good point, and an excellent illustration of the fact that

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Nathan Myers
On Fri, Feb 23, 2001 at 05:18:19PM -0500, Tom Lane wrote: [EMAIL PROTECTED] (Nathan Myers) writes: Comments? What should the threshold N be ... or do we need to make that a tunable parameter? Once you make it tuneable, you're stuck with it. You can always add a knob later, after

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
When thinking about tuning N, I like to consider what are the interesting possible values for N: 0: Ignore any other potential committers. 1: The minimum possible responsiveness to other committers. 5: Tom's guess for what might be a good choice. 10: Harry's guess. ~0: Always

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
Bruce Momjian [EMAIL PROTECTED] writes: It could be tough. Imagine the delay increasing to 3 seconds? Seems there has to be an upper bound on the sleep. The more you delay, the more likely you will be to find someone to fsync you. Good point, and an excellent illustration of the fact

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: Can we put the backends to sleep waiting for a lock, and have them wake up later? Locks don't have timeouts. There is no existing mechanism that will serve this purpose; we'll have to create a new one. regards, tom lane

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Nathan Myers
On Fri, Feb 23, 2001 at 06:37:06PM -0500, Bruce Momjian wrote: When thinking about tuning N, I like to consider what are the interesting possible values for N: 0: Ignore any other potential committers. 1: The minimum possible responsiveness to other committers. 5: Tom's guess

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
It seems to me that comparing various choices (and other, more interesting, algorithms) to the N=1 case would be more productive than comparing them to the N=0 case, so releasing at N=1 would yield better statistics for actually tuning in 7.2. We don't release code because it has

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
Bruce Momjian [EMAIL PROTECTED] writes: Can we put the backends to sleep waiting for a lock, and have them wake up later? Locks don't have timeouts. There is no existing mechanism that will serve this purpose; we'll have to create a new one. That is what I suspected. Having thought

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Philip Warner
At 21:31 23/02/01 -0500, Bruce Momjian wrote: Now, I know many will complain that we are returning commit while not having the stuff on the platter. You're definitely right there. Maybe they do, but it seems the benefit of grouped fsyncs() is large enough that many will say they would rather

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
At 21:31 23/02/01 -0500, Bruce Momjian wrote: Now, I know many will complain that we are returning commit while not having the stuff on the platter. You're definitely right there. Maybe they do, but it seems the benefit of grouped fsyncs() is large enough that many will say they would

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Philip Warner
At 11:32 23/02/01 -0500, Tom Lane wrote: Looking at the XLOG stuff, I notice that we already have a field (logRec) in the per-backend PROC structures that shows whether a transaction is currently in progress with at least one change made (ie at least one XLOG entry written). Would it be worth

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Philip Warner
At 23:14 23/02/01 -0500, Bruce Momjian wrote: There is one more thing. Even though the kernel says the data is on the platter, it still may not be there. This is true, but it does not mean we should say 'the disk is slightly unreliable, so we can be too'. Also, IIRC, the last time this was

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Nathan Myers
On Fri, Feb 23, 2001 at 09:05:20PM -0500, Bruce Momjian wrote: It seems to me that comparing various choices (and other, more interesting, algorithms) to the N=1 case would be more productive than comparing them to the N=0 case, so releasing at N=1 would yield better statistics

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
At 23:14 23/02/01 -0500, Bruce Momjian wrote: There is one more thing. Even though the kernel says the data is on the platter, it still may not be there. This is true, but it does not mean we should say 'the disk is slightly unreliable, so we can be too'. Also, IIRC, the last time this

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
Bruce Momjian [EMAIL PROTECTED] writes: My idea would be to let committing backends return "COMMIT" to the user, and set a need_fsync flag that is guaranteed to cause an fsync within X milliseconds. This way, if other backends commit in the next X millisecond, they can all use one

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: My idea would be to let committing backends return "COMMIT" to the user, and set a need_fsync flag that is guaranteed to cause an fsync within X milliseconds. This way, if other backends commit in the next X millisecond, they can all use one fsync().

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
At 21:31 23/02/01 -0500, Bruce Momjian wrote: Now, I know many will complain that we are returning commit while not having the stuff on the platter. You're definitely right there. Maybe they do, but it seems the benefit of grouped fsyncs() is large enough that many will say they would

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Tom Lane
Philip Warner [EMAIL PROTECTED] writes: It may have been much earler in the debate, but has anyone checked to see what the maximum possible gains might be - or is it self-evident to people who know the code? fsync off provides an upper bound to the speed achievable from being smarter about

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Tom Lane
Preliminary results from experimenting with an N-transactions-must-be-running-to-cause-commit-delay heuristic are attached. It seems to be a pretty definite win. I'm currently running a more extensive set of cases on another machine for comparison. The test case is pgbench, unmodified, but run

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Tom Lane
[EMAIL PROTECTED] (Nathan Myers) writes: I see, I had it backwards: N=0 corresponds to "always delay", and N=infinity (~0) is "never delay", or what you call zero delay. N=1 is not interesting. N=M/2 or N=sqrt(M) or N=log(M) might be interesting, where M is the number of backends, or the

Re: [HACKERS] CommitDelay performance improvement

2001-02-23 Thread Bruce Momjian
Philip Warner [EMAIL PROTECTED] writes: It may have been much earler in the debate, but has anyone checked to see what the maximum possible gains might be - or is it self-evident to people who know the code? fsync off provides an upper bound to the speed achievable from being smarter