> For the complete documentation index, see [llms.txt](https://xai-5.gitbook.io/xai-space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xai-5.gitbook.io/xai-space/core-functionality/data-stream.md).

# Data Stream

<figure><img src="/files/6lq8UZv2PhQk6lH56kI5" alt=""><figcaption></figcaption></figure>

## Architecture Description

This architecture aims to build a **large-scale data stream processing platform** with both **real-time** and **batch processing capabilities**.

### Kafka

• **As a message queue system**, Kafka is used to **receive and buffer real-time data** from various data sources.

• **Data sources** can be user operation logs, sensor data, or business system events.

### Flink

• Data in Kafka is processed in **real time** through Flink to complete **filtering, aggregation, and complex event processing (CEP)**.

• Flink tasks will continue to **consume data from Kafka topics** and output the processed results to **downstream storage**.

### Spark

• Used for **batch analysis** of **historical data** or **large-scale offline data**.

• Spark reads historical data from **data stores** (such as HDFS, S3) and performs **big data computing and machine learning tasks**.

### ClickHouse

• As a **high-performance columnar storage**, ClickHouse is used to **store and query processed aggregated or historical analysis data**.

• ClickHouse supports **real-time data insertion** and **complex query operations**, and is suitable for building **BI reports** and **data analysis systems**.

### Other components

• **Zookeeper**: Coordinates **Kafka partitions** and **distributed task management**.

• **Connector/ETL**: Data is imported from **different sources into Kafka or Flink/Spark**.

• **Dashboard or BI tool: User interface** used to **visualize and analyze ClickHouse data**.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://xai-5.gitbook.io/xai-space/core-functionality/data-stream.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
