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
29
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
31
Feature Flag Use Cases You Haven't Heard About Yet
jkebertz
0
36
So You Want to Split Your Monolith: First Steps
jkebertz
0
37
How to Split a Monolith: Service Architecture & Domain-Driven Design (DDD)
jkebertz
0
450
Splitting a Monolith Using Feature Flags
jkebertz
0
91
Other Decks in Technology
See All in Technology
Delegate authentication and a lot more to Keycloak with OpenID Connect
ahus1
0
240
マイクロモビリティシェアサービスを支える プラットフォームアーキテクチャ
grimoh
1
130
AIが住民向けコンシェルジュに?Amazon Connectと生成AIで実現する自治体AIエージェント!
yuyeah
0
240
20250818_KGX・One Hokkaidoコラボイベント
tohgeyukihiro
0
130
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
2
20k
RAID6 を楔形文字で組んで現代人を怖がらせましょう(実装編)
mimifuwa
0
200
AIエージェントの開発に必須な「コンテキスト・エンジニアリング」とは何か──プロンプト・エンジニアリングとの違いを手がかりに考える
masayamoriofficial
0
120
Telemetry APIから学ぶGoogle Cloud ObservabilityとOpenTelemetryの現在 / getting-started-telemetry-api-with-google-cloud
k6s4i53rx
0
170
結局QUICで通信は速くなるの?
kota_yata
9
7.5k
形式手法特論:位相空間としての並行プログラミング #kernelvm / Kernel VM Study Tokyo 18th
ytaka23
3
1.6k
React Server ComponentsでAPI不要の開発体験
polidog
PRO
1
360
20250807 Applied Engineer Open House
sakana_ai
PRO
2
690
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
Mobile First: as difficult as doing things right
swwweet
223
9.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
Fireside Chat
paigeccino
39
3.6k
Designing for humans not robots
tammielis
253
25k
How STYLIGHT went responsive
nonsquared
100
5.7k
A Modern Web Designer's Workflow
chriscoyier
695
190k
How to train your dragon (web standard)
notwaldorf
96
6.2k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
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!