Re: Better LWLocks with compare-and-swap (9.4) - Mailing list pgsql-hackers

From Dickson S. Guedes
Subject Re: Better LWLocks with compare-and-swap (9.4)
Date
Msg-id 5196D0C9.8010200@guedesoft.net
Whole thread Raw
In response to Better LWLocks with compare-and-swap (9.4)  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Responses Re: Better LWLocks with compare-and-swap (9.4)  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Em 13-05-2013 09:50, Heikki Linnakangas escreveu:
> I've been working on-and-off on the WAL-insert scaling patch. It's
> in pretty good shape now, and I'll post it shortly, but one thing I
> noticed is that it benefits a lot from using an atomic
> compare-and-swap instruction for the contention-critical part.
> 
> I realized that we could also use compare-and-swap to make LWLocks
> scale better. The LWLock struct is too large to compare-and-swap
> atomically, but we can still use CAS to increment/decrement the
> shared/exclusive counters, when there's no need to manipulate the
> wait queue. That would help with workloads where you have a lot of
> CPUs, and a lot of backends need to acquire the same lwlock in
> shared mode, but there's no real contention (ie. few exclusive
> lockers).
> 
> pgbench -S is such a workload. With 9.3beta1, I'm seeing this
> profile, when I run "pgbench -S -c64 -j64 -T60 -M prepared" on a
> 32-core Linux machine:
> 
> -  64.09%  postgres  postgres           [.] tas - tas - 99.83%
> s_lock - 53.22% LWLockAcquire + 99.87% GetSnapshotData - 46.78%
> LWLockRelease GetSnapshotData + GetTransactionSnapshot +   2.97%
> postgres  postgres           [.] tas +   1.53%  postgres
> libc-2.13.so       [.] 0x119873 +   1.44%  postgres  postgres
> [.] GetSnapshotData +   1.29%  postgres  [kernel.kallsyms]  [k]
> arch_local_irq_enable +   1.18%  postgres  postgres           [.]
> AllocSetAlloc ...

I'd like to test this here but I couldn't reproduce that perf output
here in a 64-core or 24-core machines, could you post the changes to
postgresql.conf and the perf arguments that you used?

Thanks!

[]s
- -- 
Dickson S. Guedes
mail/xmpp: guedes@guedesoft.net - skype: guediz
http://guedesoft.net - http://www.postgresql.org.br
http://github.net/guedes - twitter: @guediz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJRltDJAAoJEBa5zL7BI5C7UQkH/Au8p90pTMl1qvbft3q1Gtxp
a4PV8fjOrzQou2I+9Sxu5W1ql3qyVmfFare+bJVKg5L3LmvACjZ6bbw9oKBEnPGB
vzE9nB6+3F3eyo464Niq19cTVgmyRQBcuOT/Ye88Uh2mrrgUYB+lGfk9M2Af7on1
nUZI5YsWWXt/bm9wf6rRCzDs76fS7ity943V0aSg2AHryjfcB8o4oBhJBnrRfnm7
v+SxLg0xDEWQPo8VOCQlIw5IhoxNokHjMAt8Ho7o0dXJRR91vSerdulK4Uxkz13Q
E9GlDBDBzZsHmqHCGECNSglqVegXRA5g2i/o3tmQ/lEKzCF9OiX7GBSkXN+gEsc=
=nGJ5
-----END PGP SIGNATURE-----



pgsql-hackers by date:

Previous
From: Nicolas Barbier
Date:
Subject: Re: counting algorithm for incremental matview maintenance
Next
From: Liming Hu
Date:
Subject: Re: request a new feature in fuzzystrmatch