Read configs

The key benefit of using Lekko is the ability to configure apps and services dynamically. For this to work, it is crucial that apps can read configs anytime.

In practice, you read configs (more precisely, request config evaluations) in your app using one of the language- and framework-specific Lekko SDKs that ensure minimal downtime and efficient config evaluations.

In addition to serving config values to your app, SDKs report evaluation events to the Lekko backend. Evaluation events power metrics-based features such as usage tracking, staleness detection, and context key suggestions.

If the Lekko backend is unavailable, some events can be lost and these metrics-based features can function incorrectly. However, the critical ability of apps to read configs isn't affected.

The following sections explain the different operating modes of Lekko’s SDK clients and the redundancy measures that ensure configs are delivered to your apps with minimal downtime.

Evaluation methods

Lekko supports two ways to evaluate contexts:

  • Local evaluation means that the app retrieves config values from Lekko servers once (usually at startup), serves them from an in-memory cache, and periodically reaches out to Lekko servers for updates. If the backend is unavailable, configs are served from memory until reconnected.
  • Remote evaluation means that the app always reaches out to Lekko servers when it needs to read config values.

In most cases, Lekko recommends local evaluation. This ensures that config evaluations have minimal overhead. An important failure case to consider when using local evaluation is startup dependency for deploys and restarts of existing deployments while Lekko is unavailable. For more information, see Advanced fallback modes.

Remote evaluation ensures that config values are always up-to-date. However, it means higher latency per evaluation because the app sends a request to a remote resource each time it needs to read config values. Remote evaluation also means that you need to handle failures when the Lekko backend is unavailable. This evaluation method is recommended in cases where the freshness of the config values is more important than availability and performance, or you don’t want to explore the full configuration definition to the process.

Performance

Lekko’s internal tests on the server-side Python SDK show high evaluations per second (QPS) with minimal memory and CPU usage.

Average QPSAverage memory usage
t2.micro EC2~22k~24MB
M2 Macbook~49k~50MB

Tests of the client-side JavaScript and React SDKs show minimal impact on browser resources, with efficient memory usage and rendering latency.