Hi Team, Please find the attached diff with the latest changes. The diff file changes that were done for memset and spinlock, are modified on top of the previous patch.
New changes for review: 0001-AIX-support.tas.memset.diffs
Previous patch: 0001-AIX-support.v8.patch
>> diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
>
We have replaced the asm code with the gcc specific routines
__sync_lock_test_and_set ()
and ran the pgbench. On AIX both have the similar performance, On PPcle we see
a slight
variation in the performance. It seems the asm code is performing better on
PPCle. Please
let us know, would it be better to continue to use the PPC assemble code over
gcc routines.
Attached are the complete stats. (spinlock.stats.log)
Below is the summary…
AIX With asm AIX With __sync PPCle With asm PPCle
With __sync
number of transactions "226554/ "230810/ "356945/
"364346/
above the 10.0 ms 556329 567936 918647 863937
latency limit (40.723%)" (40.640%)" (38.856%)"
(42.173%)"
latency average 16.160 ms 15.821 ms 9.796 ms
10.416 ms
initial connection time 230.786 ms 249.668 ms 19.606 ms
20.090 ms
tps 3086.209412 3158.14915 5103.024267
4799.621896
> diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
>
> At least it needs to be updated to match what MemSet() looks like
> nowadays. The changes may be just cosmetic, but better check. Should
> also check the effect on MemSetAligned(). That might matter more for
> performance in practice.
As per the stats in the previous mail wrt to memset, both the loop and the
native
memset are performing similar after optimization “-O2”. So for now we removed
the
native memset changes.
We will setup the memset performance on different platforms and will post the
details in a different thread.
>>> +# -blibpath must contain ALL directories where we should look for libraries
>>> +libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed
>>> -e's/ //g'):/usr/lib:/lib
>
Added additional details about the -blibpath usage. These details are available
in the below link
https://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf
> 21 -- test overflow/underflow handling
>
> 22 SELECT gamma(float8 '-infinity');
>
> 23 ERROR: value out of range: overflow
This testcase is resolved from AIX libm side. Below is the result.
postgres=#
SELECT x, gamma(x),lgamma(x)
FROM (VALUES (0.5), (1), (2), (3), (4), (5),
(float8 'infinity'), (float8 'nan')) AS t(x);
0.5 | 1.772453850905516 | 0.5723649429247001
1 | 1 | 0
2 | 1 | 0
3 | 2 | 0.6931471805599453
4 | 6 | 1.791759469228055
5 | 24 | 3.1780538303479458
Infinity | Infinity | Infinity
NaN | NaN | NaN
Kindly let us know your feedback on the diffs.
I will commit the diffs to the patch(0001-AIX-support.v8.patch) once you are
fine.
Warm regards,
Sriram.
0001-AIX-support.tas.memset.diffs
Description: 0001-AIX-support.tas.memset.diffs
------------------------------------------
AIX with asm spin lock
>> pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 3181.5 tps, lat 15.331 ms stddev 17.867, 0 failed
progress: 20.0 s, 3277.2 tps, lat 14.730 ms stddev 18.792, 0 failed
progress: 30.0 s, 2642.9 tps, lat 19.556 ms stddev 106.940, 0 failed
progress: 40.0 s, 3614.3 tps, lat 13.830 ms stddev 14.673, 0 failed
progress: 50.0 s, 2355.4 tps, lat 21.208 ms stddev 132.907, 0 failed
progress: 60.0 s, 3046.8 tps, lat 16.407 ms stddev 53.507, 0 failed
progress: 70.0 s, 3640.1 tps, lat 13.734 ms stddev 14.549, 0 failed
progress: 80.0 s, 2435.2 tps, lat 20.518 ms stddev 125.603, 0 failed
progress: 90.0 s, 3576.3 tps, lat 13.977 ms stddev 14.341, 0 failed
progress: 100.0 s, 3653.9 tps, lat 13.681 ms stddev 14.554, 0 failed
progress: 110.0 s, 2414.6 tps, lat 20.684 ms stddev 134.585, 0 failed
progress: 120.0 s, 3051.6 tps, lat 16.383 ms stddev 63.253, 0 failed
progress: 130.0 s, 3657.2 tps, lat 13.667 ms stddev 14.375, 0 failed
progress: 140.0 s, 3159.0 tps, lat 14.259 ms stddev 18.915, 0 failed
progress: 150.0 s, 2889.8 tps, lat 19.006 ms stddev 121.852, 0 failed
progress: 160.0 s, 3649.0 tps, lat 13.693 ms stddev 14.288, 0 failed
progress: 170.0 s, 2799.8 tps, lat 14.552 ms stddev 17.307, 0 failed
progress: 180.0 s, 2582.9 tps, lat 22.914 ms stddev 121.785, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 556329
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 226554/556329 (40.723%)
latency average = 16.160 ms
latency stddev = 69.085 ms
initial connection time = 230.786 ms
tps = 3086.209412 (without initial connection time)
statement latencies in milliseconds and failures:
0.002 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
1.084 0 BEGIN;
2.997 0 UPDATE pgbench_accounts SET abalance = abalance +
:delta WHERE aid = :aid;
1.400 0 SELECT abalance FROM pgbench_accounts WHERE aid =
:aid;
2.014 0 UPDATE pgbench_tellers SET tbalance = tbalance +
:delta WHERE tid = :tid;
4.094 0 UPDATE pgbench_branches SET bbalance = bbalance +
:delta WHERE bid = :bid;
1.217 0 INSERT INTO pgbench_history (tid, bid, aid, delta,
mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
3.346 0 END;
------------------------------------------
AIX with __sync_lock_test_and_set
pgdev@roxxpg2:~/pgdb/postgres/install]
>> pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L 10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 3391.8 tps, lat 14.339 ms stddev 13.922, 0 failed
progress: 20.0 s, 2724.0 tps, lat 18.350 ms stddev 96.241, 0 failed
progress: 30.0 s, 3571.4 tps, lat 14.001 ms stddev 14.957, 0 failed
progress: 40.0 s, 2630.9 tps, lat 18.993 ms stddev 115.583, 0 failed
progress: 50.0 s, 3574.5 tps, lat 13.984 ms stddev 14.838, 0 failed
progress: 60.0 s, 3577.0 tps, lat 13.973 ms stddev 15.055, 0 failed
progress: 70.0 s, 2401.7 tps, lat 20.810 ms stddev 149.104, 0 failed
progress: 80.0 s, 2891.0 tps, lat 17.291 ms stddev 73.637, 0 failed
progress: 90.0 s, 3529.0 tps, lat 14.160 ms stddev 15.212, 0 failed
progress: 100.0 s, 2637.2 tps, lat 18.951 ms stddev 111.379, 0 failed
progress: 110.0 s, 3593.1 tps, lat 13.903 ms stddev 14.604, 0 failed
progress: 120.0 s, 3560.3 tps, lat 14.048 ms stddev 14.926, 0 failed
progress: 130.0 s, 3230.5 tps, lat 13.796 ms stddev 15.330, 0 failed
progress: 140.0 s, 2293.2 tps, lat 24.154 ms stddev 163.908, 0 failed
progress: 150.0 s, 3511.8 tps, lat 14.219 ms stddev 15.367, 0 failed
progress: 160.0 s, 3612.9 tps, lat 13.836 ms stddev 14.839, 0 failed
progress: 170.0 s, 2523.9 tps, lat 19.811 ms stddev 129.520, 0 failed
progress: 180.0 s, 3533.7 tps, lat 14.136 ms stddev 14.988, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 567936
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 230810/567936 (40.640%)
latency average = 15.821 ms
latency stddev = 69.610 ms
initial connection time = 249.668 ms
tps = 3158.149150 (without initial connection time)
statement latencies in milliseconds and failures:
0.002 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
1.092 0 BEGIN;
2.794 0 UPDATE pgbench_accounts SET abalance = abalance +
:delta WHERE aid = :aid;
1.472 0 SELECT abalance FROM pgbench_accounts WHERE aid =
:aid;
2.040 0 UPDATE pgbench_tellers SET tbalance = tbalance +
:delta WHERE tid = :tid;
4.062 0 UPDATE pgbench_branches SET bbalance = bbalance +
:delta WHERE bid = :bid;
1.225 0 INSERT INTO pgbench_history (tid, bid, aid, delta,
mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
3.117 0 END;
------------------------------------------
PPCle with asm code
Pple - with asm
[pgdev@roxxpg3 install]$ pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L
10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 4932.9 tps, lat 10.110 ms stddev 7.215, 0 failed
progress: 20.0 s, 5041.2 tps, lat 9.916 ms stddev 6.794, 0 failed
progress: 30.0 s, 5135.3 tps, lat 9.737 ms stddev 6.572, 0 failed
progress: 40.0 s, 5085.2 tps, lat 9.830 ms stddev 6.556, 0 failed
progress: 50.0 s, 5199.0 tps, lat 9.616 ms stddev 6.579, 0 failed
progress: 60.0 s, 5173.5 tps, lat 9.663 ms stddev 6.536, 0 failed
progress: 70.0 s, 5184.9 tps, lat 9.643 ms stddev 6.796, 0 failed
progress: 80.0 s, 5205.1 tps, lat 9.605 ms stddev 6.639, 0 failed
progress: 90.0 s, 5209.5 tps, lat 9.598 ms stddev 6.636, 0 failed
progress: 100.0 s, 5141.9 tps, lat 9.723 ms stddev 6.631, 0 failed
progress: 110.0 s, 5204.0 tps, lat 9.607 ms stddev 6.494, 0 failed
progress: 120.0 s, 5187.3 tps, lat 9.638 ms stddev 6.683, 0 failed
progress: 130.0 s, 5046.7 tps, lat 9.904 ms stddev 6.820, 0 failed
progress: 140.0 s, 4643.9 tps, lat 10.768 ms stddev 7.380, 0 failed
progress: 150.0 s, 5080.3 tps, lat 9.840 ms stddev 6.681, 0 failed
progress: 160.0 s, 5152.3 tps, lat 9.705 ms stddev 6.669, 0 failed
progress: 170.0 s, 5106.7 tps, lat 9.790 ms stddev 6.518, 0 failed
progress: 180.0 s, 5130.0 tps, lat 9.743 ms stddev 6.651, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 918647
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 356945/918647 (38.856%)
latency average = 9.796 ms
latency stddev = 6.718 ms
initial connection time = 19.606 ms
tps = 5103.024267 (without initial connection time)
statement latencies in milliseconds and failures:
0.001 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
0.578 0 BEGIN;
1.764 0 UPDATE pgbench_accounts SET abalance = abalance +
:delta WHERE aid = :aid;
0.595 0 SELECT abalance FROM pgbench_accounts WHERE aid =
:aid;
0.922 0 UPDATE pgbench_tellers SET tbalance = tbalance +
:delta WHERE tid = :tid;
2.504 0 UPDATE pgbench_branches SET bbalance = bbalance +
:delta WHERE bid = :bid;
0.499 0 INSERT INTO pgbench_history (tid, bid, aid, delta,
mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
2.956 0 END;
------------------------------------------
PPCle with __sync_lock_test_and_set
PPCle - with __sync
[pgdev@roxxpg3 install]$ pgbench -c 50 -p 5678 -d postgres -T 180 -r -P 10 -L
10 -j 20
pgbench (18devel)
starting vacuum...end.
progress: 10.0 s, 4817.2 tps, lat 10.353 ms stddev 7.367, 0 failed
progress: 20.0 s, 4737.2 tps, lat 10.552 ms stddev 7.232, 0 failed
progress: 30.0 s, 4774.7 tps, lat 10.470 ms stddev 7.186, 0 failed
progress: 40.0 s, 4892.3 tps, lat 10.219 ms stddev 7.072, 0 failed
progress: 50.0 s, 4811.5 tps, lat 10.391 ms stddev 7.123, 0 failed
progress: 60.0 s, 4883.1 tps, lat 10.242 ms stddev 6.962, 0 failed
progress: 70.0 s, 4867.8 tps, lat 10.269 ms stddev 7.049, 0 failed
progress: 80.0 s, 4886.6 tps, lat 10.228 ms stddev 7.037, 0 failed
progress: 90.0 s, 4765.9 tps, lat 10.494 ms stddev 7.149, 0 failed
progress: 100.0 s, 4902.0 tps, lat 10.198 ms stddev 7.030, 0 failed
progress: 110.0 s, 4815.3 tps, lat 10.381 ms stddev 7.208, 0 failed
progress: 120.0 s, 4807.1 tps, lat 10.400 ms stddev 7.059, 0 failed
progress: 130.0 s, 4932.0 tps, lat 10.137 ms stddev 6.973, 0 failed
progress: 140.0 s, 4880.6 tps, lat 10.244 ms stddev 7.009, 0 failed
progress: 150.0 s, 4613.2 tps, lat 10.837 ms stddev 7.594, 0 failed
progress: 160.0 s, 4335.8 tps, lat 11.533 ms stddev 7.776, 0 failed
progress: 170.0 s, 4904.0 tps, lat 10.194 ms stddev 6.935, 0 failed
progress: 180.0 s, 4762.6 tps, lat 10.501 ms stddev 7.194, 0 failed
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 50
query mode: simple
number of clients: 50
number of threads: 20
maximum number of tries: 1
duration: 180 s
number of transactions actually processed: 863937
number of failed transactions: 0 (0.000%)
number of transactions above the 10.0 ms latency limit: 364346/863937 (42.173%)
latency average = 10.416 ms
latency stddev = 7.168 ms
initial connection time = 20.090 ms
tps = 4799.621896 (without initial connection time)
statement latencies in milliseconds and failures:
0.001 0 \set aid random(1, 100000 * :scale)
0.001 0 \set bid random(1, 1 * :scale)
0.001 0 \set tid random(1, 10 * :scale)
0.001 0 \set delta random(-5000, 5000)
0.628 0 BEGIN;
1.793 0 UPDATE pgbench_accounts SET abalance = abalance +
:delta WHERE aid = :aid;
0.627 0 SELECT abalance FROM pgbench_accounts WHERE aid =
:aid;
0.977 0 UPDATE pgbench_tellers SET tbalance = tbalance +
:delta WHERE tid = :tid;
2.694 0 UPDATE pgbench_branches SET bbalance = bbalance +
:delta WHERE bid = :bid;
0.525 0 INSERT INTO pgbench_history (tid, bid, aid, delta,
mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
3.194 0 END;
------------------------------------------
0001-AIX-support.v8.patch
Description: 0001-AIX-support.v8.patch
