For the complete documentation index, see llms.txt. This page is also available as Markdown.

Data Streaming

How to use the GridGain Data Streaming API to inject large volumes of data into a cluster, with stream receivers, transformers, and visitors.

Overview

GridGain provides a Data Streaming API that can be used to inject large amounts of continuous streams of data into a GridGain cluster. The Data Streaming API is designed to be scalable and fault-tolerant, and provides at-least-once delivery semantics for the data streamed into GridGain, meaning each entry is processed at least once.

Data is streamed into a cache via a data streamer associated with the cache. Data streamers automatically buffer the data and group it into batches for better performance and send it in parallel to multiple nodes.

The Data Streaming API provides the following features:

  • The data that is added to a data streamer is automatically partitioned and distributed between the nodes.

  • You can process the data concurrently in a colocated fashion.

  • Clients can perform concurrent SQL queries on the data as it is being streamed in.

Data Streaming

Data Streamers

A data streamer is associated with a specific cache and provides an interface for streaming data into the cache.

In a typical scenario, you obtain a data streamer and use one of its methods to stream data into the cache, and GridGain takes care of data partitioning and colocation by batching data entries according to partitioning rules to avoid unnecessary data movement.

You can obtain the data streamer for a specific cache as follows:

In the Java version of GridGain, a data streamer is an implementation of the IgniteDataStreamer interface. IgniteDataStreamer provides a number of add(...) methods for adding key-value pairs to caches. Refer to the IgniteDataStreamer javadoc for the complete list of methods.

unsupported

Closing a Data Streamer Asynchronously

In .NET, a data streamer implements IAsyncDisposable in addition to IDisposable. Use an await using block to dispose of the streamer asynchronously: the buffered data is flushed to the cluster without blocking the calling thread, unlike the synchronous Dispose(), which blocks while the remaining data is sent.

unsupported

unsupported

Avoiding Overwriting Existing Keys

By default, data streamers overwrite existing data. You can change that behavior by setting the allowOverwrite property of the data streamer to false.

unsupported

Processing Data

In cases when you need to execute custom logic before adding new data, you can use a stream receiver. A stream receiver is used to process the data in a colocated manner before it is stored into the cache. The logic implemented in a stream receiver is executed on the node where data is to be stored.

unsupported

Note that a stream receiver does not put data into the cache automatically. You need to call one of the put(...) methods explicitly.

Stream Transformer

A stream transformer is a convenient implementation of a stream receiver, that updates the data in the stream. Stream transformers take advantage of the colocation feature and update the data on the node where it is going to be stored.

In the example below, we use a stream transformer to increment a counter for each distinct word found in the text stream.

unsupported

Stream Visitor

A stream visitor is another implementation of a stream receiver, which visits every key-value pair in the stream. The visitor does not update the cache. If a pair needs to be stored in the cache, one of the put(...) methods must be called explicitly.

In the example below, we have 2 caches: "marketData", and "instruments". We receive market data ticks and put them into the streamer for the "marketData" cache. The stream visitor for the "marketData" streamer is invoked on the cluster member mapped to the particular market symbol. Upon receiving individual market ticks it updates the "instrument" cache with the latest market price.

Note, that we do not update the "marketData" cache at all, leaving it empty. We simply use it for colocated processing of the market data within the cluster directly on the node where the data is stored.

unsupported

Configuring Data Streamer Thread Pool Size

The data streamer thread pool is dedicated to process messages coming from the data streamers.

The default pool size is max(8, total number of cores). Use IgniteConfiguration.setDataStreamerThreadPoolSize(...) to change the pool size.

unsupported

unsupported

This page is: Copyright © 2026 MariaDB. All rights reserved.

spinner

Last updated

Was this helpful?