|
| 1 | +--- |
| 2 | +title: "Rule evaluations via query frontend" |
| 3 | +linkTitle: "Rule evaluations via query frontend" |
| 4 | +weight: 10 |
| 5 | +slug: rule-evalutions-via-query-frontend |
| 6 | +--- |
| 7 | + |
| 8 | +This guide explains how to configure the Ruler to evaluate rules via Query Frontends instead of the Ingester/Store Gateway and the pros and cons of rule evaluation via Query Frontend. |
| 9 | + |
| 10 | +## How to enable |
| 11 | + |
| 12 | +By default, the Ruler queries both Ingesters and Store Gateway depending on the Rule time range for evaluating rules (alerting rules or recording rules). If you have set `-ruler.frontend-address` then the Ruler queries the Query Frontend for evaluation rules. |
| 13 | +The address should be the gRPC listen address in host:port format. |
| 14 | + |
| 15 | +You can configure via args: |
| 16 | +``` |
| 17 | +-ruler.frontend-address=query-frontend.svc.cluster.local:9095 |
| 18 | +``` |
| 19 | +And via yaml: |
| 20 | +```yaml |
| 21 | +ruler: |
| 22 | + frontend_address: query-frontend.svc.cluster.local:9095 |
| 23 | +``` |
| 24 | +
|
| 25 | +In addition, you can configure gRPC client (Ruler -> Query Frontend) config, please refer to frontend_client section in [ruler config](../configuration/config-file-reference.md#ruler_config). |
| 26 | +
|
| 27 | +## Pros and Cons |
| 28 | +If this feature is enabled, the query execute path is as follows: |
| 29 | +
|
| 30 | +Ruler -> Query Frontend -> Query Scheduler -> Querier -> Ingester/Store Gateway |
| 31 | +
|
| 32 | +There are more hops than before (Ruler -> Ingester/Store Gateway). |
| 33 | +### Pros |
| 34 | +The rule evaluation performance is improved in such a situation where the number of Queriers pulling queries from the Query Scheduler is enough as we can use Query Frontend features like the vertical query sharding. |
| 35 | +Also, the Ruler can use fewer resources as it doesn't need to run query engine to evaluate rules. |
| 36 | +
|
| 37 | +### Cons |
| 38 | +If there are not enough Queriers, add rule queries to Query Scheduler could cause query starvation problem and rules cannot get evaluated. |
| 39 | +Another is, currently, the only support format of the query response of the Query Frontend is the JSON format. The JSON format only contains partial information of the native histogram. |
| 40 | +So, if your rules use the native histogram, it is not allowed yet. |
0 commit comments