Re: libpq compression

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: Daniil Zakhlystov <usernamedt(at)yandex-team(dot)ru>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, "o(dot)bartunov(at)postgrespro(dot)ru" <o(dot)bartunov(at)postgrespro(dot)ru>
Subject: Re: libpq compression
Date: 2020-11-02 16:53:12
Message-ID: CAEze2WiavC64KuNGKrW-M1DPb=7GiF9XshbF5CDS2ADrMJQvSQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2 Nov 2020 at 15:03, Konstantin Knizhnik
<k(dot)knizhnik(at)postgrespro(dot)ru> wrote:
>
> It seems to be very important to be able to measure network traffic
> between client and server, especially in case of using compression.
> Althought there are a lot of toll for monitoring network traffix for
> Linux and other OSes, I didn't find one which can easily calculate
> traffix for particular backends.
> This is why I have added pg_stat_network_traffic view which can be used
> to measure efficiency of protocol message compression for different
> algorithms and workloads.

I agree that seems like a useful feature to have, even without of the
rest of the patch.

> This is the result of network traffic of two backends one with enabled
> compression and another with disable compression
> after execution of "select * from pg_class" command:
>
> select * from pg_stat_network_traffic;
> pid | rx_raw_bytes | tx_raw_bytes | rx_compressed_bytes |
> tx_compressed_bytes
> -------+--------------+--------------+---------------------+---------------------
> 22276 | 29 | 86327 | 38
> | 10656
> 22282 | 73 | 86327 | 0
> | 0

The current names and values of these columns are confusing me:
What column contains the amount of bytes sent to/received from the
client? Is the compression method of pid 22282 extremely efficient at
compressing, or does it void the data (compresses down to 0 bytes)?

I suggest having columns that contain the bytes sent to/received
from the client before and after compression. If no compression was
used, those numbers are expected to be equal. Example names are
`rx_raw_bytes` and `rx_data_bytes`, `rx_received_bytes` and
`rx_bytes_uncompressed`. Another option would be initializing /
setting rx_compressed_bytes and tx_compressed_bytes to -1 or NULL for
connections that do not utilize compression, to flag that
compression is not used.

-Matthias

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2020-11-02 17:09:22 Re: public schema default ACL
Previous Message Konstantin Knizhnik 2020-11-02 16:36:16 Re: libpq compression