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

Question on how CLIENT_SESSION_KEEP_ALIVE works #590

Closed
davidhcar opened this issue Jan 31, 2023 · 5 comments
Closed

Question on how CLIENT_SESSION_KEEP_ALIVE works #590

davidhcar opened this issue Jan 31, 2023 · 5 comments
Assignees
Labels
question Issue is a usage/other question rather than a bug

Comments

@davidhcar
Copy link

Issue description

When CLIENT_SESSION_KEEP_ALIVE = true, the connection session kept open until the execution of the query for long running queries, that will run more than 4 hours. Once the query executed and returns result back to .Net process, we close the connection, and that session gets terminated, Is that correct understanding about this flag CLIENT_SESSION_KEEP_ALIVE ?

@colingreen-payroc
Copy link
Contributor

colingreen-payroc commented Feb 19, 2023

@davidhcar CLIENT_SESSION_KEEP_ALIVE causes a background thread to call a /heartbeat endpoint to keep the session alive on the server. Without that call the sessions can timeout, as by default they have a 4 hour inactivity timeout on the server.

This is not about HTTP connections, but the session state maintained on the Snowflake server side.

The .NET connector nuget has a connection pool that expires the connections after 1 hour of not being used, therefore the four hour session timeout on the server should not be reached in normal circumstances (however, also see #606 which can increase the connection pool timeout to two hours when the clocks go back).

A pooled connection is either used, and the session expiry timer at the server is reset; or it is not used and is removed from the pool after 1 hour.

@sfc-gh-igarish sfc-gh-igarish added the question Issue is a usage/other question rather than a bug label Mar 30, 2023
@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Jun 8, 2023
@sfc-gh-dszmolka
Copy link
Contributor

hi and thank you for raising this question! also apologies for the long period without answer from Snowflake. i see now that colgreen-payroc already kindly answered it, so marking this one as closed. if there's any further concerns, please don't hesitate to comment.

@lnashier
Copy link

lnashier commented Mar 4, 2024

CLIENT_SESSION_KEEP_ALIVE causes a background thread to call a /heartbeat endpoint to keep the session alive on the server. Without that call the sessions can timeout, as by default they have a 4 hour inactivity timeout on the server.

Does setting CLIENT_SESSION_KEEP_ALIVE to true keep compute resources active and cost money?

@sfc-gh-dszmolka
Copy link
Contributor

sfc-gh-dszmolka commented Mar 5, 2024

as this question seems to be posted randomly in multiple Snowflake driver repositories, and i happened to bump into it on snowflakedb/gosnowflake#1065 first, it was answered first.

It is highly encouraged to use the community forum instead for such discussion, instead of driver repositories.

@lnashier
Copy link

lnashier commented Mar 5, 2024

Thank you for the response.

Also, my apologies for posting the question here and in other repos instead of community forums as I was not quite sure where to ask. Thanks for sharing the links for future reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issue is a usage/other question rather than a bug
Projects
None yet
Development

No branches or pull requests

5 participants