Runtime Flashcards
What is Runtime?
A repo where we store configuration settings that get mirrored to all pods. Runtime lets us have different code behavior in different environments, roll out changes to a percentage of users, or rapidly disable a feature without having to go through an entire service deploy.
Intended Use of Runtime
The runtime configuration system is meant to make small amounts of eventually consistent, infrequently-changing configuration data available to your service fleet, such as feature flags and kill switches.
Common interaction with Runtime
The most common way for an engineer to interact with runtime is by adding data, making sure it gets deployed, and using that data in their service. Go back to the runtime repo and get a sense of how you would do that.
How do you add data to runtime?
Make a PR on the runtime service that modifies an existing runtime file or creates a new config file. Then merge the PR and it will be deployed automatically.
What do you have to do to trigger an automatic runtime deploy?
Merge a PR in the runtime repo.
What kinds of things live in runtime?
Configuration settings like feature flags, killswitches, and other config data that are checked by other services while they’re executing code (“at runtime”).
Why doesn’t a service (like favoriteemoji) need to be deployed again to use an updated runtime value?
Whenever runtime is deployed, the /data directory in the runtime service is copied onto the file system on each production box. Services like favoriteemoji reference that value when accessing runtime data.
What is a Configset?
A configset is a logical grouping of configuration settings (i.e by service or function) which is deployed as a single unit. It is the preferred mechanism of configuration of settings which must be tunable at runtime.
Configsets are effectively a concept — a configset is any set of folders and files that follows the configset format, a standardized way of structuring and naming sets of files that represent some sort of configuration.
What is the configset format?
A directory structure with nesting folders for service name, environment (e.g. default or staging), type (e.g. documents or feature flag), and then actual config files.
When a service accesses the value of a runtime flag, what determines the folder it reads from? (out of /development, /staging, /production, and /default)
The service will look in whichever folder matches its environment variable first (/development, /staging, or /production), and if no value is found, it will read from /default.
What is a standalone configset?
It’s not part of runtime, but it’s still a configset, because it has a /data folder that follows the configset format. It also has some custom setup that allows other services to access its data the same way they access configset data in runtime.
The most common pieces of data that engineers need to add, change, or remove are ________
Feature flags
What is a feature flag?
A config setting that lets you quickly enable or disable some behavior in your service, which is especially useful for new feature that are large, complex, or risky.
List 3 Best Practices for Feature Flags
- It’s a best practice to use a percentage and not a boolean to allow for progressive rollouts.
- A feature flag should be turned on for users gradually over the course of hours or days.
- You should write unit tests to validate how your code behaves for any value of the feature flag.
How do you enable a feature flag on staging without enabling it on production?
The best practice is to make a file in /default that’s set to 100 and another file in /production that’s set to 0.