• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
No results for ""


Persistent data stores

Read time: 2 minutes
Last edited: Oct 21, 2021


This topic explains what a persistent feature store is and how a persistent feature store can keep flag data.

In their default configuration, LaunchDarkly's server-side SDKs:

  • connect to LaunchDarkly and receive feature flag data
  • store the flags in memory
  • update the in-memory state if LaunchDarkly sends updates

Flag evaluations always refer to the last known state in memory. This collection of last known flag data is cached in the "feature store" or "data store."

Alternatively, you can use a database for the feature store. Most of the server-side SDKs support Redis, DynamoDB, and Consul for this purpose.

Whichever database you use, there are two ways to use it:

  • Exactly like the default configuration, except substituting a database for the in-memory store, or
  • Using only the database as a source of flag data, without connecting to LaunchDarkly.

Using a persistent feature store while still connecting to LaunchDarkly

In this configuration, the SDK receives feature flag data from LaunchDarkly and puts it in the feature store. The only difference is that the store is in a database.

When flags are evaluated, the SDK checks the database to get the latest flag state, usually with some form of in-memory caching to improve performance.

The main reason to do this is to accelerate flag updates when your application has to restart, and after restarting, it takes longer to establish a connection to LaunchDarkly than you want. If you have a persistent feature store that has already been populated, the SDK can still evaluate flags using the last known flag state from the store until newer data is available from LaunchDarkly.

To set up this configuration, most people create some kind of object for the specific type of database and put it in the client configuration's feature store property. For example, in PHP, this property is called the "feature requester".

To see code samples for specific SDKs, read Storing data.

If there are multiple instances of your application configured in this way with the same database, the same data gets written to the database multiple times, because each instance receives feature flags from LaunchDarkly. This is harmless but inefficient, so you may want to use a persistent feature store without connecting to LaunchDarkly, as described below.

Using a persistent feature store without connecting to LaunchDarkly

This is similar to the previous configuration, except that the SDK does not connect to LaunchDarkly at all. Instead, it relies on some other process which does have a LaunchDarkly connection to write the latest flag data to the database, where the SDK will then read it.

The other process could be the Relay Proxy in offline or daemon mode, or any other application that creates a SDK client with the same persistent store. To learn more about the Relay Proxy, read The Relay Proxy.

Since the Relay Proxy is also known as the LaunchDarkly Daemon, some versions of the SDKs refer to this mode as "LDD mode." Creating the client is the same as above in terms of specifying the persistent store, but you must also add an option to make the SDK not connect to LaunchDarkly.

To see code samples for specific SDKs, read Storing data.