Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Best practices for Stream service configuration

Updated on July 5, 2022

This content applies only to On-premises and Client-managed cloud environments

Follow these guidelines for the recommended configuration of the Stream service in your system. These best practices apply only to on-premises deployments.

Note: The Stream service can also be configured to run in External Mode. The advantage of that is the decoupling of Pega Platform from Kafka, and not having the nodes of type Stream. For more information on how to configure it, see Configuring External Kafka as a Stream service.

Expected throughput

Data throughput depends on the number of nodes, CPUs, and partitions, as well as the replication factor and bandwidth

Review the results of tests on three running stream service nodes on machines with the following configuration:

  • CPU cores: 2
  • Memory (GB): 8
  • Bandwidth (Mbps): 450
  • Number of partitions: 20
  • Replication factor: 2

The following table shows the test results for writing messages to the stream (producer):

Producer throughput – test results

RecordsRecord size (bytes)ThreadsThroughput (rec/sec)Average latency (ms)MB/sec
50000001001836752.28.4
5172276.111.917.2
10216682.840.421.7
100132967.75.133
553033.748.653
1049861.7174.349.8
100176812.12.47.7
5165317.413.316.5
10203216.346.119.38
1000135865.74.835.9
552456.741.952.4
1050266.1158.850.3

The following table presents the test results for reading messages from the stream (consumer):

Note:

For the consumer, the replication factor is not important because the consumer reads from the leading partition.

Consumer throughput – test results

RecordsRecord size (bytes)ThreadsThroughput (rec/sec)MB/sec
5,000,0001001120673.812
515046515
10143395.314.3
1,000154128.454.1
555903.355.9
1054674.554.7

Disk space requirements

By default, the Kafka cluster stores data for 60 hours (2.5 days). You can change the retention period for specific stream categories by modifying the services/stream/category/retention/categoryName property in the prconfig.xml file, where categoryName can have one of the following values:

  • dataset
  • decisioning
  • queueprocessor
  • system

For example, you can set the retention period for streams in the QueueProcessor category by using the following property: services/stream/category/retention/queueprocessor.

For example:

Your goal is to process 100,000 messages per second, 500 bytes each, and to keep messages on the disk for one day. The replication factor is set to 2.

The expected throughput is 50 MB/sec:

  • 3 GB is used in one minute for a single copy of the data.
  • 6 GB of disk space is used in one minute due to the replication factor of 2.
  • The total throughput is 360 GB in one hour and 8.64 TB in one day.
  • Apart from your data, the Kafka cluster uses additional disk space for internal data (around 10% of the data size).

In that sample scenario, the total minimal disk size should be 9.5 TB.

Compression

Depending on your needs, you can choose data compression using one of the algorithms that Kafka supports: gzip, Snappy, or LZ4. Consider the following aspects:

  • Gzip requires less bandwidth and disk space, but this algorithm might not saturate your network while the maximum throughput is reached.
  • Snappy is much faster than gzip, but the compression ratio is low, which means that throughput might be limited when the maximum network capacity is reached.
  • LZ4 maximizes the performance.

Review the following table and diagram with throughput and bandwidth usage per codec:

Throughput and bandwidth per codec (%)

CodecThroughput %Bandwidth %
None100100
Gzip47.55.2
Snappy116.364.1
LZ4188.934.5
Throughput and bandwidth metrics per codec (%)
The bar chart shows that LZ4 has the highest throughput. Snappy has the highest bandwidth and traffic.
Disk usage metrics per codec

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us