On Mon, 2 Nov 2020 at 15:03, Konstantin Knizhnik
<k.knizhnik@postgrespro.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