From 7ac7a5b0cb0bfe4d5f659c90f6476e4613ddd75c Mon Sep 17 00:00:00 2001 From: Igor Lukanin Date: Fri, 4 Oct 2024 16:37:43 +0200 Subject: [PATCH] docs: Describe `CUBEJS_MAX_SESSIONS` environment variable (#8782) --- docs/pages/product/apis-integrations/sql-api.mdx | 10 +++++++++- .../configuration/environment-variables.mdx | 12 +++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/pages/product/apis-integrations/sql-api.mdx b/docs/pages/product/apis-integrations/sql-api.mdx index a6fc75c13e1cf..0695bd29fcd07 100644 --- a/docs/pages/product/apis-integrations/sql-api.mdx +++ b/docs/pages/product/apis-integrations/sql-api.mdx @@ -211,7 +211,7 @@ error: `Error during rewrite: Can't find rewrite due to 10002 AST node limit rea Use the following environment variables to allocate more resources for query planning: `CUBESQL_REWRITE_MAX_NODES`, `CUBESQL_REWRITE_MAX_ITERATIONS`, `CUBESQL_REWRITE_TIMEOUT`. -## Streaming +### Streaming By default, query results are loaded in a single batch. However, a more effective *streaming mode* can be used for large result sets. To enable it, set the @@ -224,6 +224,14 @@ does not apply to SQL API queries. They can return an unlimited number of rows. +### Session limit + +Each concurrent connection to the SQL API consumes some resources and attempting +to establish too many connections at once can lead to an out-of-memory crash. +You can use the `CUBEJS_MAX_SESSIONS` environment variable to adjust the session +limit. + + [ref-sql-api-auth]: /product/apis-integrations/sql-api/security [ref-config-checksqlauth]: /reference/configuration/config#checksqlauth [ref-config-canswitchsqluser]: /reference/configuration/config#canswitchsqluser diff --git a/docs/pages/reference/configuration/environment-variables.mdx b/docs/pages/reference/configuration/environment-variables.mdx index 37825da4449e5..12149a792519e 100644 --- a/docs/pages/reference/configuration/environment-variables.mdx +++ b/docs/pages/reference/configuration/environment-variables.mdx @@ -993,7 +993,17 @@ clause](/product/apis-integrations/queries#order) for [SQL API][ref-sql-api] que | Possible Values | Default in Development | Default in Production | | --------------- | ---------------------- | --------------------- | -| `true`, `false` | `true` | `true` | +| `true`, `false` | `true` | `true` | + +## `CUBEJS_MAX_SESSIONS` + +Specifies the maximum number of concurrent sessions (connections) to the +[SQL API][ref-sql-api] and safeguards your Cube deployment from out-of-memory +crashes when too many connections are attempted to be established. + +| Possible Values | Default in Development | Default in Production | +| --------------- | ---------------------- | --------------------- | +| A valid number | 1024 | 1024 | ## `CUBESQL_REWRITE_MAX_NODES`