Re: Low performance between datacenters

From: Fernando Hevia <fhevia(at)gmail(dot)com>
To: Tamás PAPP <tomposmiko(at)gmail(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Low performance between datacenters
Date: 2024-07-07 20:23:41
Message-ID: CAGYT1XR+Lvxr4mZrCvmDVJZHzQ=0F_cUxuxxum7eWPJ__0jmvA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

El dom, 7 jul 2024 a la(s) 3:17 p.m., Tamás PAPP (tomposmiko(at)gmail(dot)com)
escribió:

> hi All,
>
> I am new on the list.
> I hope someone can give me an adequate answer or good advice about my
> problem.
>
> I have a client (normally a web service, for testing the psql client) in
> GCP. There is a PSQL server in another DC. The ping response time is 20ms.
> I measured the bandwidth via scp and it is more than 1Gb/s which is more
> than enough IMO.
>
>
Hi Tamás,

Bandwidth and Latency are two different concepts. Latency is the
round-trip-time of a data-packet travelling over the network while
bandwidth is the amount of data you can move concurrently. Latency will add
up time over each conversation between the client and the server. For
example, establishing a connection has a bit of back and forth dialogue
going on. Each of these communications bits will be affected by latency as
either client or server needs to wait for the other party to receive the
message and then respond to it.
Latency will have an impact even when transmitting data like in a plain
SELECT * FROM table. Bear in mind that psql uses TCP which sends an ACK
packet at regular intervals to assert the integrity of the transmitted data.

> The psql connection between the DCs for me was unexpectedly slow.
> I would expect a bit slower query without data ('select now()') due to the
> increased latency and somewhat similar speed of data transfer.
> What I see is that
>
> select now() increased from 0.7ms to 20ms which is OK.
> And 'select *' on a table with 3082 rows (so it's a small table) increased
> from 10ms to 800ms.
>

Since you aren't providing much evidence, I can speculate a lot might be
going on to explain this kind of increase in the query delay: busy
database, busy network, locks, latency, network unreliability, etc.

> Is this normal? Can I improve it somehow?
>

Move your web service physically as close as possible to the database
server.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Vitalii Tymchyshyn 2024-07-08 00:42:27 Re: Low performance between datacenters
Previous Message Tamás PAPP 2024-07-07 18:17:28 Low performance between datacenters