Skip to content

Commit

Permalink
Merge pull request grafana/cortex-jsonnet#341 from grafana/add-playbo…
Browse files Browse the repository at this point in the history
…ok-for-stuck-queries-alerts

Added playbook for CortexFrontendQueriesStuck and CortexSchedulerQueriesStuck
  • Loading branch information
pracucci authored Jul 2, 2021
2 parents 7eb687e + 1ba6047 commit 7377e55
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions jsonnet/mimir-mixin/docs/playbooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,34 @@ _TODO: this playbook has not been written yet._

### CortexFrontendQueriesStuck

_TODO: this playbook has not been written yet._
This alert fires if Cortex is running without query-scheduler and queries are piling up in the query-frontend queue.

The procedure to investigate it is the same as the one for [`CortexSchedulerQueriesStuck`](#CortexSchedulerQueriesStuck): please see the other playbook for more details.

### CortexSchedulerQueriesStuck

_TODO: this playbook has not been written yet._
This alert fires if queries are piling up in the query-scheduler.

How it **works**:
- A query-frontend API endpoint is called to execute a query
- The query-frontend enqueues the request to the query-scheduler
- The query-scheduler is responsible for dispatching enqueued queries to idle querier workers
- The querier runs the query, sends the response back directly to the query-frontend and notifies the query-scheduler that it can process another query

How to **investigate**:
- Are queriers in a crash loop (eg. OOMKilled)?
- `OOMKilled`: temporarily increase queriers memory request/limit
- `panic`: look for the stack trace in the logs and investigate from there
- Is QPS increased?
- Scale up queriers to satisfy the increased workload
- Is query latency increased?
- An increased latency reduces the number of queries we can run / sec: once all workers are busy, new queries will pile up in the queue
- Temporarily scale up queriers to try to stop the bleed
- Check if a specific tenant is running heavy queries
- Run `sum by (user) (cortex_query_scheduler_queue_length{namespace="<namespace>"}) > 0` to find tenants with enqueued queries
- Check the `Cortex / Slow Queries` dashboard to find slow queries
- On multi-tenant Cortex cluster with **shuffle-sharing for queriers disabled**, you may consider to enable it for that specific tenant to reduce its blast radius. To enable queriers shuffle-sharding for a single tenant you need to set the `max_queriers_per_tenant` limit override for the specific tenant (the value should be set to the number of queriers assigned to the tenant).
- On multi-tenant Cortex cluster with **shuffle-sharding for queriers enabled**, you may consider to temporarily increase the shard size for affected tenants: be aware that this could affect other tenants too, reducing resources available to run other tenant queries. Alternatively, you may choose to do nothing and let Cortex return errors for that given user once the per-tenant queue is full.

### CortexCacheRequestErrors

Expand Down

0 comments on commit 7377e55

Please sign in to comment.