Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Splitting Your Monolith with Feature Flags: A G...
Search
Joy Ebertz
September 02, 2021
Technology
0
28
Splitting Your Monolith with Feature Flags: A Guided Tour
The version used Sept 1, 2021 for the SAP event.
Joy Ebertz
September 02, 2021
Tweet
Share
More Decks by Joy Ebertz
See All by Joy Ebertz
How Much Should Staff+ Code? StaffPlus NYC 2023
jkebertz
0
190
Elevate_23_Advanced_FF_Usecases.pdf
jkebertz
0
29
Feature Flag Use Cases You Haven't Heard About Yet
jkebertz
0
35
So You Want to Split Your Monolith: First Steps
jkebertz
0
36
How to Split a Monolith: Service Architecture & Domain-Driven Design (DDD)
jkebertz
0
390
Splitting a Monolith Using Feature Flags
jkebertz
0
88
Other Decks in Technology
See All in Technology
comilioとCloudflare、そして未来へと向けて
oliver_diary
5
400
Accessibility Inspectorを活用した アプリのアクセシビリティ向上方法
hinakko
0
160
OPENLOGI Company Profile
hr01
0
58k
Building Scalable Backend Services with Firebase
wisdommatt
0
110
The future we create with our own MVV
matsukurou
0
1.8k
あなたの人生も変わるかも?AWS認定2つで始まったウソみたいな話
iwamot
3
780
2025年の挑戦 コーポレートエンジニアの技術広報/techpr5
nishiuma
0
120
デジタルアイデンティティ人材育成推進ワーキンググループ 翻訳サブワーキンググループ 活動報告 / 20250114-OIDF-J-EduWG-TranslationSWG
oidfj
0
360
LangGraphとFlaskを用いた社内資料検索ボットの実装②Retriever構築編
aoikumadaki
0
110
エンジニアリングマネージャー視点での、自律的なスケーリングを実現するFASTという選択肢 / RSGT2025
yoshikiiida
4
3.4k
三菱電機で社内コミュニティを立ち上げた話
kurebayashi
1
320
I could be Wrong!! - Learning from Agile Experts
kawaguti
PRO
8
3k
Featured
See All Featured
A Tale of Four Properties
chriscoyier
157
23k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Being A Developer After 40
akosma
89
590k
Building Adaptive Systems
keathley
38
2.3k
4 Signs Your Business is Dying
shpigford
182
22k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
120k
VelocityConf: Rendering Performance Case Studies
addyosmani
327
24k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Transcript
A Guided Tour Splitting Your Monolith with Feature Flags Joy
Ebertz Sr Staff Engineer
Agenda • Why split a monolith? • Strategies for Splitting
a Monolith • Challenges of Splitting a Monolith • What are feature flags? • How can feature flags help?
Why Should We Split a Monolith?
What do I mean by “Splitting a Monolith?”
None
None
None
None
None
None
Why Split a Monolith? Code Entanglement
None
None
None
None
None
Unclear Ownership
None
None
None
None
Deployment Problems
Build Test Deploy
Build Test Deploy
Build Test Deploy
Build Test Deploy
Build Test Deploy
Build Test Deploy
None
None
None
None
10% 10% 10% Deploy 72% Chance Of Success
10% 10% 10% Deploy 53% Chance Of Success 10% 10%
10%
10% 10% 10% Deploy 28% Chance Of Success 10% 10%
10% 10% 10% 10% 10% 10% 10%
Deploy 1% Chance Of Success
Deploy
Deploy
Deploy
Deploy
Issue Remediation
Deploy
Strategies for Splitting a Monolith
Big Bang Pattern
Big Bang Pattern Old Application
Big Bang Pattern New Application Old Application
Big Bang Pattern New Application Old Application
Big Bang Pattern New Application Old Application
Big Bang Pattern Advantages • Easier to remove features •
Less Transition State Work
Strangler Fig Pattern Martin Fowler
Strangler Fig Pattern Old Application
Strangler Fig Pattern Old Application
Strangler Fig Pattern Old Application
Strangler Fig Pattern Old Application
Strangler Fig Pattern Old Application New Application
Strangler Fig Pattern Advantages • Less Risk • Lower time
to first benefit • Easier to sell
None
None
Where to Start
Service Map
Requests Monolith logic
Requests Monolith logic Interface
Requests Monolith logic New Microservice Interface Interface
Requests Monolith logic New Microservice Interface Interface
Requests Monolith logic New Microservice Interface Interface
What should my first service be?
First Services Edges
First Services BFF (Backend for Frontend) or Application Services
First Services BFF Application Service Application Service Application Service
First Services Problematic Functionality
First Services Infrastructure Services Authentication
First Services Infrastructure Services Authentication Event Bus
First Services Infrastructure Services Authorization Authentication Event Bus
First Services New Features
First Services Things Undergoing Major Changes
First Services • Low Dependencies • Backend for Frontend •
Unusual usage patterns • Infrastructure Components • New Features • Major Remodels
Challenges of Splitting a Monolith
None
Original Code Tangled
None
Entirely Separate Talk
Trying to Replicate Functionality
Entirely New Infrastructure
Entirely New Infrastructure
RISKY
So, how can we mitigate the risks?
What Are Feature Flags?
Other Terms • Feature Toggle • Feature Flip • Feature
Switch • Conditional Feature • Split
Code Branch Controlled by GUI
Code Sample if (Treatments.ON .equals(_splitClient.getTreatment(orgId, Splits.MY_FEATURE.name()))) { // Do Something
} else { // Do Something Else }
None
Code Sample if (Treatments.ON.equals(_splitClient.getTreatment(orgId, Splits.MY_FEATURE.splitName()))) { // Do Something }
else { // Do Something Else }
Main Use-Cases
Main Use-Cases • Releasing features
Main Use-Cases • Releasing features • Production Testing
Main Use-Cases • Releasing features • Production Testing • A/B/C
Testing
Main Use-Cases • Releasing features • Production Testing • A/B/C
Testing • Custom Packages
Main Use-Cases • Releasing features • Production Testing • A/B/C
Testing • Custom Packages • Temporary UI Customization
Main Use-Cases • Releasing features • Production Testing • A/B/C
Testing • Custom Packages • Temporary UI Customization
Releasing Features • Separating Deploy from Release • Canary/Ramped Deployment
• Off Switch
Deploy Release
</>
</> User
Prod User
Prod User
Prod Developer
Prod Developer
Prod User
Prod User Split
Prod User Split OFF OFF
Prod User Split OFF
Prod User Split OFF
Prod Split Product Owner OFF
Prod Split Product Owner ON
Prod User Split ON
Prod User Split ON
Prod User Split ON
Prod User Split ON
Prod Developer
Prod Developer
Prod User Split 10%
Prod User Split 20%
None
None
Using Feature Flags to Split a Monolith
Minimize Move
Remove Dead Code
Why is your code dead?
Why is your code dead? Method no longer referenced
Why is your code dead? Method no longer referenced Endpoint
never called
Why is your code dead? Method no longer referenced Parameter
never has certain values Endpoint never called
None
log.info(“CODE NOT DEAD UID: 12345”);
None
private void logForCleanup(String orgId, String uid) { if (Treatments.ON .equals(_splitClient.getTreatment(orgId,
Splits.CLEANUP.name()))) { String message = String.format(“CODE NOT DEAD UID: %s”, uid); log.info(message); } }
private void logForCleanup(String orgId, String uid) { if (Treatments.ON .equals(_splitClient.getTreatment(orgId,
Splits.CLEANUP.name()))) { String message = String.format(“CODE NOT DEAD UID: %s”, uid); log.info(message); } } Turn on CLEANUP split to 1%
1. Roll out to 1%
1. Roll out to 1% 2. Remove any lines hit
1. Roll out to 1% 2. Remove any lines hit
3. Roll out to 5%
1. Roll out to 1% 2. Remove any lines hit
3. Roll out to 5% 4. Remove any lines hit
1. Roll out to 1% 2. Remove any lines hit
3. Roll out to 5% 4. Remove any lines hit 5. Roll out to 100% (leave here as long as makes you comfortable)
1. Roll out to 1% 2. Remove any lines hit
3. Roll out to 5% 4. Remove any lines hit 5. Roll out to 100% (leave here as long as makes you comfortable) 6. Remove any code that hasn’t been hit
None
Stress Test Your New Systems
None
Requests Monolith logic New Microservice Mirrored Traffic
Requests New Microservice Mirrored Traffic Feature Flag Check Monolith logic
Requests New Microservice Mirrored Traffic Feature Flag Check Monolith logic
Requests New Microservice Mirrored Traffic Feature Flag Check Monolith logic
Verify Parity
Requests New Microservice Feature Flag Parity Check Monolith logic
Requests New Microservice Feature Flag Parity Check Monolith logic
Requests New Microservice Feature Flag Parity Check Monolith logic
Requests New Microservice Feature Flag Parity Check Monolith logic
Requests New Microservice Feature Flag Parity Check Monolith logic Log
if different
Requests New Microservice Feature Flag Parity Check Monolith logic Log
if different
Requests New Microservice Feature Flag Parity Check Monolith logic Log
if different
• Treatments.OLD
• Treatments.OLD • Treatments.NEW
• Treatments.OLD • Treatments.NEW • Treatments.MIRROR
• Treatments.OLD • Treatments.NEW • Treatments.MIRROR • Treatments.PARITY
• Treatments.OLD • Treatments.NEW • Treatments.MIRROR • Treatments.PARITY Default OFF
treatment
Requests New Microservice Monolith logic Treatments.OLD
Requests New Microservice Monolith logic Treatments.NEW
Requests New Microservice Mirrored Traffic Monolith logic Treatments.MIRROR
Requests New Microservice Monolith logic Treatments.PARITY Parity Check
Slowly Roll Over Traffic
Slowly Roll Over Traffic Test Traffic Only
Slowly Roll Over Traffic Internal Users
Slowly Roll Over Traffic 1%
Slowly Roll Over Traffic Free Users
Slowly Roll Over Traffic
Summary • Why split a monolith? • Strategies for Splitting
a Monolith • Challenges of Splitting a Monolith • What are feature flags? • How can feature flags help? • Remove dead code • Load test • Parity check • Gradual roll out/kill switch
What Are Feature Flags? Joy Ebertz @jkebertz Thank You!