On 2014-12-24 10:00:05 -0500, Bruce Momjian wrote:
> On Wed, Dec 24, 2014 at 10:30:19AM +0100, Andres Freund wrote:
> > On 2014-12-23 22:51:22 -0500, Bruce Momjian wrote:
> > > Many of these are 64-byte aligned, including Buffer Descriptors.
> > 
> > In that case you need to change max_connections, some settings will lead
> > to unaligned BufferDescriptors.
> 
> Well, isn't my second patch that misaligns the buffers sufficient for
> testing?

I hadn't looked at it. Note that you're quite likely to overlap the
allocated region into the next one with the trivial method you're using.

I just verified that I can still reproduce the problem:

# aligned case (max_connections=401)
afreund@axle:~$ pgbench -P 1 -h /tmp/ -p5440 postgres -n -M prepared -c 96 -j 
96 -T 100 -S
progress: 1.0 s, 405170.2 tps, lat 0.195 ms stddev 0.928
progress: 2.0 s, 467011.1 tps, lat 0.204 ms stddev 0.140
progress: 3.0 s, 462832.1 tps, lat 0.205 ms stddev 0.154
progress: 4.0 s, 471035.5 tps, lat 0.202 ms stddev 0.154
progress: 5.0 s, 500329.0 tps, lat 0.190 ms stddev 0.132

BufferDescriptors is at 0x7f63610a6960 (which is 32byte aligned)

# unaligned case (max_connections=400)
afreund@axle:~$ pgbench -P 1 -h /tmp/ -p5440 postgres -n -M prepared -c 96 -j 
96 -T 100 -S
progress: 1.0 s, 202271.1 tps, lat 0.448 ms stddev 1.232
progress: 2.0 s, 223823.4 tps, lat 0.427 ms stddev 3.007
progress: 3.0 s, 227584.5 tps, lat 0.414 ms stddev 4.760
progress: 4.0 s, 221095.6 tps, lat 0.410 ms stddev 4.390
progress: 5.0 s, 217430.6 tps, lat 0.454 ms stddev 7.913
progress: 6.0 s, 210275.9 tps, lat 0.411 ms stddev 0.606
BufferDescriptors is at 0x7f1718aeb980 (which is 64byte aligned)

This is on a quad E5-4620 with 256GB RAM on a scale 100 pgbench
instance.

> > > Can someone test these patches on an AMD CPU and see if you see a
> > > difference?  Thanks.
> > 
> > I don't think you'll see a bigger difference there.
> 
> Uh, I thought AMD showed a huge difference for misalignment:
> 
>       
> http://www.postgresql.org/message-id/20140202151319.gd32...@awork2.anarazel.de

Ugh, yes. Forgot that... There was another patch that wasn't showing big
differences on AMD, and I mixed it up.

> I ended up running pgbench using 16-scale and got 90k tps:
> 
>       pgbench -S -c 16 -j 16 -t 100000 pgbench
> 
> but again could not see any difference between aligned and misaligned.

At the very least you should use -M prepared, otherwise you'll be
bottlenecked by the parser.

Greetings,

Andres Freund

-- 
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to