New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update client varcache with canonical values from server #879
Update client varcache with canonical values from server #879
Conversation
This makes caching variable caching with PgBouncer more efficient, because now the client is setting the same values that the server reports. See these PgBouncer issues/PRs for details: pgbouncer/pgbouncer#776 pgbouncer/pgbouncer#879
2b6d125
to
418f48e
Compare
This makes caching variable caching with PgBouncer more efficient, because now the client is setting the same values that the server reports. See these PgBouncer issues/PRs for details: pgbouncer/pgbouncer#776 pgbouncer/pgbouncer#879
418f48e
to
c069e6e
Compare
c069e6e
to
889fb5e
Compare
0ffae79
to
b8aa11b
Compare
I did some basic benchmarks against PG15 using:
And the TPS is as follows on my machine:
If I introduce 10ms of artificial latency between PgBouncer and Postgres then it goes from:
|
Since PG14, Postgres doesn't send ParameterStatus packets anymore when a setting has not actually changed. This could cause the client varcache and server varcache to become out of sync. Which then in turn resulted in unnecessary `SET` commands to be sent to the server. Fixes pgbouncer#776
b8aa11b
to
2c032fa
Compare
I tested this fix with PG 16.0. It looks good from functional perspective. The downside is the overhead of checking the startup parameters against the canonical ones for every new client connection even if such clients might be in minority. But I am not sure if this feature should be made opt-in. Since the size of varcache we need to iterate for every new connection is so small, the perf hit should be negligible. So, IMO, it does not worth it to introduce a yet another config param. |
Since PG14, Postgres doesn't send ParameterStatus packets anymore when a
setting has not actually changed. This could cause the client varcache
and server varcache to become out of sync. Which then in turn resulted
in unnecessary
SET
commands to be sent to the server.Fixes #776