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 OS0PR01MB5682205E48306CCADA88D30482149@OS0PR01MB5682.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: Transactions involving multiple postgres foreign servers, take 2  (Masahiko Sawada <sawada.mshk@gmail.com>)
Responses Re: Transactions involving multiple postgres foreign servers, take 2  (Ranier Vilela <ranier.vf@gmail.com>)
Re: Transactions involving multiple postgres foreign servers, take 2  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-hackers
Hi Sawada-san,


Thank you for your reply.

> Not sure but it might be possible to keep holding an xlogreader for
> reading PREPARE WAL records even after the transaction commit. But I
> wonder how much open() for wal segment file accounts for the total
> execution time of 2PC. 2PC requires 2 network round trips for each
> participant. For example, if it took 500ms in total, we would not get
> benefits much from the point of view of 2PC performance even if we
> improved it from 14ms to 1ms.

I made the patch based on your advice and re-run the test on the new machine.
(The attached patch is just for test purpose.)


* foreign_twophase_commit = disabled
2686tps

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

* foreign_twophase_commit = required with attached patch (It is not necessary to set -R ${RATE})
2057tps


This indicate that if we can reduce the number of times to open() wal segment file during "COMMIT PREPARED", the
performancecan be improved. 

This patch can skip closing wal segment file, but I don't know when we should close.
One idea is to close when the wal segment file is recycled, but it seems difficult for backend process to do so.

BTW, in previous discussion, "Send COMMIT PREPARED remote servers in bulk" is proposed.
I imagined the new SQL interface like "COMMIT PREPARED 'prep_1', 'prep_2', ... 'prep_n'".
If we can open wal segment file during bulk COMMIT PREPARED, we can not only reduce the times of communication, but
alsoreduce the times of open() wal segment file. 


Regards,
Ryohei Takahashi

Attachment

pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: [HACKERS] WIP aPatch: Pgbench Serialization and deadlock errors
Next
From: Peter Eisentraut
Date:
Subject: Re: Bogus HAVE_DECL_FOO entries in msvc/Solution.pm