Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,5 @@ modules/ducktests/tests/certs/*
modules/ducktests/tests/ignitetest.egg-info/**
modules/ducktests/tests/build/**
modules/ducktests/tests/dist/**
/.gigaide/gigaide.properties
*.bkp
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
exclude: [guidelines.md, "Gemfile", "Gemfile.lock", README.adoc, "_docs/code-snippets", "_docs/includes", '*.sh']
exclude: [guidelines.md, "Gemfile", "Gemfile.lock", README.adoc, "_docs/code-snippets", "_docs/includes", "elements", '*.sh']
attrs: &asciidoc_attributes
version: 2.19.0-SNAPSHOT
base_url: /docs
Expand Down
4 changes: 4 additions & 0 deletions docs/_data/toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@
items:
- title: Memory Architecture
url: memory-architecture
- title: Memory Budget for an Ignite Node
url: memory-configuration/memory-budget
- title: Configuring Data Regions
url: memory-configuration/data-regions
- title: Eviction Policies
Expand All @@ -137,6 +139,8 @@
items:
- title: Ignite Persistence
url: persistence/native-persistence
- title: Persistence Storage Budget
url: persistence/storage-budget
- title: External Storage
url: persistence/external-storage
- title: Swapping
Expand Down
53 changes: 53 additions & 0 deletions docs/_docs/SQL/sql-calcite.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,59 @@ QUERY_ENGINE=CALCITE
----
--

== Memory Quotas [[memory-quotas]]

The Calcite-based SQL engine can track and limit heap memory used by query execution.
This is useful for protecting a server node from a single large query or from many concurrent memory-heavy queries.

Two quotas can be configured in `CalciteQueryEngineConfiguration`:

* `globalMemoryQuota` - a per-node heap memory quota for all Calcite SQL queries running on the node.
* `queryMemoryQuota` - a per-node heap memory quota for each Calcite SQL query running on the node.

Both quotas are disabled by default (`0`).
If a quota is exceeded, the query fails with an `IgniteSQLException`.
The global quota error message contains `Global memory quota for SQL queries exceeded`, and the per-query quota error message contains `Query quota exceeded`.

The quota is applied to query execution structures that keep rows in heap memory, for example sorting, hash joins, hash aggregates, set operations, collection operations, spools, and result materialization.
It is not a process memory limit and it does not account for Ignite data regions, direct memory, JVM native memory, or the operating system page cache.
Size these quotas together with `-Xmx` and the expected SQL concurrency.

[tabs]
--
tab:XML[]
[source,xml]
----
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="sqlConfiguration">
<bean class="org.apache.ignite.configuration.SqlConfiguration">
<property name="queryEnginesConfiguration">
<list>
<bean class="org.apache.ignite.calcite.CalciteQueryEngineConfiguration">
<property name="default" value="true"/>
<property name="globalMemoryQuota" value="#{4L * 1024 * 1024 * 1024}"/>
<property name="queryMemoryQuota" value="#{512L * 1024 * 1024}"/>
</bean>
</list>
</property>
</bean>
</property>
</bean>
----
tab:Java[]
[source,java]
----
IgniteConfiguration cfg = new IgniteConfiguration().setSqlConfiguration(
new SqlConfiguration().setQueryEnginesConfiguration(
new CalciteQueryEngineConfiguration()
.setDefault(true)
.setGlobalMemoryQuota(4L * 1024 * 1024 * 1024)
.setQueryMemoryQuota(512L * 1024 * 1024)
)
);
----
--

== SQL Reference

=== DDL
Expand Down
42 changes: 42 additions & 0 deletions docs/_docs/images/memory-budget-capacity-oome.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions docs/_docs/images/memory-budget-capacity-process.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions docs/_docs/images/memory-budget-data-region.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions docs/_docs/images/persistence-budget-data-path.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading