Skip to content
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

Add query_wait_timeout to user settings #481

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

levkk
Copy link

@levkk levkk commented Apr 23, 2020

Change

Add query_wait_timeout to user settings.

Why

Given two (2) or more read replicas, we want to force the client to failover to a different replica if the replica it's currently trying to use is unresponsive.

This is added because PostgreSQL protocol does not support read timeouts: the client will wait forever until the server answers or TCP keep-alive will break the connection.

Why not use the global query_wait_timeout setting? We have two different kind of users, foreground traffic user and background traffic user. The foreground traffic user needs to failover as quickly as is reasonable/possible. The background user can and should wait until replica recovers. The background user tends to run heavier queries as well, so we don't want to move all that expensive traffic to a different read replica: we are prioritizing the foreground traffic.

Why not implement query_timeout as well/instead? The assumption is if we can assign a query to a server, the server is healthy and will eventually return a result.

Tests

Will write tests if proposed change is acceptable.

@levkk levkk marked this pull request as ready for review May 16, 2020 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant