Hello!
The previous discussion was here:
https://www.postgresql.org/message-id/flat/b570c367-ba38-95f3-f62d-5f59b9808226%40inbox.ru
On 15.11.2022 04:59, Tom Lane wrote:
"Anton A. Melnikov" <aamelni...@inbox.ru> writes:
Additionally
i've tried to reduce overall number of nodes previously
used in this test in a similar way.
Optimizing existing tests isn't an answer to that. We could
install those optimizations without adding a new test case.
Here is a separate patch for the node usage optimization mentioned above.
It decreases the CPU usage during 100_bugs.pl by about 30%.
There are also some experimental data: 100_bugs-CPU-usage.txt
Would be glad for any comments and concerns.
With best regards,
--
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
commit 72ea85b5f6a64f2c53e6a55455d134b228b6994b
Author: Anton A. Melnikov <a.melni...@postgrespro.ru>
Date: Mon Nov 14 08:30:26 2022 +0300
Reuse nodes in subscription/t/100_bugs.pl test to make in faster.
diff --git a/src/test/subscription/t/100_bugs.pl b/src/test/subscription/t/100_bugs.pl
index 6247aa7730..525584b2b6 100644
--- a/src/test/subscription/t/100_bugs.pl
+++ b/src/test/subscription/t/100_bugs.pl
@@ -81,9 +81,8 @@ $node_subscriber->stop('fast');
# identity set before accepting updates. If it did not it would cause
# an error when an update was attempted.
-$node_publisher = PostgreSQL::Test::Cluster->new('publisher2');
-$node_publisher->init(allows_streaming => 'logical');
-$node_publisher->start;
+$node_publisher->rotate_logfile();
+$node_publisher->start();
$node_publisher->safe_psql('postgres',
"CREATE PUBLICATION pub FOR ALL TABLES");
@@ -226,13 +225,13 @@ $node_sub->stop('fast');
# target table's relcache was not being invalidated. This leads to skipping
# UPDATE/DELETE operations during apply on the subscriber side as the columns
# required to search corresponding rows won't get logged.
-$node_publisher = PostgreSQL::Test::Cluster->new('publisher3');
-$node_publisher->init(allows_streaming => 'logical');
-$node_publisher->start;
-$node_subscriber = PostgreSQL::Test::Cluster->new('subscriber3');
-$node_subscriber->init(allows_streaming => 'logical');
-$node_subscriber->start;
+$node_publisher->rotate_logfile();
+$node_publisher->start();
+
+$node_subscriber->rotate_logfile();
+$node_subscriber->rotate_logfile(); # call twice to synchronize lognames between master and replica
+$node_subscriber->start();
$node_publisher->safe_psql('postgres',
"CREATE TABLE tab_replidentity_index(a int not null, b int not null)");
########## src/test/subscription/100_bugs.pl ########################
Before reuse nodes:
Files=1, Tests=7, 12 wallclock secs ( 0.02 usr 0.00 sys + 8.02 cusr 1.96
csys = 10.00 CPU)
Files=1, Tests=7, 14 wallclock secs ( 0.02 usr 0.00 sys + 7.99 cusr 2.23
csys = 10.24 CPU)
Files=1, Tests=7, 15 wallclock secs ( 0.01 usr 0.00 sys + 8.31 cusr 2.16
csys = 10.48 CPU)
Files=1, Tests=7, 14 wallclock secs ( 0.01 usr 0.00 sys + 8.29 cusr 2.08
csys = 10.38 CPU)
Files=1, Tests=7, 14 wallclock secs ( 0.01 usr 0.00 sys + 8.01 cusr 2.14
csys = 10.16 CPU)
Files=1, Tests=7, 13 wallclock secs ( 0.02 usr 0.00 sys + 8.13 cusr 2.04
csys = 10.19 CPU)
Files=1, Tests=7, 13 wallclock secs ( 0.02 usr 0.00 sys + 8.11 cusr 2.11
csys = 10.24 CPU)
Files=1, Tests=7, 14 wallclock secs ( 0.02 usr 0.00 sys + 8.04 cusr 2.19
csys = 10.25 CPU)
Files=1, Tests=7, 12 wallclock secs ( 0.01 usr 0.00 sys + 8.02 cusr 2.07
csys = 10.10 CPU)
Files=1, Tests=7, 13 wallclock secs ( 0.02 usr 0.00 sys + 8.05 cusr 2.09
csys = 10.16 CPU)
Average CPU usage = 10.22+-0.04s
After reuse nodes:
Files=1, Tests=7, 11 wallclock secs ( 0.01 usr 0.00 sys + 5.68 cusr 1.56
csys = 7.25 CPU)
Files=1, Tests=7, 11 wallclock secs ( 0.02 usr 0.00 sys + 5.61 cusr 1.60
csys = 7.23 CPU)
Files=1, Tests=7, 11 wallclock secs ( 0.02 usr 0.00 sys + 5.66 cusr 1.64
csys = 7.32 CPU)
Files=1, Tests=7, 12 wallclock secs ( 0.02 usr 0.00 sys + 5.76 cusr 1.63
csys = 7.41 CPU)
Files=1, Tests=7, 11 wallclock secs ( 0.02 usr 0.00 sys + 5.60 cusr 1.61
csys = 7.23 CPU)
Files=1, Tests=7, 10 wallclock secs ( 0.02 usr 0.00 sys + 5.63 cusr 1.65
csys = 7.30 CPU)
Files=1, Tests=7, 10 wallclock secs ( 0.02 usr 0.00 sys + 5.64 cusr 1.58
csys = 7.24 CPU)
Files=1, Tests=7, 12 wallclock secs ( 0.01 usr 0.00 sys + 5.59 cusr 1.75
csys = 7.35 CPU)
Files=1, Tests=7, 11 wallclock secs ( 0.01 usr 0.00 sys + 5.54 cusr 1.74
csys = 7.29 CPU)
Files=1, Tests=7, 10 wallclock secs ( 0.02 usr 0.00 sys + 5.62 cusr 1.57
csys = 7.21 CPU)
Average CPU usage = 7.28+-0.02s