Skip to content

Commit a7e8fe8

Browse files
committed
fix(influxdb3): address Reid's review feedback on query timeout best practices
Address reidkaufmann's review comments on query timeout documentation: Technical accuracy fixes: - Replace "node/nodes" terminology with "querier/queriers" throughout - Remove AI hallucination: "query result caching" (doesn't exist in IOx) - Replace with proper cache recommendations for Enterprise/Core users - Remove vague "background maintenance" references - Add specific compaction performance variation cause - Fix "round-robin or load-balanced" → "round-robin query routing" Content improvements: - Enhance checkout line analogy with explanation of noisy neighbors - Add experimental query guidance for reducing impact on other users - Replace unactionable solutions with customer-controllable actions - Restore missing flexibility recommendations and link to the code sample Technical updates: - Update code blocks to use new placeholder syntax - Add related links between cache documentation and timeout strategies - Fix numbering consistency in Solutions sections
1 parent af06fd8 commit a7e8fe8

File tree

4 files changed

+61
-24
lines changed

4 files changed

+61
-24
lines changed

content/influxdb3/cloud-dedicated/query-data/troubleshoot-and-optimize/query-timeout-best-practices.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,12 @@ menu:
66
name: Query timeout best practices
77
parent: Troubleshoot and optimize queries
88
weight: 205
9+
related:
10+
- /influxdb3/cloud-dedicated/reference/client-libraries/v3/
11+
- /influxdb3/cloud-dedicated/query-data/execute-queries/influxctl-cli/
912
source: shared/influxdb3-query-guides/query-timeout-best-practices.md
10-
---
13+
---
14+
15+
<!--
16+
//SOURCE - content/shared/influxdb3-query-guides/query-timeout-best-practices.md
17+
>

content/influxdb3/cloud-serverless/query-data/troubleshoot-and-optimize/query-timeout-best-practices.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,11 @@ menu:
77
parent: Troubleshoot and optimize queries
88
identifier: query-timeout-best-practices
99
weight: 201
10+
related:
11+
- /influxdb3/cloud-serverless/reference/client-libraries/v3/
1012
source: shared/influxdb3-query-guides/query-timeout-best-practices.md
11-
---
13+
---
14+
15+
<!--
16+
//SOURCE - content/shared/influxdb3-query-guides/query-timeout-best-practices.md
17+
>

content/influxdb3/clustered/query-data/troubleshoot-and-optimize/query-timeout-best-practices.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@ menu:
77
parent: Troubleshoot and optimize queries
88
identifier: query-timeout-best-practices
99
weight: 201
10+
related:
11+
- /influxdb3/clustered/reference/client-libraries/v3/
12+
- /influxdb3/clustered/query-data/execute-queries/influxctl-cli/
1013
source: shared/influxdb3-query-guides/query-timeout-best-practices.md
11-
---
14+
---
15+
16+
<!--
17+
//SOURCE - content/shared/influxdb3-query-guides/query-timeout-best-practices.md
18+
>

content/shared/influxdb3-query-guides/query-timeout-best-practices.md

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,45 @@ Optimal timeouts are:
3030

3131
## How query routing affects timeout strategy
3232

33-
InfluxDB 3 uses round-robin or load-balanced query routing across multiple replicas or nodes.
33+
InfluxDB 3 uses round-robin query routing to balance load across multiple queriers.
3434
This creates a "checkout line" effect that influences timeout strategy.
3535

3636
### The checkout line analogy
3737

3838
Consider a grocery store with multiple checkout lines:
39-
- Customers (queries) are distributed across lines (replicas/nodes)
39+
- Customers (queries) are distributed across lines (queriers)
4040
- A slow customer (long-running query) can block others in the same line
41-
- More checkout lines (replicas) provide more alternatives when retrying
41+
- More checkout lines (queriers) provide more alternatives when retrying
42+
43+
If one querier is unhealthy or has been hijacked by a "noisy neighbor" query (excessively resource hungry), giving up sooner may save time--it's like jumping to a cashier with no customers in line. However, if all queriers are overloaded, then short retries may exacerbate the problem--you wouldn't jump to the end of another line if the cashier is already starting to scan your items.
4244

4345
### Noisy neighbor effects
4446

4547
In distributed systems:
46-
- A single long-running query can impact other queries on the same node
47-
- Shorter timeouts with retries can help queries find less congested nodes
48-
- The effectiveness depends on the number of available replicas
48+
- A single long-running query can impact other queries on the same querier
49+
- Shorter timeouts with retries can help queries find less congested queriers
50+
- The effectiveness depends on the number of available queriers
4951

5052
### When shorter timeouts help
5153

52-
- **Multiple replicas available**: Retries can find less congested nodes
53-
- **Uneven load distribution**: Some nodes may be significantly less busy
54+
- **Multiple queriers available**: Retries can find less congested queriers
55+
- **Uneven load distribution**: Some queriers may be significantly less busy
5456
- **Temporary congestion**: Brief spikes in query load or resource usage
5557

5658
### When shorter timeouts hurt
5759

58-
- **Few replicas**: Limited alternatives for retries
59-
- **System-wide congestion**: All nodes are equally busy
60+
- **Few queriers**: Limited alternatives for retries
61+
- **System-wide congestion**: All queriers are equally busy
6062
- **Expensive query planning**: High overhead for query preparation
6163

6264
## Timeout configuration best practices
6365

6466
### Make timeouts adjustable
6567

66-
Configure timeouts that can be modified without service restarts using environment variables, configuration files, runtime APIs, or per-query overrides.
68+
Configure timeouts that can be modified without service restarts using environment variables, configuration files, runtime APIs, or per-query overrides. Design your client applications to easily adjust timeouts on the fly, allowing you to respond quickly to performance changes and test different timeout strategies without code changes.
69+
70+
See the [InfluxDB 3 client library examples](#influxdb-3-client-library-examples)
71+
for how to configure timeouts in Python.
6772

6873
### Use tiered timeout strategies
6974

@@ -89,6 +94,11 @@ Implement different timeout classes based on query characteristics.
8994
| Analytical and background | 2 minutes | Reports, batch processing | Complex queries within serverless limits |
9095
{{% /show-in %}}
9196

97+
{{% show-in "enterprise, core" %}}
98+
> [!Tip]
99+
> #### Use caching
100+
> Where immediate feedback is crucial, consider using [Last Value Cache](/influxdb3/version/admin/manage-last-value-caches/) to speed up queries for recent values and [Distinct Value Cache](/influxdb3/version/admin/manage-distinct-value-caches/) to speed up queries for distinct values.
101+
{{% /show-in %}}
92102

93103
### Implement progressive timeout and retry logic
94104

@@ -114,15 +124,18 @@ Consider these indicators that timeouts may need adjustment:
114124
- **Production**: Use shorter timeouts with monitoring
115125
- **Cost-sensitive**: Use aggressive timeouts and [query optimization](/influxdb3/version/query-data/troubleshoot-and-optimize/optimize-queries/)
116126

127+
### Experimental and ad-hoc queries
128+
129+
When introducing a new query to your application or when issuing ad-hoc queries to a database with many users, your query might be the "noisy neighbor" (the shopping cart overloaded with groceries). By setting a tighter timeout on experimental queries you can reduce the impact on other users.
130+
117131

118132
## InfluxDB 3 client library examples
119133

120134
### Python client with timeout configuration
121135

122136
Configure timeouts in the InfluxDB 3 Python client:
123137

124-
{{% code-placeholders "DATABASE_NAME|HOST_URL|AUTH_TOKEN" %}}
125-
```python
138+
```python { placeholders="DATABASE_NAME|HOST_URL|AUTH_TOKEN" }
126139
import influxdb_client_3 as InfluxDBClient3
127140

128141
# Configure different timeout classes (in seconds)
@@ -174,7 +187,6 @@ def query_daily_averages():
174187
print(f"Analytical query failed: {e}")
175188
return None
176189
```
177-
{{% /code-placeholders %}}
178190

179191
Replace the following:
180192

@@ -240,7 +252,7 @@ result = query_with_retry(
240252
Track these essential timeout-related metrics:
241253

242254
- **Query duration percentiles**: P50, P95, P99 execution times
243-
- **Timeout rate**: Percentage of queries that exceed timeout limits
255+
- **Timeout rate**: Percentage of queries that time out
244256
- **Error rates**: Timeout errors vs. other failure types
245257
- **Resource utilization**: CPU and memory usage during query execution
246258

@@ -258,21 +270,26 @@ Track these essential timeout-related metrics:
258270
**Solutions**:
259271
1. Analyze query performance patterns
260272
2. [Optimize slow queries](/influxdb3/version/query-data/troubleshoot-and-optimize/optimize-queries/) or increase timeouts appropriately
261-
3. Scale system resources or add query result caching
273+
3. Scale system resources
262274

263275
#### Inconsistent query performance
264276

265277
**Symptoms**: Same queries sometimes fast, sometimes timeout
266278

267279
**Common causes**:
268-
- Uneven load distribution across nodes
280+
269281
- Resource contention from concurrent queries
270-
- Background maintenance operations
282+
- Data compaction state (queries may be faster after compaction completes)
271283

272284
**Solutions**:
273-
1. Implement load balancing or query queuing
274-
2. Schedule maintenance during off-peak hours
275-
3. Add query result caching for frequently accessed data
285+
286+
1. Analyze query patterns to identify and optimize slow queries
287+
2. Implement retry logic with exponential backoff in your client applications
288+
3. Adjust timeout values based on observed query performance patterns
289+
{{% show-in "enterprise,core" %}}
290+
4. Implement [Last Value Cache](/influxdb3/version/admin/manage-last-value-caches/) to speed up queries for recent values
291+
5. Implement [Distinct Value Cache](/influxdb3/version/admin/manage-distinct-value-caches/) to speed up queries for distinct values
292+
{{% /show-in %}}
276293

277294
> [!Note]
278295
> Regular analysis of timeout patterns helps identify optimization opportunities and system scaling needs.

0 commit comments

Comments
 (0)