Skip to content

Commit faf0893

Browse files
new doc: download manager
1 parent 1cc6e5b commit faf0893

File tree

4 files changed

+167
-1
lines changed

4 files changed

+167
-1
lines changed

docs/user-guide/.pages

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ nav:
1616
- Identity and Access Management (IAM): identity-and-access-management
1717
- Management: management
1818
- Profile: profile
19+
- Performance: performance
1920
- Best Practices: best-practices
2021

docs/user-guide/performance/.pages

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
nav:
2+
- Download Manager: download-manager.md
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
This guide explains how OpenObserve ensures fast and reliable query performance. It introduces the Download Manager, a built-in component that manages how files are downloaded during ingestion and search.
2+
3+
## How the Download Manager Works
4+
5+
OpenObserve stores the ingested data in Parquet files, a column-based file format optimized for efficient querying and compression. These files are saved in object storage, such as Amazon S3 or MinIO, and are not stored locally on the machines that execute queries.
6+
7+
To run a query, the required Parquet files must be available on the querier node’s local disk. Querier nodes are the components in OpenObserve that process and execute search queries.
8+
9+
The Download Manager is a background service that runs on each querier node. Its role is to download Parquet files from object storage to the local disk whenever they are needed. These downloads are triggered in two situations:
10+
11+
- When new data is ingested
12+
- When a user initiates a search query
13+
14+
15+
16+
## When the Download Manager Is Triggered
17+
18+
=== "Ingestion"
19+
20+
During ingestion, OpenObserve continuously collects and stores incoming data. This data is stored in the form of small Parquet files. Smaller files are periodically merged into larger ones by either the ingester or the compactor. When a larger Parquet file is created, the system uses a [hashing mechanism](../../performance.md/#pre-cache-files-for-faster-query-execution) to select one of the querier nodes to receive and cache the file.
21+
22+
The selected querier receives a broadcast event notifying it about the new file. It then uses the Download Manager to:
23+
24+
1. Download the file from the object storage (e.g., S3)
25+
2. Store it in its local disk cache
26+
27+
!!! Note
28+
This process is a form of proactive caching. The file is downloaded and cached before any user queries it, ensuring faster response times when recent data is searched.
29+
30+
=== "Search"
31+
32+
When a user runs a search query, the querier must access all Parquet files that fall within the query’s time range.
33+
34+
If some files are not cached locally, the querier:
35+
36+
1. Queries metadata to identify required files
37+
2. Uses the Download Manager to fetch missing files
38+
39+
!!! Note
40+
This is a reactive caching mechanism. The querier downloads only the files needed to fulfill the user’s search.
41+
42+
## Queue-Based Downloading
43+
44+
Prior to version `v0.14.7`, the Download Manager used a single queue to manage all file download requests. This queue operated in a first-in, first-out (FIFO) manner. All downloads, regardless of whether they were triggered by ingestion or search, were processed in the order in which they arrived.
45+
46+
This model had limitations. For example, a large historical search could generate many download requests for older files, delaying the download of more recent files created by ongoing ingestion. As a result, recent data could become temporarily unavailable for querying, even though it had already been ingested.
47+
48+
To address this issue, OpenObserve introduced a dual-queue system in version `v0.14.7`.
49+
50+
## Dual Queue System
51+
The dual-queue system separates file download requests into two categories:
52+
53+
- **Priority Queue**: Handles downloads for files with recent data.
54+
- **Normal Queue**: Handles downloads for older files.
55+
56+
The classification is based on the file’s **latest timestamp**, which represents the most recent log entry in the file. If this timestamp falls within the configured time window (known as the priority window), the file is routed to the priority queue. Otherwise, it is routed to the normal queue.
57+
58+
> Both ingestion and search workflows use the same Download Manager and follow this queueing logic.
59+
60+
## Dual Queue System Configuration
61+
!!! info "The following environment variables are used to control the dual-queue system:"
62+
63+
- `ZO_FILE_DOWNLOAD_ENABLE_PRIORITY_QUEUE`
64+
**Type:** Boolean
65+
**Default:** `true`
66+
**Description:** Enables or disables the dual-queue system (priority and normal queues).
67+
68+
- `ZO_FILE_DOWNLOAD_PRIORITY_QUEUE_WINDOW_SECS`
69+
**Type:** Integer (seconds)
70+
**Default:** `3600`
71+
**Description:** Defines the time window for files to be considered **recent**. Files within this range are routed to the Priority Queue.
72+
73+
- `ZO_FILE_DOWNLOAD_PRIORITY_QUEUE_THREAD_NUM`
74+
**Type:** Integer
75+
**Default:** `0` (auto-calculated as max(1, CPU cores/2))
76+
**Description:** Number of threads to use for downloading files from the Priority Queue.
77+
**Note:** A thread here refers to a background worker process used to perform downloads.
78+
79+
80+
## File Assignment Examples
81+
The following examples illustrate how files are assigned to the priority or normal queue based on their latest timestamps.
82+
83+
!!! tip "Each file’s latest timestamp is compared against the current time. If it falls within the configured priority window, it is placed in the priority queue."
84+
85+
=== "Ingestion Download Queuing Across a Large Time Range"
86+
87+
**Current Time:** 2025-05-29 14:00 UTC
88+
**Priority window:** 3600 seconds (1 hour)
89+
90+
During ingestion, the compactor processes a large volume of logs and creates the following three compacted Parquet files:
91+
92+
- **File A**
93+
94+
- Covers Logs From: 2025-05-28 10:00 – 2025-05-28 16:00
95+
- Latest Timestamp: 2025-05-28 16:00
96+
- Queue Assignment: Normal Queue
97+
98+
- **File B**
99+
100+
- Covers Logs From: 2025-05-29 09:00 – 2025-05-29 12:00
101+
- Latest Timestamp: 2025-05-29 12:00
102+
- Queue Assignment: Normal Queue
103+
104+
- **File C**
105+
106+
- Covers Logs From: 2025-05-29 13:00 – 2025-05-29 13:40
107+
- Latest Timestamp: 2025-05-29 13:40
108+
- Queue Assignment: Priority Queue
109+
110+
111+
After receiving the broadcast, the querier uses the Download Manager to fetch these files and assigns queues based on timestamps.
112+
113+
=== "Search Download Queuing Across a Long Time Range"
114+
115+
**Current Time:** 2025-05-29 14:00 UTC
116+
**Priority window:** 3600 seconds (1 hour)
117+
**User search query:** 2025-05-28 14:00 to 2025-05-29 14:00
118+
119+
The querier checks its local disk cache and finds some files within this range are already cached. They are used directly. However, the following files are missing and must be downloaded using the Download Manager:
120+
121+
- **File X**
122+
123+
- Covers Logs From: 2025-05-28 14:00 – 2025-05-28 20:00
124+
- Latest Timestamp: 2025-05-28 20:00
125+
- Queue Assignment: Normal Queue
126+
127+
- **File Y**
128+
129+
- Covers Logs From: 2025-05-29 09:00 – 2025-05-29 12:00
130+
- Latest Timestamp: 2025-05-29 12:00
131+
- Queue Assignment: Normal Queue
132+
133+
- **File Z**
134+
135+
- Covers Logs From: 2025-05-29 13:00 – 2025-05-29 13:45
136+
- Latest Timestamp: 2025-05-29 13:45
137+
- Queue Assignment: Priority Queue
138+
139+
For each missing file, the Download Manager checks its latest timestamp.
140+
Queue decisions are made by comparing each file’s latest timestamp against the current time and the configured priority window.
141+
142+
!!! Note
143+
The querier does not begin processing the search query until all required files, regardless of whether they were downloaded via the Priority or Normal Queue.
144+
145+
146+
## Frequently Asked Questions (FAQ)
147+
148+
**Q. My query includes both recent and old data. Do I get results faster with the new system?** <br>
149+
**A.** Yes. Files within the configured priority window are downloaded immediately. This helps reduce total wait time, even though the query waits for all required files.
150+
151+
152+
**Q. If the query waits for older files anyway, what is the point of downloading files from the priority window first?** <br>
153+
**A.** The system downloads files in parallel:
154+
155+
- Files in the priority queue are handled with higher urgency.
156+
- Older files go to the Normal Queue.
157+
158+
This improves responsiveness and prevents blocking.
159+
160+
161+
**Q. I searched for the last 15 minutes. Does the new system help me?** <br>
162+
**A.** Yes. If your requested files fall within the priority window, they are downloaded through the Priority Queue ahead of others. Your query completes faster, even if the system is busy.
163+

docs/user-guide/profile/.pages

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
nav:
2-
- UI Language in OpenObserve: language.md
2+
- UI Languages in OpenObserve: language.md

0 commit comments

Comments
 (0)