Skip to content

Commit b108670

Browse files
fmassotfulmicoton
andauthored
Update architecture doc page. (#1076)
* Update architecture doc page. * Update docs/design/architecture.md Co-authored-by: Paul Masurel <[email protected]> * Update docs/design/architecture.md Co-authored-by: Paul Masurel <[email protected]> * Update docs/design/architecture.md Co-authored-by: Paul Masurel <[email protected]> * Fix wording Co-authored-by: Paul Masurel <[email protected]>
1 parent bf79ae2 commit b108670

File tree

2 files changed

+968
-132
lines changed

2 files changed

+968
-132
lines changed

docs/assets/images/quickwit-architecture.svg

Lines changed: 912 additions & 90 deletions
Loading

docs/design/architecture.md

Lines changed: 56 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,89 +3,103 @@ title: Architecture
33
sidebar_position: 1
44
---
55

6-
WIP on Notion.
6+
Quickwit has been designed from the ground up for cost-efficiency and scalability.
77

8-
Quickwit is built on three pillars:
9-
- the index: a set of data structures tailored to be queried, even on high latency storage;
10-
- the metastore: stores index metadata and makes them available to all search nodes;
11-
- the search cluster: provides high availability search, workload distribution, and efficient caching.
8+
Quickwit core relies on two processes:
129

13-
[//]: # (Add space with '---' and align image for docusaurus)
10+
- The Searchers for executing search queries from the REST API.
11+
- The Indexers that index data from data sources.
1412

15-
---
16-
<div style={{textAlign: 'center'}}>
13+
Moreover, Quickwit leverages existing infrastructure by relying on battled-tested technologies for index storage, metadata storage, and ingestion:
1714

18-
![Quickwit Architecture](../assets/images/quickwit-architecture.svg)
15+
### Index storage
16+
17+
Quickwit stores its indexes's file on Amazon S3. In a single-server deployment, this can also be your local disk. We plan to support other cloud storage, as well as HDFS.
18+
19+
### Metastore
20+
21+
Quickwit gathers index metadata into a metastore to make them available across the cluster. Indexers push index data on the index storage and publish metadata to the metastore.
22+
23+
In a clustered deployment, the metastore is typically a traditional RDBMS like PostgreSQL which we only support today. In a single-server deployment, it’s also possible to rely on a local file or on Amazon S3.
1924

20-
</div>
25+
### Distributed message queues
2126

22-
## The index
27+
Quickwit indexers connect directly to external message queues like Kafka and guarantee the exactly-once semantics. If you need support for other distributed queues, please vote for yours [here](https://github.com/quickwit-inc/quickwit/issues/1000).
2328

24-
A quickwit index stores documents and makes it possible to query them efficiently.
25-
The index organizes documents into a collection of smaller independent indexes called splits. Behind the scenes, a split is just a [tantivy index](https://github.com/tantivy-search/tantivy/blob/main/ARCHITECTURE.md#index-and-segments) with a custom index format.
29+
## Architecture diagram
2630

27-
You have total control over how document fields are stored and indexed, thanks to the `Index config`.
31+
The following diagram shows a Quickwit cluster with searchers and indexers that receives queries by the API and messages from a Kafka topic.
2832

29-
### Index config
33+
![Quickwit Architecture](../assets/images/quickwit-architecture.svg)
34+
35+
# Key concepts
36+
37+
## Index & splits
3038

31-
A document is a collection of fields and associated values. Fields can be stored in different data structures:
32-
- an inverted index, which enables fast full-text search;
33-
- a column-oriented storage called `fast field`, which is the equivalent of `DocValues` in Lucene. Fast fields are required for computing aggregates over documents matching a query. They also allow some advanced types of filtering;
34-
- a row-store, called the `doc store` making it possible to retrieve the content of matching documents.
39+
A Quickwit index stores documents and makes it possible to query them efficiently. The index organizes documents into a collection of smaller independent indexes called **splits**.
3540

36-
The index config controls how to map JSON objects to Quickwit documents and, for each field, defines whether it should be stored, indexed, or encoded as a fast field.
37-
You can define one with a `JSON file`, [see docs](../reference/index-config.md).
41+
A document is a collection of fields. Fields can be stored in different data structures:
42+
43+
- an inverted index, which enables fast full-text search.
44+
- a columnar storage called `fast field`. It is the equivalent of doc values in [Lucene]([https://lucene.apache.org/](https://lucene.apache.org/)). Fast fields are required to compute aggregates over the documents matching a query. They can also allow some advanced types of filtering.
45+
- a row-storage called the doc store. It makes it possible to get the content of the matching documents.
46+
47+
You can configure your index to control how to map your JSON object to a Quickwit document and, for each field, define whether it should be stored, indexed, or be a fast field. [Learn how to configure your index](../reference/index-config.pd)
3848

3949
### Splits
4050

41-
A split is a small piece of an index identified by a UUID. For each split, Quickwit creates a `hotcache` file along with the index files. This hotcache enables the search nodes to open a split in less than 60ms, even on high latency storage.
51+
A split is a small piece of an index identified by a UUID. For each split, Quickwit adds up a `hotcache` file along with index files. This **hotcache** is what makes it possible for Searchers to open a split in less than 60ms, even on high latency storage.
4252

43-
The quickwit index is aware of its splits by keeping splits metadata, notably:
44-
- the split state, which indicates whether the split is ready for search:
45-
- the min/max time range computed on the timestamp field if present.
53+
The Quickwit index is aware of its splits by keeping splits metadata, notably:
4654

47-
This timestamp metadata can be handy at query time. If the user specifies a time range filter in their query, Quickwit will use it to **prune irrelevant splits**.
55+
- the split state which indicates if the split is ready for search
56+
- the min/max time range computed on the timestamp field if present.
4857

49-
Index metadata needs to be accessible by every instance of the cluster. This is made possible thanks to the `metastore`.
58+
This timestamp metadata can be handy at query time. If the user specifies a time range filter to their query, Quickwit will use it to **prune irrelevant splits**.
5059

60+
Index metadata needs to be accessible by every instance of the cluster. This is made possible thanks to the `metastore`.
5161

52-
## The metastore
62+
### Metastore
5363

5464
Quickwit gathers index metadata into a metastore to make them available across the cluster.
5565

5666
For a given query on a given index, a search node will ask the metastore for the index metadata and then use it to do the query planning and finally execute the plan.
5767

58-
Currently, the only implementation of the `metastore` is a JSON file based store: it writes a `quickwit.json` on disk or in an Amazon S3 bucket. We plan on supporting other backends such as Postgresql and other popular databases soon.
59-
68+
Currently, Quickwit supports metastore backed by Postgresql and AWS S3 bucket. For a test/local deployment, you can also use a file backed metastore.
6069

61-
## The search cluster
70+
### Distributed search
6271

6372
Quickwit's search cluster has the following characteristics:
73+
6474
- It is composed of stateless nodes: any node can answer any query about any splits.
6575
- A node can distribute search workload to other nodes.
6676
- Cluster membership is based on the SWIM gossip protocol.
6777
- Load-balancing is made with rendezvous hashing to allow for efficient caching.
6878

6979
This design provides high availability while keeping the architecture simple.
7080

71-
### Stateless nodes
81+
**Workload distribution: root and leaf nodes**
82+
83+
Any search node can handle any search request. A node that receives a query will act as the root node for the span of the request. It will then process it in 3 steps:
84+
85+
- Get the index metadata from the metastore and identify the splits relevant to the query.
86+
- Distributes the split workload among the nodes of the cluster. These nodes are assuming the role of leaf nodes.
87+
- Returns aggregated results.
88+
89+
**Stateless nodes**
7290

7391
Quickwit cluster distributes search workloads while keeping nodes stateless.
7492

7593
Thanks to the hotcache, opening a split on Amazon S3 only takes 60ms. It makes it possible to remain totally stateless: a node does not need to know anything about the indexes. Adding or removing nodes takes seconds and does not require moving data around.
7694

77-
### Workload distribution: root and leaf nodes
78-
79-
Any search node can handle any search request. A node that receives a query will acts as the root node for the span of the request. It will then process it in 3 steps:
80-
- Get the index metadata from the metastore and identify the splits relevant for the query.
81-
- Distributes the split workload among the nodes of the cluster. These nodes are assuming the role of leaf nodes.
82-
- Returns aggregated results.
95+
**Cluster discovery**
8396

84-
### Cluster discovery
97+
Quickwit uses a gossip protocol to manage membership and broadcast messages to the cluster provided by [artillery project](https://github.com/bastion-rs/artillery/). The gossip protocol is based on [SWIM: Scalable Weakly-consistent Infection-style Process Group Membership Protocol]([https://www.cs.cornell.edu/projects/Quicksilver/public_pdfs/SWIM.pdf](https://www.cs.cornell.edu/projects/Quicksilver/public_pdfs/SWIM.pdf)) with a few minor adaptations.
8598

86-
Quickwit uses a gossip protocol to manage membership and broadcast messages to the cluster provided by [artillery project](https://github.com/bastion-rs/artillery/). The gossip protocol is based on "SWIM: Scalable Weakly-consistent Infection-style Process Group Membership Protocol" with a few minor adaptations.
99+
**Rendezvous hashing**
87100

101+
The root node uses [Rendezvous hashing](https://en.wikipedia.org/wiki/Rendezvous_hashing) to distribute the workload among leaf nodes. Rendez-vous hashing makes it possible to define a node/split affinity function with excellent stability properties when a node joins or leaves the cluster. This trick unlocks efficient caching.
88102

89-
### Rendezvous hashing
103+
### Indexing
90104

91-
The root node uses [Rendezvous hashing](https://en.wikipedia.org/wiki/Rendezvous_hashing) to distribute the workload among leaf nodes. Rendez-vous hashing makes it possible to define a node/split affinity function with excellent stability properties when a node joins or leaves the cluster. This trick unlocks efficient caching. In Quickwit v0.1, however, caching is limited to the hotcache files.
105+
See [dedicated indexing doc page](indexing.md).

0 commit comments

Comments
 (0)