Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Feature Toggle Makes Development Faster and Safer @ TECHPULSE 2023

Feature Toggle Makes Development Faster and Safer @ TECHPULSE 2023

- Speaker: Euni Cheng
- Event: https://techpulse.line.me/

Feature toggle 是一種無需調整程式碼來更改系統行為的方法,幫助團隊快速且安全地向用戶提供新功能。本次將案例分享如何使用 Feature toggle 讓團隊可以在主分支上開發並且持續交付,以及介紹 Flagr 開源工具當中的架構與演算法,如果你也在關注如何提升產品體驗,歡迎前來聆聽!

LINE Developers Taiwan

February 21, 2023

More Decks by LINE Developers Taiwan

Other Decks in Technology


  1. 1

  2. What Is Feature Toggle Feature toggle is if/else controls in

    your code. Easily manage features without pushing a change. 2 A task: To enhance the daily lottery algorithm def old_daily_lottery_alg: # current implementation lives here def new_daily_lottery_alg: # TODO: implement better lottery alg Code without using feature toggle def daily_lottery_logic: # SWITCH TO TRUE IF YOU ARE WORKING ON THE NEW LOTTERY ALG use_new_alg = False if use_new_alg: new_daily_lottery_alg() else: old_daily_lottery_alg() Code using feature toggle def daily_lottery_logic: if feature_is_enabled("new_lottery_alg"): new_daily_lottery_alg() else: old_daily_lottery_alg()
  3. Use Case for E-commerce Use feature toggle to improve flexible

    developing schedule. 3 5/1 Complete code 5/3 Release data 5/5 Release data 5/6 Release data With Feature Toggle 5/1 Deploy code API related to client A API related to client B API related to client C 5/6 Deploy code Blocked by 3rd party services Feature Release Code Deployment Without Feature Toggle API related to client A API related to client B API related to client C A B C A B C
  4. Use Case for E-commerce Incrementally and safely release a new

    feature to your users 4 Engineering Sales Product EC Team Release Feedback Feature Toggle FEEDBACK LOOP PERCENTAGE ROLLOUT(%) 30%
  5. The Concept of Distributing Users Take the unique user ID,

    hash it using a hash function that has a uniform distribution and then mod bucket number. 5 Distribution ON OFF 0~299 300~999 Algorithm Uid: A1234 Hashed Uid: 2615402659 [0, 999] 659 Con fi g Variants: - On - Off Segment 1(All users): - Constraint: None - Rollout Percentage: 30%
  6. Use Case for E-commerce More than on/off, we can set

    multi-variants, such as red, green and blue. 6 Result Segment(s) On Off if (variant == "on") { [SHOW FEATURE] } if (variant == "off") { [NOT SHOW FEATURE] } Your Code Variants Randomly choose 20% of users to see shopping cart. VIP Golden Normal Red Blue Green if (variant == "red") { [SHOW RED PAGE] } if (variant == "blue") { [SHOW BLUE PAGE] } if (variant == "green") { [SHOW GREEN PAGE] } Show different page color to different membership.
  7. Toggle CRUD Life Cycle Retiring toggles to avoiding technical debt!

    8 • Development team create toggles when required. • Application read or expose toggled feature when they are switched ON. • Development team update toggled features when they are buggy. • A semi-automated process to destroy or remove toggles when job is done. Source: Feature Toggles (aka Feature Flags)
  8. Why FT makes development faster and safer? 9 Feature Release

    Code Deployment • Modify system behavior without changing code • Test a new feature without needing a separate testing environment. • Reduce release risk with an instant kill switch.