> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# Architecture

> Compare shared-nothing and shared-data architectures, including the roles of FE, BE, and CN and where table data is stored.

Both architectures use **FE** nodes to accept client connections, manage metadata, and coordinate SQL queries. Clients connect to an FE using the MySQL protocol. Choose an architecture based on where persistent table data should reside and how compute and storage need to scale.

## Architecture choices

| Compare | Shared-nothing | Shared-data |
| - | - | - |
| Query execution | BEs execute queries | CNs execute queries |
| Persistent table data | BE local disks, with replicas placed according to the replica settings | Shared object storage or HDFS, with local disks on CNs used for caching |
| Scaling | Add a BE to increase compute and local storage capacity. Replicas may be redistributed. | Scale compute and storage independently. New CNs may need to warm their caches. |

### Shared-nothing

A shared-nothing cluster uses **FEs and BEs**. BEs execute query tasks assigned by the FE and persist table data to their local disks. Queries can scan data locally on the BEs that store it. Adding or removing BEs can redistribute replicas across nodes.

![Shared-nothing architecture. Clients connect to FEs, which coordinate queries. BEs run queries and persist table data on their local disks.](https://mintcdn.com/mirrorship-docs/4LIiduywSZ_mNJQ3/documents/brand/diagrams/en/shared-nothing.svg?fit=max\&auto=format\&n=4LIiduywSZ_mNJQ3\&q=85\&s=33697b8983e4e014a1fd10ec05c1bb46)

#### Nodes

In the shared-nothing architecture, the database consists of two types of nodes: FEs and BEs.

* FEs are responsible for metadata management and constructing execution plans.
* BEs execute query plans and store data. BEs utilize local storage to accelerate queries and the multi-replica mechanism to ensure high data availability.

##### FE

FEs are responsible for metadata management, client connection management, query planning, and query scheduling. Each FE uses BDB JE (Berkeley DB Java Edition) to store and maintain a complete copy of the metadata in its memory, ensuring consistent services across all FEs. FEs can work as the leader, followers, and observers. If the leader node crashes, with followers electing a leader through the replication and election mechanism of BDB JE.

| **FE Role** | **Metadata management** | **Leader election** |
| - | - | - |
| Leader | The leader FE reads and writes metadata. Follower and observer FEs can only read metadata. They route metadata write requests to the leader FE. The leader FE updates the metadata and then uses BDB JE replication to synchronize the metadata changes to the follower and observer FEs. Data writes are considered successful only after the metadata changes are synchronized to more than half of the follower FEs. | The leader FE, technically speaking, is also a follower node and is elected from follower FEs. To perform leader election, more than half of the follower FEs in the cluster must be active. When the leader FE fails, follower FEs will start another round of leader election. |
| Follower | Followers can only read metadata. They synchronize and replay logs from the leader FE to update metadata. | Followers participate in leader election, which requires more than half of the followers in the cluster be active. |
| Observer | Observers synchronize and replay logs from the leader FE to update metadata. | Observers are mainly used to increase the query concurrency of the cluster. Observers do not participate in leader election and therefore, will not add leader selection pressure to the cluster. |

##### BE

BEs are responsible for data storage and SQL execution.

* Data storage: BEs have equivalent data storage capabilities. FEs distribute data to BEs based on predefined rules. BEs transform the ingested data, write the data into the required format, and generate indexes for the data.

* SQL execution: FEs build and distribute query plans. BEs execute their assigned tasks, scan local data where possible, and exchange intermediate results with other nodes as needed.

### Shared-data

A shared-data cluster uses **FEs and CNs**, with persistent table data in shared object storage or HDFS. CNs run queries and cache hot data. Add or remove CNs to change compute capacity while persistent data stays in shared storage. CNs that take over queries may need to cache the data again.

The FE setting `lake_enable_balance_tablets_between_workers` controls tablet balancing onto new CNs. It is enabled by default from v3.5.6 and v4.0 onwards.

![Shared-data architecture. Clients connect to FEs. CNs run queries and cache hot data. Persistent data resides in shared object storage or HDFS.](https://mintcdn.com/mirrorship-docs/4LIiduywSZ_mNJQ3/documents/brand/diagrams/en/shared-data.svg?fit=max\&auto=format\&n=4LIiduywSZ_mNJQ3\&q=85\&s=aa3ac560886011d6e8f578a616c62f0f)

#### Nodes

FEs in the shared-data architecture provide the same functions as in the shared-nothing architecture.

BEs are replaced with CNs (Compute Nodes), and the storage function is offloaded to object storage or HDFS. CNs are stateless compute nodes that perform all the functions of BEs, except for the storage of data.

#### Storage

The database shared-data clusters support two storage solutions: object storage (for example, AWS S3, Google GCS, Azure Blob Storage, or MinIO) and HDFS.

In a shared-data cluster, the data file format remains consistent with that of a shared-nothing cluster (featuring coupled storage and compute). Data is organized into segment files, and various indexing technologies are reused in cloud-native tables, which are tables used specifically in shared-data clusters.

#### Cache

CNs can read hot data from memory or their local disk caches. On a cache miss, they read the required data from shared storage and cache it according to the cache settings. New or replacement CNs may need more remote reads while their caches warm up, which can increase query latency.

You can configure caching when you create a table. When write caching is enabled, a copy of the data can be cached on local disk. Shared storage holds the persistent data.

## Feature Differences between Shared-nothing and Shared-data Clusters

This section lists the differences of features supported in shared-nothing and shared-data clusters.

### Real-time Analytics and Primary Key Tables

| Feature | Shared-nothing | Shared-data |
| - | - | - |
| Conditional Update | v2.5+ | v3.1+ |
| Partial Update Column mode | v3.1 | v3.3.1+ |
| Partial Update Row mode | v2.3+ | v3.1+ |
| Partial update with Conditional Update | v3.1+ | v3.4.1+ |
| Primary Key Index Persistence | v2.3+ | v3.2+ |
| Decoupled ORDER BY columns from Primary Keys | v3.0+ | v3.1+ |
| Rich UPDATE and DELETE syntax for Primary Key tables | v3.0+ | v3.1+ |

### Storage Engine

| Feature | Shared-nothing | Shared-data |
| - | - | - |
| Fast Schema Evolution | v3.2+ | v4.0+ |
| File Bundling | Not applicable | v4.0+ |
| Inverted Index | v3.3+ | v4.1+ |
| Manual Compaction | v3.1+ | v3.3+ |
| Row Store | v3.2+ | To be supported |
| Adding/dropping STRUCT fields | v3.3.2+ | v3.3.5+ |
| Vector index | v3.4+ | To be supported |

### Data Distribution

| Feature | Shared-nothing | Shared-data |
| - | - | - |
| Expression Partitioning | v3.0+ | v3.1.1+ |
| List Partitioning | v3.1+ | v3.1.1+ |
| Random Bucketing | v3.1+ | v3.2+ |
| Random Bucketing Optimization (with Sub-partition) | v3.2+ | v3.2+ |
| Unified Syntax for Multi-level Expression Partition | v3.4+ | v3.4+ |
| Optimize Table: Change Bucketing | v3.2+ | v3.3+ |
| Optimize Table: Change Bucketing Online | v3.3.3+ | Not applicable |
| Range-based Distribution | v4.1+ | v4.1+ |

### Query Performance

| Feature | Shared-nothing | Shared-data |
| - | - | - |
| Cross-node Data Cache Sharing | Not applicable | v3.5.1+ |
| Generated Column | v3.1+ | v3.5+ |
| Query Cache | v2.5+ | v3.4+ |
| Rollup and Synchronous Materialized view | v1.x+ | v3.3+ |

### Data Protection

| Feature | Shared-nothing | Shared-data |
| - | - | - |
| Backup & Restore | v1.x+ | Not applicable |
| BE/CN Blacklist | v3.3+ | v4.0+ |
| Cross-cluster Data Migration Tool | v3.3+ | Not applicable |
| Cluster Snapshot | Not applicable | v3.4.2+ |

### Security and Authentication

| Feature | Shared-nothing | Shared-data |
| - | - | - |
| Kerberos Support on HDFS | Not applicable | v3.2+ |

***

***

## Learn by doing

Try the [Quick Starts](/documents/4.2/quick_start/quick_start.md) to get an overview of using the database with realistic scenarios.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.