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

[doc] Added sticky connections section to Connection Manager docs #26114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rahulb-yb
Copy link
Contributor

No description provided.

@rahulb-yb rahulb-yb requested a review from ddhodge February 19, 2025 16:42
@rahulb-yb rahulb-yb self-assigned this Feb 19, 2025
Copy link

netlify bot commented Feb 19, 2025

Deploy Preview for infallible-bardeen-164bc9 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit aff6230
🔍 Latest deploy log https://app.netlify.com/sites/infallible-bardeen-164bc9/deploys/67b60a13b3fa2d00089fa5e5
😎 Deploy Preview https://deploy-preview-26114--infallible-bardeen-164bc9.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ddhodge ddhodge added the area/documentation Documentation needed label Feb 19, 2025
YSQL Connection Manager enables a larger number of client connections to efficiently share a smaller pool of backend processes using a many-to-one multiplexing model. However, in certain cases, a backend process may enter a state that prevents connection multiplexing between transactions. When this occurs, the backend process remains dedicated to a single logical connection (hence the term “sticky connection”) for the entire session rather than just a single transaction. This behavior deviates from the typical use case, where backend processes are reassigned after each transaction.

Some other characteristics of sticky connections:
- Backend processes corresponding to sticky connections are destroyed at the end of the session, and so, sticky connections do not return to the pool once used.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how the one relates to the other, or what you are saying here. Why don't sticky connections return to pool? Even after related backend process is destroyed at end of session?


Some other characteristics of sticky connections:
- Backend processes corresponding to sticky connections are destroyed at the end of the session, and so, sticky connections do not return to the pool once used.
- As of now, sticky connections cannot be reverted back to an "un"-sticky connection; once a sticky connection is formed, it will remain sticky until the end of the session.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implies the opposite - it will return to pool at end of session

@@ -105,6 +105,30 @@ The following table describes YB-TServer flags related to YSQL Connection Manage
| ysql_conn_mgr_sequence_support_mode | Sequence support mode when YSQL connection manager is enabled. When set to 'pooled_without_curval_lastval', the currval() and lastval() functions are not supported. When set to 'pooled_with_curval_lastval', the currval() and lastval() functions are supported. For both settings, monotonic sequence order is not guaranteed if `ysql_sequence_cache_method` is set to `connection`. To also support monotonic order, set this flag to `session`. | pooled_without_curval_lastval |
| ysql_conn_mgr_optimized_extended_query_protocol | Enables optimization of [extended-query protocol](https://www.postgresql.org/docs/current/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS) to provide better performance; note that while optimization is enabled, you may have correctness issues if you alter the schema of objects used in prepared statements. If set to false, extended-query protocol handling is always fully correct but unoptimized. | true |

## Sticky Connections
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Sticky Connections
## Sticky connections

- Backend processes corresponding to sticky connections are destroyed at the end of the session, and so, sticky connections do not return to the pool once used.
- As of now, sticky connections cannot be reverted back to an "un"-sticky connection; once a sticky connection is formed, it will remain sticky until the end of the session.

This section outlines the various scenarios where the user can expect a logical connection to be converted into a sticky connection while using YSQL Connection Manager.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This section outlines the various scenarios where the user can expect a logical connection to be converted into a sticky connection while using YSQL Connection Manager.
When using YSQL Connection Manager, sticky connections can form in the following circumstances:

- Creation of `TEMP` tables
- Declaration of a `CURSOR` using the `WITH HOLD` attribute
- Using a `PREPARE` query (Not to be confused with protocol-level preparation of statements)
- Superuser connections (This can be disabled using the `ysql_conn_mgr_superuser_sticky` flag)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'This' - what is disabled? superuser connections?

- Using a `PREPARE` query (Not to be confused with protocol-level preparation of statements)
- Superuser connections (This can be disabled using the `ysql_conn_mgr_superuser_sticky` flag)
- Using a `SEQUENCE` can make the connection sticky (Refer to `ysql_conn_mgr_sequence_support_mode` for support without stickiness)
- Replication connections
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CDC? xCluster? Any replication?

- Superuser connections (This can be disabled using the `ysql_conn_mgr_superuser_sticky` flag)
- Using a `SEQUENCE` can make the connection sticky (Refer to `ysql_conn_mgr_sequence_support_mode` for support without stickiness)
- Replication connections
- Usage of specific session parameters (GUC variables) during the session:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Usage of specific session parameters (GUC variables) during the session:
- Setting the following configuration parameters during the session:


This section outlines the various scenarios where the user can expect a logical connection to be converted into a sticky connection while using YSQL Connection Manager.

- Creation of `TEMP` tables
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Creation of `TEMP` tables
- Creating TEMP tables

This section outlines the various scenarios where the user can expect a logical connection to be converted into a sticky connection while using YSQL Connection Manager.

- Creation of `TEMP` tables
- Declaration of a `CURSOR` using the `WITH HOLD` attribute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Declaration of a `CURSOR` using the `WITH HOLD` attribute
- Declaring a CURSOR using the WITH HOLD attribute


- Creation of `TEMP` tables
- Declaration of a `CURSOR` using the `WITH HOLD` attribute
- Using a `PREPARE` query (Not to be confused with protocol-level preparation of statements)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Using a `PREPARE` query (Not to be confused with protocol-level preparation of statements)
- Using a PREPARE query (not to be confused with protocol-level preparation of statements)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Documentation needed
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

2 participants