Auto kill long running queries from user (not application)

Some users are running heavy query in production and it is impacting application. How can we auto kill long running queries from users (not from application user)?

Set a request timeout to have requests automatically terminated after some time. Be aware though that this is asynchronous so requests may run on for a bit after the timeout has expired. (i.e. It depends on the operation underway when a routine working on behalf of a request actually terminates).

See “queryTimeout” here: https://docs.couchbase.com/server/current/rest-api/rest-cluster-query-settings.html

You can set it at a node-level but this would impact all requests, including those from the application.

There isn’t a “per user” setting (there are no “per user” settings; only cluster, node or request levels).

This of course doesn’t limit the resources used whilst running within the permitted time limit. You can constrain document memory with a memory_quota setting. (See “queryMemoryQuota” here https://docs.couchbase.com/server/current/rest-api/rest-cluster-query-settings.html#_settings)

You can manually cancel individual queries via the UI (https://docs.couchbase.com/server/current/tools/query-monitoring.html#active-queries) or by deleting the appropriate entry from system:active_requests or the admin REST endpoint (https://docs.couchbase.com/server/current/n1ql/n1ql-rest-api/admin.html#_delete_active_request).

HTH.