Data saving mode

Data saving mode is available for Early Access

Data saving mode is supported in the Go and Node.js (server-side) SDKs. It is also supported in the Relay Proxy.

Data saving mode is only available to members of LaunchDarkly’s Early Access Program (EAP). If you want access to this feature, join the EAP.

Overview

This topic explains how data saving mode works in the LaunchDarkly SDKs that support it.

Server-side SDKs in data saving mode first open a polling connection to LaunchDarkly. The initial payload from this connection contains the data the SDK will need to operate and perform flag evaluations.

Subsequently, server-side SDKs in data saving mode open a streaming connection and receive realtime flag configuration changes over the stream. These configuration changes include only the difference between the server-side SDK’s stored configuration and the latest configuration in LaunchDarkly. The SDKs use in-memory data for the unchanged aspects of the flag configuration.

The SDKs fall back to using a polling connection if LaunchDarkly streaming is unavailable. Data saving mode includes additional configuration options that let you set a backup data source, enabling automatic failover if a connection is unavailable.

Depending on the number of flags in your project and the complexity of their configuration, data saving mode can significantly improve performance, including reducing your network costs when in polling mode or on reconnection. Additionally, SDKs in data saving mode have reduced memory and CPU usage overall.

Server-side SDKs

This feature is available in the following SDKs:

Go

To enable data saving mode:

  1. If you are using the Relay Proxy, upgrade your Relay Proxy to version 9.0.0-alpha.1 or later.
Relay Proxy version 9 supports data saving mode

The Relay Proxy version that supports data saving mode will be released as an alpha version while data saving mode is part of LaunchDarkly’s Early Access Program (EAP). We will release version 9.0 by the end of the EAP.

  1. Upgrade your Go SDK to version 7.11 or later.
  2. Request to join the Early Access Program. Wait to receive confirmation from LaunchDarkly that data saving mode is enabled for your account.
  3. Update your SDK configuration to enable the DataSystem configuration option.

Here’s how to enable the DataSystem configuration option:

Go SDK v7.11+
1import (
2 "github.com/launchdarkly/go-sdk-common/v3/ldcontext"
3 ld "github.com/launchdarkly/go-server-sdk/v7"
4 "github.com/launchdarkly/go-server-sdk/v7/ldcomponents"
5)
6
7var config ld.Config
8
9config.DataSystem = ldcomponents.DataSystem().Default()
10
11client, _ := ld.MakeCustomClient("sdk-key-123abc", config, 5*time.Second)

The standard data system configuration is recommended for most customers. It uses a combination of streaming and polling to initialize the SDK, provide real time updates, and switch between streaming and polling automatically to provide redundancy.

To learn more, read DataSystem. For information on additional configuration options, read DataSystemConfiguration.

Node.js (server-side)

To enable data saving mode:

  1. If you are using the Relay Proxy, upgrade your Relay Proxy to version 9.0.0-alpha.1 or later.
Relay Proxy version 9 supports data saving mode

The Relay Proxy version that supports data saving mode will be released as an alpha version while data saving mode is part of LaunchDarkly’s Early Access Program (EAP). We will release version 9.0 by the end of the EAP.

  1. Upgrade your Node.js (server-side) SDK to version 9.10 or later.
  2. Request to join the Early Access Program. Wait to receive confirmation from LaunchDarkly that data saving mode is enabled for your account.
  3. Update your SDK configuration:
    • Enable the dataSystem configuration option.
    • Migrate existing LDOptions fields. The following existing options were previously top-level LDOptions fields and are part of the dataSystem configuration as of version 9.10: persistentStore, stream, streamInitialReconnectDelay, pollInterval, useLDD.

Here’s how to enable the dataSystem configuration option:

Node.js (server-side) SDK v9.10+
1const ldClient = LaunchDarkly.init('sdk-key-123abc', {
2 dataSystem: {
3 dataSource: {
4 dataSourceOptionsType: 'standard',
5
6 // if you use the stream, streamInitialReconnectDelay, or pollInterval options,
7 // these options are now part of the dataSystem options,
8 // and are set within the dataSource option
9 }
10 // if you use the persistentStore or useLDD option,
11 // these options are now part of the dataSystem option
12 }
13});

The standard data source option is recommended for most customers. It uses a combination of streaming and polling to initialize the SDK, provide real time updates, and switch between streaming and polling automatically to provide redundancy.

To learn more, read dataSystem. For information on additional configuration options, read LDDataSystemOptions.