Re: libpq compression

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Daniil Zakhlystov <usernamedt(at)yandex-team(dot)ru>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Konstantin Knizhnik <knizhnik(at)garret(dot)ru>, Andres Freund <andres(at)anarazel(dot)de>, Craig Ringer <craig(dot)ringer(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: libpq compression
Date: 2021-03-02 05:50:39
Message-ID: 48947353-4754-42FA-AA90-EE7D64F677BF@yandex-team.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> 26 февр. 2021 г., в 02:18, Daniil Zakhlystov <usernamedt(at)yandex-team(dot)ru> написал(а):
>
> Yes, there is still no possibility for compressed traffic pass-through for poolers,
> but do we actually need it?
> I don’t see any solution except starting a new compression context for
> each message in order to make it work.
> Do we actually need to hurt the compression ratio for this specific use case?
>
> Actually, there is an ugly hack - we may force-reset the compression context by sending the
> SetCompressionMethod (which will reset the compression algorithm & context) after each CompressedData message.
>
> This should allow interpreting of each CompressedData message on its own but will add overhead and hurt the compression ratio.

As a maintainer of a connection pooler, I don't think compressing individual messages on their own compression context adds any value for that particular pooler.
Network has two different costs:
1. Cross-datacenter traffic is costly and needs to be compressed. Better compression ratios are preferable to CPU savings.
2. Intra-datacenter traffic is cheap and compression is not that crucial. In my opinion on most loaded installations, the pooler must be on the same host as DB. Compression can be just off.

I don't think we should craft one more CPU\Network tradeoff point by our own hands. Enough tradeoff points are implemented by lz4\zstd\whatever.

CPU usage to compress data is neglectable small compared to CPU overhead to produce data traffic.

The only real feature of compressing individual messages is better CRIME mitigation. E.i. not compressing Auth packets and some parameters of the query. This feature does not depend on resetting compression context. And resetting compression context often does not help to mitigate CRIME.

Thanks!

Best regards, Andrey Borodin.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2021-03-02 05:52:07 Re: [PATCH] regexp_positions ( string text, pattern text, flags text ) → setof int4range[]
Previous Message Peter Geoghegan 2021-03-02 05:34:40 Re: New IndexAM API controlling index vacuum strategies