Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates scheduler libsonnet #4154

Merged
merged 2 commits into from
Aug 12, 2021
Merged
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
6 changes: 2 additions & 4 deletions production/ksonnet/loki/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,9 @@
frontend: {
compress_responses: true,
log_queries_longer_than: '5s',
max_outstanding_per_tenant: if $._config.queryFrontend.sharded_queries_enabled then 1024 else 256,
},
frontend_worker: {
frontend_address: 'query-frontend.%s.svc.cluster.local:9095' % $._config.namespace,
// Limit to N/2 worker threads per frontend, as we have two frontends.
parallelism: std.floor($._config.querier.concurrency / $._config.queryFrontend.replicas),
match_max_concurrent: true,
grpc_client_config: {
max_send_msg_size: $._config.grpc_server_max_msg_size,
},
Expand All @@ -178,6 +175,7 @@
parallelise_shardable_queries: true,
} else {},
querier: {
max_concurrent: $._config.querier.concurrency,
query_ingesters_within: '2h', // twice the max-chunk age (1h default) for safety buffer
},
limits_config: {
Expand Down
2 changes: 1 addition & 1 deletion production/ksonnet/loki/loki.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

// Query scheduler support
// must be mixed in after frontend and querier so it can override their configuration.
(import 'query-scheduler.libsonnet') +
(import 'query-scheduler.libsonnet') +

// Supporting services
(import 'memcached.libsonnet') +
Expand Down
32 changes: 23 additions & 9 deletions production/ksonnet/loki/query-scheduler.libsonnet
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@

local k = import 'ksonnet-util/kausal.libsonnet';

{
local max_outstanding = if $._config.queryFrontend.sharded_queries_enabled then 1024 else 256,

// Override frontend and querier configuration
_config +:: {
_config+:: {
loki+: if $._config.query_scheduler_enabled then {
frontend+: {
scheduler_address: 'query-scheduler.%s.svc.cluster.local:9095' % $._config.namespace,
scheduler_address: 'query-scheduler-discovery.%s.svc.cluster.local:9095' % $._config.namespace,
},
frontend_worker+: {
frontend_address: '',
scheduler_address: 'query-scheduler.%s.svc.cluster.local:9095' % $._config.namespace,
scheduler_address: 'query-scheduler-discovery.%s.svc.cluster.local:9095' % $._config.namespace,
},
query_scheduler+: {
max_outstanding_requests_per_tenant: max_outstanding,
},
} else {
frontend+: {
max_outstanding_per_tenant: max_outstanding,
},
} else {},
frontend_worker+: {
frontend_address: 'query-frontend.%s.svc.cluster.local:9095' % $._config.namespace,
},
},
},

query_scheduler_args:: if $._config.query_scheduler_enabled then
Expand Down Expand Up @@ -45,7 +55,11 @@ local k = import 'ksonnet-util/kausal.libsonnet';
else {},

local service = k.core.v1.service,
query_scheduler_service: if $._config.query_scheduler_enabled then
k.util.serviceFor($.query_scheduler_deployment)
else {},

// Headless to make sure resolution gets IP address of target pods, and not service IP.
query_scheduler_discovery_service: if !$._config.query_scheduler_enabled then {} else
k.util.serviceFor($.query_scheduler_deployment) +
service.mixin.spec.withPublishNotReadyAddresses(true) +
service.mixin.spec.withClusterIp('None') +
service.mixin.metadata.withName('query-scheduler-discovery'),
}