Home / Companies / Couchbase / Blog / Post Details
Content Deep Dive

The N1QL Query Language Now Has a Per-Request Memory Quota

Blog post from Couchbase

Post Details
Company
Date Published
Author
Marco Greco, Software Architect, Couchbase
Word Count
2,239
Language
English
Hacker News Points
-
Summary

The SQL++ query language in Couchbase Server 7.0 now includes a per-request memory quota, allowing users to limit the amount of memory used by individual requests. This feature is designed to prevent "greedy" requests from consuming excessive memory and causing other requests to fail due to lack of resources. The quota can be set on a node-wide basis or for individual requests, with options to override each other if necessary. When the quota is exceeded, the request fails, but the server continues to operate without crashing. To mitigate memory usage issues, the query service employs techniques such as pipeline optimization, operator inlining, and cooperative yielding between producers and consumers. Additionally, the server uses garbage collection and ad hoc pools to manage memory allocation and reuse, providing a more controlled memory environment for users.