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

Add query frontend to the quickstart script #3372

Closed
Closed
Changes from 1 commit
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
36 changes: 35 additions & 1 deletion scripts/quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ MC_EXECUTABLE=${MC_EXECUTABLE:-"mc"}
PROMETHEUS_EXECUTABLE=${PROMETHEUS_EXECUTABLE:-"prometheus"}
THANOS_EXECUTABLE=${THANOS_EXECUTABLE:-"thanos"}
S3_ENDPOINT=""
QUERY_FRONTEND_CACHE_MAX_SIZE=${QUERY_FRONTEND_CACHE_MAX_SIZE:-""}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set this to "0"

QUERY_FRONTEND_CACHE_MAX_SIZE_ITEMS=${QUERY_FRONTEND_CACHE_MAX_SIZE_ITEMS:-0}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set this to 2048

QUERY_FRONTEND_CACHE_VALIDITY=${QUERY_FRONTEND_CACHE_VALIDITY:-"0s"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use 6h here


if [ ! $(command -v "$PROMETHEUS_EXECUTABLE") ]; then
echo "Cannot find or execute Prometheus binary $PROMETHEUS_EXECUTABLE, you can override it by setting the PROMETHEUS_EXECUTABLE env variable"
Expand Down Expand Up @@ -249,7 +252,28 @@ QUERIER_JAEGER_CONFIG=$(
EOF
)

# Start two query nodes.
QUERY_FRONTEND_JAEGER_CONFIG=$(
cat <<-EOF
type: JAEGER
config:
service_name: thanos-query-frontend
sampler_type: ratelimiting
sampler_param: 2
EOF
)

QUERY_FRONTEND_CACHE_CONFIG=$(
cat <<-EOF
type: IN-MEMORY
config:
max_size: "${QUERY_FRONTEND_CACHE_MAX_SIZE}"
max_size_items: ${QUERY_FRONTEND_CACHE_MAX_SIZE_ITEMS}
validity: ${QUERY_FRONTEND_CACHE_VALIDITY}
EOF
)
echo ${QUERY_FRONTEND_CACHE_CONFIG}

# Start two query nodes with respective query-frontends.
for i in $(seq 0 1); do
${THANOS_EXECUTABLE} query \
--debug.name query-"${i}" \
Expand All @@ -262,6 +286,16 @@ for i in $(seq 0 1); do
--tracing.config="${QUERIER_JAEGER_CONFIG}" \
--query.replica-label receive_replica \
${STORES} &

sleep 0.5

${THANOS_EXECUTABLE} query-frontend \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not how it suppose to work, unfortunately. Those replicas have to be separate for better horizontal scalability. This means there should be a load balancing in between - ideally round robin load balancer for better distribution.

We can add some nginx for it, but ideally, we could work towards this: #3373

Let me know if this makes sense 🤗

--debug.name query-frontend-"${i}" \
--log.level debug \
--http-address 0.0.0.0:2000"${i}" \
--query-frontend.downstream-url http://127.0.0.1:109"${i}"4 \
--tracing.config="${QUERY_FRONTEND_JAEGER_CONFIG}" \
--query-range.response-cache-config="${QUERY_FRONTEND_CACHE_CONFIG}" &
done

sleep 0.5
Expand Down