RE: Transactions involving multiple postgres foreign servers, take 2 - Mailing list pgsql-hackers

From r.takahashi_2@fujitsu.com
Subject RE: Transactions involving multiple postgres foreign servers, take 2
Date
Msg-id OS0PR01MB5682B9A0B02C793680F2F5FA821B9@OS0PR01MB5682.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: Transactions involving multiple postgres foreign servers, take 2  (Masahiro Ikeda <ikedamsh@oss.nttdata.com>)
Responses Re: Transactions involving multiple postgres foreign servers, take 2  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-hackers
Hi,


I'm interested in this patch and I also run the same test with Ikeda-san's fxact_update.pgbench.
In my environment (poor spec VM), the result is following.

* foreign_twophase_commit = disabled
363tps

* foreign_twophase_commit = required (It is necessary to set -R ${RATE} as Ikeda-san said)
13tps


I analyzed the bottleneck using pstack and strace.
I noticed that the open() during "COMMIT PREPARED" command is very slow.

In my environment the latency of the "COMMIT PREPARED" is 16ms.
(On the other hand, the latency of "COMMIT" and "PREPARE TRANSACTION" is 1ms)
In the "COMMIT PREPARED" command, open() for wal segment file takes 14ms.
Therefore, open() is the bottleneck of "COMMIT PREPARED".
Furthermore, I noticed that the backend process almost always open the same wal segment file.

In the current patch, the backend process on foreign server which is associated with the connection from the resolver
processalways run "COMMIT PREPARED" command. 
Therefore, the wal segment file of the current "COMMIT PREPARED" command probably be the same with the previous "COMMIT
PREPARED"command. 

In order to improve the performance of the resolver process, I think it is useful to skip closing wal segment file
duringthe "COMMIT PREPARED" and reuse file descriptor. 
Is it possible?


Regards,
Ryohei Takahashi



pgsql-hackers by date:

Previous
From: Ronan Dunklau
Date:
Subject: [PATCH] Use optimized single-datum tuplesort in ExecSort
Next
From: Ronan Dunklau
Date:
Subject: Re: Add proper planner support for ORDER BY / DISTINCT aggregates