> ## Documentation Index
> Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Data saving mode

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

> For the complete documentation index, see [llms.txt](/llms.txt). For the full documentation snapshot, see [llms-full.txt](/llms-full.txt).

<Note title="Data saving mode is available for Early Access">
  Data saving mode is supported in the server-side SDKs listed below. It is also supported in the [Relay Proxy](/sdk/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](mailto:product@launchdarkly.com).
</Note>

## 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.

<Tip title="Track service connection usage by application">
  When using data saving mode, you can track which applications are consuming service connections by configuring application metadata. Set the `applicationId` in your SDK configuration to see a per-application breakdown on the **Service connections** usage page under the **SDK App ID** dimension. Server-side streaming connections without `applicationId` configured appear as "Unknown." To learn how, read [Application metadata configuration](/sdk/features/app-config).
</Tip>

## Server-side SDKs

This feature is available in the following SDKs:

* [.NET (server-side)](#net-server-side)
* [Go](#go)
* [Java](#java)
* [Node.js (server-side)](#nodejs-server-side)
* [Python](#python)
* [Ruby](#ruby)

### .NET (server-side)

<Accordion title="Expand .NET (server-side) SDK code sample">
  To enable data saving mode:

  1. If you are using the [Relay Proxy](/sdk/relay-proxy), upgrade your Relay Proxy to version 9.0.0-rc.1 or later.

  2. Upgrade your .NET (server-side) SDK to version 8.11 or later.

  3. Request to [join the Early Access Program](mailto:product@launchdarkly.com). Wait to receive confirmation from LaunchDarkly that data saving mode is enabled for your account.

  4. Update your SDK configuration to enable the `DataSystem` configuration option.

  Here's how to enable the `DataSystem` configuration option:

  #### Standard setup

  <CodeGroup>
    ```csharp title=".NET (server-side) SDK v8.11+" theme={null}
          using LaunchDarkly.Sdk.Server;

          var config = Configuration.Builder("YOUR_SDK_KEY")
              .DataSystem(Components.DataSystem().Default())
              .Build();

          var client = new LdClient(config);
    ```
  </CodeGroup>

  We recommend the standard data system configuration 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.

  #### Relay proxy with Launch

  Darkly API fallback

  <CodeGroup>
    ```csharp title=".NET (server-side) SDK v8.11+" theme={null}
          using LaunchDarkly.Sdk.Server;
          using LaunchDarkly.Sdk.Server.Integrations;

          var relayUri = new Uri("http://my-relay-proxy:8030");
          var relayEndpoints = Components.ServiceEndpoints().RelayProxy(relayUri);

          var config = Configuration.Builder("YOUR_SDK_KEY")
              .DataSystem(
                  Components.DataSystem().Custom()
                      .Initializers(
                          DataSystemComponents.Polling()
                              .ServiceEndpointsOverride(relayEndpoints),
                          DataSystemComponents.Polling()
                      )
                      .Synchronizers(
                          DataSystemComponents.Streaming()
                              .ServiceEndpointsOverride(relayEndpoints),
                          DataSystemComponents.Streaming(),
                          DataSystemComponents.Polling()
                      )
              )
              .Build();

          var client = new LdClient(config);
    ```
  </CodeGroup>

  #### File-based bootstrap with live updates

  <CodeGroup>
    ```csharp title=".NET (server-side) SDK v8.11+" theme={null}
          using LaunchDarkly.Sdk.Server;
          using LaunchDarkly.Sdk.Server.Integrations;

          var config = Configuration.Builder("YOUR_SDK_KEY")
              .DataSystem(
                  Components.DataSystem().Custom()
                      .Initializers(
                          FileData.DataSource().FilePaths("flags.json"),
                          DataSystemComponents.Polling()
                      )
                      .Synchronizers(
                          DataSystemComponents.Streaming(),
                          DataSystemComponents.Polling()
                      )
              )
              .Build();

          var client = new LdClient(config);
    ```
  </CodeGroup>

  To learn more, read [`DataSystemModes`](https://launchdarkly.github.io/dotnet-core/pkgs/sdk/server/api/LaunchDarkly.Sdk.Server.Integrations.DataSystemModes.html) for information about pre-configured data system modes, and [`DataSystemBuilder`](https://launchdarkly.github.io/dotnet-core/pkgs/sdk/server/api/LaunchDarkly.Sdk.Server.Integrations.DataSystemBuilder.html) for information on additional configuration options.
</Accordion>

### Go

<Accordion title="Expand Go SDK code sample">
  To enable data saving mode:

  1. If you are using the [Relay Proxy](/sdk/relay-proxy), upgrade your Relay Proxy to version 9.0.0-rc.1 or later.

  2. Upgrade your Go SDK to version 7.11 or later.

  3. Request to [join the Early Access Program](mailto:product@launchdarkly.com). Wait to receive confirmation from LaunchDarkly that data saving mode is enabled for your account.

  4. Update your SDK configuration to enable the `DataSystem` configuration option.

  Here's how to enable the `DataSystem` configuration option:

  #### Standard setup

  <CodeGroup>
    ```go title="Go SDK v7.11+" theme={null}
          import (
              "github.com/launchdarkly/go-sdk-common/v3/ldcontext"
              ld "github.com/launchdarkly/go-server-sdk/v7"
              "github.com/launchdarkly/go-server-sdk/v7/ldcomponents"
          )

          var config ld.Config

          config.DataSystem = ldcomponents.DataSystem().Default()

          client, _ := ld.MakeCustomClient("YOUR_SDK_KEY", config, 5*time.Second)
    ```
  </CodeGroup>

  We recommend the standard data system configuration 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.

  #### Relay proxy with Launch

  Darkly API fallback

  <CodeGroup>
    ```go title="Go SDK v7.11+" theme={null}
          import (
              ld "github.com/launchdarkly/go-server-sdk/v7"
              "github.com/launchdarkly/go-server-sdk/v7/ldcomponents"
          )

          var config ld.Config

          relayURI := "http://my-relay-proxy:8030"

          config.DataSystem = ldcomponents.DataSystem().Custom().
              Initializers(
                  ldcomponents.PollingDataSourceV2().BaseURI(relayURI).AsInitializer(),
                  ldcomponents.PollingDataSourceV2().AsInitializer(),
              ).
              Synchronizers(
                  ldcomponents.StreamingDataSourceV2().BaseURI(relayURI),
                  ldcomponents.StreamingDataSourceV2(),
                  ldcomponents.PollingDataSourceV2(),
              )

          client, _ := ld.MakeCustomClient("YOUR_SDK_KEY", config, 5*time.Second)
    ```
  </CodeGroup>

  #### File-based bootstrap with live updates

  <CodeGroup>
    ```go title="Go SDK v7.11+" theme={null}
          import (
              ld "github.com/launchdarkly/go-server-sdk/v7"
              "github.com/launchdarkly/go-server-sdk/v7/ldcomponents"
              "github.com/launchdarkly/go-server-sdk/v7/ldfiledatav2"
          )

          var config ld.Config

          config.DataSystem = ldcomponents.DataSystem().Custom().
              Initializers(
                  ldfiledatav2.DataSource().FilePaths("flags.json").AsInitializer(),
                  ldcomponents.PollingDataSourceV2().AsInitializer(),
              ).
              Synchronizers(
                  ldcomponents.StreamingDataSourceV2(),
                  ldcomponents.PollingDataSourceV2(),
              )

          client, _ := ld.MakeCustomClient("YOUR_SDK_KEY", config, 5*time.Second)
    ```
  </CodeGroup>

  To learn more, read [`DataSystem`](https://pkg.go.dev/github.com/launchdarkly/go-server-sdk/v7#Config.DataSystem). For information on additional configuration options, read [`DataSystemConfiguration`](https://pkg.go.dev/github.com/launchdarkly/go-server-sdk/v7@v7.11.0/subsystems#DataSystemConfiguration).
</Accordion>

### Java

<Accordion title="Expand Java SDK code sample">
  To enable data saving mode:

  1. If you are using the [Relay Proxy](/sdk/relay-proxy), upgrade your Relay Proxy to version 9.0.0-rc.1 or later.

  2. Upgrade your Java (server-side) SDK to version 7.11 or later.

  3. Request to [join the Early Access Program](mailto:product@launchdarkly.com). Wait to receive confirmation from LaunchDarkly that data saving mode is enabled for your account.

  4. Update your SDK configuration to enable the `dataSystem` configuration option.

  Here's how to enable the `dataSystem` configuration option:

  #### Standard setup

  <CodeGroup>
    ```java title="Java SDK v7.11+" theme={null}
          import com.launchdarkly.sdk.server.*;

          LDConfig config = new LDConfig.Builder()
              .dataSystem(Components.dataSystem().defaultMode())
              .build();

          LDClient client = new LDClient("YOUR_SDK_KEY", config);
    ```
  </CodeGroup>

  We recommend the default data system configuration 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.

  #### Relay proxy with Launch

  Darkly API fallback

  <CodeGroup>
    ```java title="Java SDK v7.11+" theme={null}
          import com.launchdarkly.sdk.server.*;
          import com.launchdarkly.sdk.server.integrations.*;

          import java.net.URI;

          URI relayUri = URI.create("http://my-relay-proxy:8030");
          ServiceEndpointsBuilder relayEndpoints = Components.serviceEndpoints().relayProxy(relayUri);

          LDConfig config = new LDConfig.Builder()
              .dataSystem(
                  Components.dataSystem().custom()
                      .initializers(
                          DataSystemComponents.pollingInitializer()
                              .serviceEndpointsOverride(relayEndpoints),
                          DataSystemComponents.pollingInitializer()
                      )
                      .synchronizers(
                          DataSystemComponents.streamingSynchronizer()
                              .serviceEndpointsOverride(relayEndpoints),
                          DataSystemComponents.streamingSynchronizer(),
                          DataSystemComponents.pollingSynchronizer()
                      )
              )
              .build();

          LDClient client = new LDClient("YOUR_SDK_KEY", config);
    ```
  </CodeGroup>

  #### File-based bootstrap with live updates

  <CodeGroup>
    ```java title="Java SDK v7.11+" theme={null}
          import com.launchdarkly.sdk.server.*;
          import com.launchdarkly.sdk.server.integrations.*;

          LDConfig config = new LDConfig.Builder()
              .dataSystem(
                  Components.dataSystem().custom()
                      .initializers(
                          FileData.initializer().filePaths("flags.json"),
                          DataSystemComponents.pollingInitializer()
                      )
                      .synchronizers(
                          DataSystemComponents.streamingSynchronizer(),
                          DataSystemComponents.pollingSynchronizer()
                      )
              )
              .build();

          LDClient client = new LDClient("YOUR_SDK_KEY", config);
    ```
  </CodeGroup>

  To learn more, read [`DataSystemModes`](https://launchdarkly.github.io/java-core/lib/sdk/server/com/launchdarkly/sdk/server/integrations/DataSystemModes.html)for information about pre-configured data system modes, and [`DataSystemBuilder`](https://launchdarkly.github.io/java-core/lib/sdk/server/com/launchdarkly/sdk/server/integrations/DataSystemBuilder.html) for information on additional configuration options.
</Accordion>

### Node.js (server-side)

<Accordion title="Expand Node.js (server-side) code sample">
  To enable data saving mode:

  1. If you are using the [Relay Proxy](/sdk/relay-proxy), upgrade your Relay Proxy to version 9.0.0-rc.1 or later.

  2. Upgrade your Node.js (server-side) SDK to version 9.10 or later.

  3. Request to [join the Early Access Program](mailto:product@launchdarkly.com). Wait to receive confirmation from LaunchDarkly that data saving mode is enabled for your account.

  4. 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:

  #### Standard setup

  <CodeGroup>
    ```js title="Node.js (server-side) SDK v9.10+" theme={null}
          const ldClient = LaunchDarkly.init('YOUR_SDK_KEY', {
            dataSystem: {
              dataSource: {
                  dataSourceOptionsType: 'standard',

                  // if you use the stream, streamInitialReconnectDelay, or pollInterval options,
                  // these options are now part of the dataSystem options,
                  // and are set within the dataSource option
              }
              // if you use the persistentStore or useLDD option,
              // these options are now part of the dataSystem option
            }
          });
    ```
  </CodeGroup>

  We recommend the `standard` data source option 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.

  #### File-based bootstrap with live updates

  <CodeGroup>
    ```js title="Node.js (server-side) SDK v9.10+" theme={null}
          const ldClient = LaunchDarkly.init('YOUR_SDK_KEY', {
            dataSystem: {
              dataSource: {
                dataSourceOptionsType: 'custom',
                initializers: [
                  { type: 'file', paths: ['flags.json'] },
                  { type: 'polling' },
                ],
                synchronizers: [
                  { type: 'streaming' },
                  { type: 'polling' },
                ],
              }
            }
          });
    ```
  </CodeGroup>

  To learn more, read [`dataSystem`](https://launchdarkly.github.io/js-core/packages/sdk/server-node/docs/interfaces/LDOptions.html#dataSystem). For information on additional configuration options, read [`LDDataSystemOptions`](https://launchdarkly.github.io/js-core/packages/sdk/server-node/docs/interfaces/LDDataSystemOptions.html).
</Accordion>

### Python

<Accordion title="Expand Python SDK code sample">
  To enable data saving mode:

  1. If you are using the [Relay Proxy](/sdk/relay-proxy), upgrade your Relay Proxy to version 9.0.0-rc.1 or later.

  2. Upgrade your Python SDK to version 9.13 or later.

  3. Request to [join the Early Access Program](mailto:product@launchdarkly.com). Wait to receive confirmation from LaunchDarkly that data saving mode is enabled for your account.

  4. Update your SDK configuration to enable the `DataSystem` configuration option.

  Here's how to enable the `DataSystem` configuration option:

  #### Standard setup

  <CodeGroup>
    ```python title="Python SDK v9.13+" theme={null}
          import ldclient
          from ldclient.config import Config
          from ldclient import datasystem

          ldclient.set_config(
              Config(
                  "YOUR_SDK_KEY",
                  datasystem_config=datasystem.default().build(),
              )
          )

          client = ldclient.get()
    ```
  </CodeGroup>

  We recommend the standard data system configuration 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.

  #### Relay proxy with Launch

  Darkly API fallback

  <CodeGroup>
    ```python title="Python SDK v9.13+" theme={null}
          import ldclient
          from ldclient.config import Config
          from ldclient import datasystem

          relay_uri = "http://my-relay-proxy:8030"

          ldclient.set_config(
              Config(
                  "YOUR_SDK_KEY",
                  datasystem_config=datasystem.custom()
                      .initializers([
                          datasystem.polling_ds_builder().base_uri(relay_uri),
                          datasystem.polling_ds_builder(),
                      ])
                      .synchronizers(
                          datasystem.streaming_ds_builder().base_uri(relay_uri),
                          datasystem.streaming_ds_builder(),
                          datasystem.polling_ds_builder(),
                      )
                      .build(),
              )
          )

          client = ldclient.get()
    ```
  </CodeGroup>

  #### File-based bootstrap with live updates

  <CodeGroup>
    ```python title="Python SDK v9.13+" theme={null}
          import ldclient
          from ldclient.config import Config
          from ldclient import datasystem

          ldclient.set_config(
              Config(
                  "YOUR_SDK_KEY",
                  datasystem_config=datasystem.custom()
                      .initializers([
                          datasystem.file_ds_builder(paths=["flags.json"]),
                          datasystem.polling_ds_builder(),
                      ])
                      .synchronizers(
                          datasystem.streaming_ds_builder(),
                          datasystem.polling_ds_builder(),
                      )
                      .build(),
              )
          )

          client = ldclient.get()
    ```
  </CodeGroup>

  To learn more, read [`ldclient.datasystem`](https://launchdarkly-python-sdk.readthedocs.io/en/latest/api-main.html#module-ldclient.datasystem). For information on additional configuration options, read [`DataSystemConfig`](https://launchdarkly-python-sdk.readthedocs.io/en/latest/api-main.html#ldclient.config.DataSystemConfig).
</Accordion>

### Ruby

<Accordion title="Expand Ruby SDK code sample">
  To enable data saving mode:

  1. If you are using the [Relay Proxy](/sdk/relay-proxy), upgrade your Relay Proxy to version 9.0.0-rc.1 or later.

  2. Upgrade your Ruby SDK to version 8.12.0 or later.

  3. Request to [join the Early Access Program](mailto:product@launchdarkly.com). Wait to receive confirmation from LaunchDarkly that data saving mode is enabled for your account.

  4. Update your SDK configuration to enable the `data_system_config` configuration option.

  Here's how to enable the `data_system_config` configuration option:

  #### Standard setup

  <CodeGroup>
    ```ruby title="Ruby SDK v8.12.0+" theme={null}
          require 'ldclient-rb'

          config = LaunchDarkly::Config.new(
            data_system_config: LaunchDarkly::DataSystem.default.build
          )

          client = LaunchDarkly::LDClient.new("YOUR_SDK_KEY", config)
    ```
  </CodeGroup>

  We recommend the standard data system configuration 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.

  #### Relay proxy with Launch

  Darkly API fallback

  <CodeGroup>
    ```ruby title="Ruby SDK v8.12.0+" theme={null}
          require 'ldclient-rb'

          relay_uri = "http://my-relay-proxy:8030"

          config = LaunchDarkly::Config.new(
            data_system_config: LaunchDarkly::DataSystem.custom
              .initializers([
                LaunchDarkly::DataSystem.polling_ds_builder.base_uri(relay_uri),
                LaunchDarkly::DataSystem.polling_ds_builder,
              ])
              .synchronizers([
                LaunchDarkly::DataSystem.streaming_ds_builder.base_uri(relay_uri),
                LaunchDarkly::DataSystem.streaming_ds_builder,
                LaunchDarkly::DataSystem.polling_ds_builder,
              ])
              .build
          )

          client = LaunchDarkly::LDClient.new("YOUR_SDK_KEY", config)
    ```
  </CodeGroup>

  #### File-based bootstrap with live updates

  <CodeGroup>
    ```ruby title="Ruby SDK v8.12.0+" theme={null}
          require 'ldclient-rb'

          config = LaunchDarkly::Config.new(
            data_system_config: LaunchDarkly::DataSystem.custom
              .initializers([
                LaunchDarkly::Integrations::FileData.data_source_v2(paths: ['flags.json']),
                LaunchDarkly::DataSystem.polling_ds_builder,
              ])
              .synchronizers([
                LaunchDarkly::DataSystem.streaming_ds_builder,
                LaunchDarkly::DataSystem.polling_ds_builder,
              ])
              .build
          )

          client = LaunchDarkly::LDClient.new("YOUR_SDK_KEY", config)
    ```
  </CodeGroup>

  To learn more, read [`LaunchDarkly::DataSystem`](https://launchdarkly.github.io/ruby-server-sdk/LaunchDarkly/DataSystem.html). To learn more about additional configuration options, read [`DataSystem::ConfigBuilder`](https://launchdarkly.github.io/ruby-server-sdk/LaunchDarkly/DataSystem/ConfigBuilder.html).
</Accordion>
