Slide 1

Slide 1 text

Feature Flags & Toggles Marqeta Tech Talks

Slide 2

Slide 2 text

Who? Manish Pandit Engineering

Slide 3

Slide 3 text

Title? Feature Flags == Feature Toggles

Slide 4

Slide 4 text

Feature Toggles Feature Toggles are a powerful technique, allowing teams to modify system behavior without changing code Source: https://martinfowler.com/articles/feature-toggles.html

Slide 5

Slide 5 text

Meh.. We’ve all used them

Slide 6

Slide 6 text

if (allowBackgroundRefresh) { initializeBackgroundRefresh(5, TimeUnit.SECONDS); }

Slide 7

Slide 7 text

if (logLevel == LogLevel.DEBUG) { Console.log(“This should not be here”); }

Slide 8

Slide 8 text

if (referenceNumber%2==0) { return shard1; } else return shard2;

Slide 9

Slide 9 text

Deconstructing a Feature Toggle Toggle Configuration = on/off | env | user id(s) | geo | time | …. (Stored in config-file | database | env-var | in the code | FTaaS) Toggle Context = env | user id(s) | geo | time | logged-in-state | tenant-id | … Toggle Router = reads the toggle configuration + context to determine which toggle point to activate Toggle Point = execution path(s) for the toggle state(s)

Slide 10

Slide 10 text

Think about it! Does the storage location of a Toggle Configuration affect when it can be toggled?

Slide 11

Slide 11 text

Think about it! Does the storage location of a Toggle Configuration affect when it can be toggled? build | deploy | startup | runtime

Slide 12

Slide 12 text

Types of Feature Toggles

Slide 13

Slide 13 text

Release Toggles

Slide 14

Slide 14 text

Release Toggles

Slide 15

Slide 15 text

Release Toggles Decouple releases from deployments Referred a lot in the context of Continuous Integration (CI) Allow for large feature branches to be merged in master Long lived (based on how long the feature branches take - weeks? months?)

Slide 16

Slide 16 text

Experiment Toggles

Slide 17

Slide 17 text

A/B Testing

Slide 18

Slide 18 text

Experiment Toggles Used to gather data to help pick the right feature (Mostly) used with end user interaction use cases (Can also be) used to tune system performance Short lived (weeks)

Slide 19

Slide 19 text

Operational Toggles

Slide 20

Slide 20 text

Operational Toggles Used to turn off features to control unknowns/unexpected Almost exclusively used in Production Short lived (days) till a baseline is established Can be lifetime (kill switches!) Help with graceful degradation

Slide 21

Slide 21 text

Permission Toggles

Slide 22

Slide 22 text

Permission Toggles Used to change behavior for a partial set of users May need to evaluate the user authorizations Canary, or incremental rollouts Beta, Early Adopters (or Early Winners as we call ‘em!) Can be very short (hours) or long (lifetime) lived

Slide 23

Slide 23 text

Summary Source : https://martinfowler.com/articles/feature-toggles.html

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Pick the right place to store the toggle configuration (Ask the audience if they remember the storage options!)

Slide 26

Slide 26 text

Do not name your toggles after pets, food, places..you get the point Follow a naming convention

Slide 27

Slide 27 text

Use feature flags in moderation, use your best judgement

Slide 28

Slide 28 text

Feature flags can turn into technical debt real quick - delete them once not in use. Hint : If a transient flag has been in the same state for a long time, it is not needed.

Slide 29

Slide 29 text

Have an audit trail of any changes to Toggle configuration - treat it like sensitive data

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Let the experts do it for us!

Slide 32

Slide 32 text

Launchdarkly Feature Management as a Service https://launchdarkly.com/

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Don't worry, these keys are duds by the time you’re seeing ‘em :)

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

Resources Feature Toggles (aka Feature Flags) : https://martinfowler.com/articles/feature-toggles.html When Feature flags go bad - Edith Harbaugh : https://www.youtube.com/watch?v=28ZAoStv-Xw Getting Started with Feature Flags - #1 LaunchDarkly Feature Flags : https://www.youtube.com/watch?v=pwA_Ehp2SMY

Slide 44

Slide 44 text

Fin.