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
380
Splitting a Monolith Using Feature Flags
jkebertz
0
88
Other Decks in Technology
See All in Technology
能動的ドメイン名ライフサイクル管理のすゝめ / Practice on Active Domain Name Lifecycle Management
nttcom
0
250
Working as a Server-side Engineer at LY Corporation
lycorp_recruit_jp
0
370
Storage Browser for Amazon S3
miu_crescent
1
290
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
200
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
180
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
120
レンジャーシステムズ | 会社紹介(採用ピッチ)
rssytems
0
280
.NET 9 のパフォーマンス改善
nenonaninu
0
1.3k
クレカ・銀行連携機能における “状態”との向き合い方 / SmartBank Engineer LT Event
smartbank
2
100
[Oracle TechNight#85] Oracle Autonomous Databaseを使ったAI活用入門
oracle4engineer
PRO
1
110
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
340
pg_bigmをRustで実装する(第50回PostgreSQLアンカンファレンス@オンライン 発表資料)
shinyakato_
0
110
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
The Language of Interfaces
destraynor
154
24k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
For a Future-Friendly Web
brad_frost
175
9.4k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
450
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Agile that works and the tools we love
rasmusluckow
328
21k
Site-Speed That Sticks
csswizardry
2
190
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.6k
GraphQLとの向き合い方2022年版
quramy
44
13k
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!