[Yandex Cloud documentation](../../index.md) > [Yandex Data Streams](../index.md) > [Concepts](index.md) > Terms and definitions

# Terms and definitions in Data Streams

## Data stream {#stream-concepts}

A data stream is a named set of messages. Messages in Data Streams are written and read via streams. Data streams are created based on Yandex Managed Service for YDB and are stored in databases.

## Shard {#shard}

To enable horizontal scaling, a stream is divided into shards which are units of concurrency. Each shard has a limited [throughput](#shard-thoughput).

{% note info %}

As for now, you can only reduce the number of shards in a stream by deleting and recreating a stream with a smaller number of shards.

{% endnote %}

You can configure a data stream to increase the number of shards as the write speed into the stream increases. For more information, see [autopartitioning in the YDB documentation](https://ydb.tech/docs/en//concepts/topic#partitioning).

### Shard key {#partition-key}

A shard key is specified for each [message](#message) while writing it to a stream. Using the key hash, the message is mapped to a certain shard inside the stream.

{% note warning %}

When updating the number of stream shards, their distribution across the key hash space changes, too. Messages that were written before the number of shards was updated remain in the same shards and the same sequence. New messages are distributed over a new number of shards.

{% endnote %}

### Shard throughput {#shard-thoughput}

Each shard has a limited user-defined throughput. The maximum data write speed per shard is 1 MB/sec and the maximum data read speed is 2 MB/sec.

## Message {#message}

A message is the minimum atomic unit of user information.

It consists of a [body](#message-body) and additional system properties.

### Message body {#message-body}

The body of a message is a set of bytes. Data Streams does not interpret the message body in any way.

### Message sequence number {#sequence-number}

When writing data to a stream, each message is assigned a sequence number. Message sequence numbers are unique within a single shard and increase sequentially.

### Message retention period {#retention-time}

The message retention period is set for each stream. After it expires, messages are automatically deleted.

## Consumers {#consumers}

Consumers are applications that get data from Data Streams and process it. All consumers share the [total quota](limits.md) for data reads.

## Consumer groups {#extended-consumers}

In some cases, the common [quota](https://console.yandex.cloud/cloud?section=quotas) model for all consumers is too restrictive, so each consumer gets a guaranteed read speed. Consumers with a guaranteed read speed are called _consumer groups_.

## Autopartitioning {#autopartitioning}

When overloading individual [shards](#shard) or the entire [stream](#stream-concepts), some data may get lost. [Autopartitioning](https://ydb.tech/docs/en//concepts/topic#autopartitioning) automatically adds shards as needed and distributes the workloads. This helps you avoid data loss.

You may enable and configure autopartitioning when or after [creating](../operations/manage-streams.md#create-data-stream) a data stream.

{% note warning %}

* You cannot disable autopartitioning.
* You cannot reduce the current number of stream segments if automatically increased.
* The Apache Kafka® protocol does not support autopartitioning for topics. If autopartitioning is enabled, you will not be able to work with the data stream over the Apache Kafka® protocol.

{% endnote %}

There are no separate charges for autopartitioning. If using [retention-based pricing](../pricing.md#time-limit), adding segments increases the cost of allocated resources in proportion to the number of segments.