BLCKSZ fun facts

Lists: pgsql-hackerspgsql-patches
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: BLCKSZ fun facts
Date: 2006-11-28 16:46:30
Message-ID: 200611281746.32245.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

The smallest BLCKSZ that you can compile is 256. But ...

The smallest BLCKSZ that actually works is 1024, because of this code in
guc.c:

case GUC_UNIT_BLOCKS:
val /= (BLCKSZ / 1024);

Maybe it's worth adding an #error here to prevent smaller sizes being
used?

The smallest BLCKSZ that passes the regression tests is 4096. With
smaller settings your get half a dozen ordering differences, which
seems OK.

The shared memory configuration code in initdb doesn't know about
BLCKSZ, so with smaller sizes you get less shared buffers. Maybe that
is worth fixing sometime.

Aside from that my pgbench testing clearly shows that block sizes larger
than 2048 become progressively slower. Go figure.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: BLCKSZ fun facts
Date: 2006-11-28 17:08:59
Message-ID: 17186.1164733739@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Aside from that my pgbench testing clearly shows that block sizes larger
> than 2048 become progressively slower. Go figure.

I believe that pgbench only stresses the "small writes" case, so
perhaps this result isn't too surprising. You'd want to look at a mix
of small and bulk updates before drawing any final conclusions.

regards, tom lane


From: Kenneth Marshall <ktm(at)it(dot)is(dot)rice(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: BLCKSZ fun facts
Date: 2006-11-28 17:15:27
Message-ID: 20061128171527.GC20126@it.is.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

On Tue, Nov 28, 2006 at 12:08:59PM -0500, Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > Aside from that my pgbench testing clearly shows that block sizes larger
> > than 2048 become progressively slower. Go figure.
>
> I believe that pgbench only stresses the "small writes" case, so
> perhaps this result isn't too surprising. You'd want to look at a mix
> of small and bulk updates before drawing any final conclusions.
>
> regards, tom lane
>
It has certainly been the case in every benchmark that I have ever seen
from RAID controllers to filesystem layouts that the sweet spot in the
trade-offs between small and large blocksizes was 8k. Other reasons
such as the need to cover a very large filespace of support many small
<< 1024 byte files, could tip the scales towards larger or smaller
blocksizes.

Ken


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BLCKSZ fun facts
Date: 2007-02-20 23:50:50
Message-ID: 200702202350.l1KNoo704993@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches


I have implemented your ideas for checking BLCKSZ >= 1024, and having
initdb adjust shared buffers checks based on BLCKSZ.

Patch attached and applied.

---------------------------------------------------------------------------

Peter Eisentraut wrote:
> The smallest BLCKSZ that you can compile is 256. But ...
>
> The smallest BLCKSZ that actually works is 1024, because of this code in
> guc.c:
>
> case GUC_UNIT_BLOCKS:
> val /= (BLCKSZ / 1024);
>
> Maybe it's worth adding an #error here to prevent smaller sizes being
> used?
>
> The smallest BLCKSZ that passes the regression tests is 4096. With
> smaller settings your get half a dozen ordering differences, which
> seems OK.
>
> The shared memory configuration code in initdb doesn't know about
> BLCKSZ, so with smaller sizes you get less shared buffers. Maybe that
> is worth fixing sometime.
>
> Aside from that my pgbench testing clearly shows that block sizes larger
> than 2048 become progressively slower. Go figure.
>
> --
> Peter Eisentraut
> http://developer.postgresql.org/~petere/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 1.3 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BLCKSZ fun facts
Date: 2007-02-22 07:37:02
Message-ID: 200702220837.03198.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:
> I have implemented your ideas for checking BLCKSZ >= 1024,

I think the check should be were the issue arises, not in some distant
file without explanation.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BLCKSZ fun facts
Date: 2007-02-23 21:36:19
Message-ID: 200702232136.l1NLaJa18900@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > I have implemented your ideas for checking BLCKSZ >= 1024,
>
> I think the check should be were the issue arises, not in some distant
> file without explanation.

OK, moved to guc.c.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +