31,19 €
Over the past few years, DevOps has become the de facto approach for designing, building, and delivering software. Feature management is now extending the DevOps methodology to allow applications to change on demand and run experiments to validate the success of new features. If you want to make feature management happen, LaunchDarkly is the tool for you.
This book explains how feature management is key to building modern software systems. Starting with the basics of LaunchDarkly and configuring simple feature flags to turn features on and off, you'll learn how simple functionality can be applied in more powerful ways with percentage-based rollouts, experimentation, and switches. You'll see how feature management can change the way teams work and how large projects, including migrations, are planned. Finally, you'll discover various uses of every part of the tool to gain mastery of LaunchDarkly. This includes tips and tricks for experimentation, identifying groups and segments of users, and investigating and debugging issues with specific users and feature flag evaluations.
By the end of the book, you'll have gained a comprehensive understanding of LaunchDarkly, along with knowledge of the adoption of trunk-based development workflows and methods, multi-variant testing, and managing infrastructure changes and migrations.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 408
Veröffentlichungsjahr: 2021
Discover safe ways to make live changes in your systems and master testing in production
Michael Gillett
BIRMINGHAM—MUMBAI
Copyright © 2021 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Group Product Manager: Aaron Lazar
Publishing Product Manager: Harshal Gundetty
Senior Editor: Ruvika Rao
Content Development Editor: Vaishali Ramkumar
Technical Editor: Pradeep Sahu
Copy Editor: Safis Editing
Project Coordinator: Deeksha Thakkar
Proofreader: Safis Editing
Indexer: Sejal Dsilva
Production Designer: Vijay Kamble
First published: September 2021
Production reference: 1230921
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-80056-297-4
www.packt.com
To my family, for their constant advice and support, without which I would not be where I am today. I hope this book sheds some light on what I do in my job.
– Michael Gillett
Writing a foreword to a book about using the software of the company you cofounded veers dangerously close to "going to a concert and wearing the band's t-shirt" levels of cheerleading. The opportunity here is worth it though – as the CTO and cofounder of LaunchDarkly, I've seen firsthand the transformative impact feature management can have on an organization shifting to a digital-first world. Engineering leaders have told me that feature management has revolutionized the way they deliver software. I've seen data quantitatively demonstrating the positive change feature management has on the speed and quality of software delivery in hundreds of organizations.
I've also seen the exact opposite reaction to the idea of feature management. Transformative impact? Revolutionary change? We're talking about feature flags. They're just if statements in code, right? Why would such a simple concept need a third-party tool or a full-fledged book? One of my favorite Hacker News comments about LaunchDarkly sums up the sentiment well – "Isn't this just… a hash table?" Or, even better: "Is there really a venture-backed company out there doing booleans as a service?"
What I've come to learn from founding LaunchDarkly is that both sides are right – and that's what makes feature management worth learning about. Feature flags are incredibly simple, and yet, they can transform the way you develop software.
There's no better way to learn this than from someone that's lived it firsthand.
Michael was one of the earliest customers of LaunchDarkly, having started using the platform in 2016. As such, he brings a unique perspective to his book – that of a long-time user who's been along for the entire journey, from the decision to bring in a feature management solution, to initial adoption, to widespread rollout and steady-state use. This perspective is what makes his book so powerful – Michael's writing combines his many years of experience with the LaunchDarkly platform with his deep understanding and insight into the value of feature management.
Michael's book is a helpful guide for anyone considering or currently adopting feature management. If you're at the beginning of your journey, you'll find answers to your questions about the business value of feature management. You'll get a tour of the most common use cases for feature management – from mitigating risk with kill switches to building a practice of experimentation. You'll discover what capabilities you need in a feature management platform upfront – not just today's needs, but the needs that you'll eventually grow into as your practice evolves. Finally, you'll learn how to best set up and structure the LaunchDarkly platform for your organization from the outset – following best practices learned over years of experience.
Michael's book is one of the most complete resources on LaunchDarkly that I've seen. I'm confident that after reading his work, you'll come to the same conclusion that I have – that feature management is both incredibly simple and incredibly powerful, and will soon be a standard practice for any modern software development team.
John Kodumal
CTO and cofounder of LaunchDarkly
Michael Gillett is a head of development and a full-stack software engineer residing in London, UK. He has worked with feature management and LaunchDarkly for several years and has defined processes and techniques to enable teams to get the most from this approach to software delivery. He often talks on this subject at conferences and events.
Michael graduated from the University of Hertfordshire with an MSc in computer science and a BEng in electrical and electronic engineering in 2012. Since 2012 Michael has been a Microsoft MVP, currently in the Windows Insider category.
I want to thank all those who have supported and encouraged me throughout the process of authoring this book, especially my parents and brother. I want to thank all those at Packt for this opportunity and for your help and feedback during the development of this book, including the technical reviewers, Dawn and Daniel.
Dawn Parzych is a developer marketing manager at LaunchDarkly where she helps developers ship code fast and safely. She specializes in the socio-technical aspects of technology and how humans are often the hardest part. Her career in tech has included roles with companies such as Catchpoint and F5. Her mission is to make tech more accessible and inclusive by using straightforward language and fewer buzzwords. Dawn recently relocated from the Pacific Northwest to the Midwest and she's slowly adjusting to life without mountains and oceans.
Daniel Yefet has more than 10 years of experience in web development and is currently working as a lead developer in a London-based technology company. He focuses on web performance and experimentation using technology within the JavaScript ecosystem, such as Node.js and React. In his spare time, he loves spending time with his wife and kids, playing music, and coding!
This first section provides an overview of the modern software development landscape and introduces where feature management and LaunchDarkly fit within it. The section provides examples of how feature management can enhance the DevOps methodology to make deploying code and releasing new features safer and more effective. The final topic that this section covers is how LaunchDarkly can be implemented in an application and how feature flags can be used.
This section comprises the following chapters:
Chapter 1, Introductionto Feature Management with LaunchDarklyChapter 2, Overview of Feature ManagementChapter 3, Basics of LaunchDarkly and Feature ManagementWelcome to this journey of feature management discovery. Throughout 13 chapters, we will explore what feature management is and learn how to use LaunchDarkly to get the most out of it. Feature management is the name given to the process of changing the elements of a system without making changes to an application's code base. This is not a new concept. However, there are modern ways to achieve feature management, and LaunchDarkly is a tool that enables our teams to make changes at runtime for specific applications, users, or all customers.
Feature management and LaunchDarkly empower us to change systems quickly, easily, and without risk to help deliver new features, deal with service incidents, and migrate systems.
In this chapter, I will introduce you to, and briefly explain, the modern software development landscape with regard to best practices for DevOps and robust Continuous Integration/Continuous Delivery (CI/CD) pipelines and processes. Next, we will look at where feature management fits within this practice and how it can be embedded effectively and efficiently within CI/CD processes.
This context will lay the groundwork for this book to explain what feature management is, how best to use LaunchDarkly, and what can be achieved by adopting an approach to building software that relies on feature management.
This chapter covers the following topics:
Understanding modern software developmentWhere does feature management come from?Feature management within CI/CDBy the end of this chapter, you will have a better understanding of how feature management fits within a modern approach to software delivery and how it can improve good DevOps and CI/CD practices.
Recent years have seen the move to a more modern approach to software development, with DevOps being increasingly used across many industries. DevOps is best described by Microsoft as the union of people, processes, and technology to continually provide value to customers.
DevOps has ushered in the era of working where teams are more empowered than ever before, with ownership across the whole development life cycle of both code and products. This includes managing the production environment, previously the domain of the Operations team. The annual State of DevOps Report (available in the Further reading section; registration is required) shows that teams adopting DevOps are delivering higher quality code faster and more reliably than ever before.
While there are other approaches to working with software, DevOps is perhaps the most popular and has proven success. I will assume that this approach is how you are building and deploying software too. Before explaining feature management or even getting started with LaunchDarkly, I want to share a brief overview of DevOps to highlight where feature management can really add value.
DevOps is not just a practice of writing code but a comprehensive approach to defining, designing, and delivering software. It can be defined into four key areas within the application life cycle: planning, developing, delivering, and operating. I will describe these areas within the context of where feature management can be factored in later:
Planning: Within this stage, the team works to understand the problems to solve, reviews the available data, and creates ideas and plans for features to improve their system and to add more value for their customers.Developing: In this stage, the features are implemented and checked against quality measures to ensure that the planned feature will work to deliver the expected functionality.Delivering: When in the delivering phase, the implemented feature goes through the build and release pipelines, ultimately to be deployed to the production environment to realize the expected value. Ideally, the release process uses CI/CD pipelines and is automated to an extent that is possible. These pipelines can often deploy the feature to several environments before it's deployed to production to validate that the system remains functional with no regressions.Operating: Once the feature is in production, it needs to be monitored and the data needs to be analyzed to ensure that the feature works as expected and delivers the planned value. This requires a mature implementation of monitoring, with the team also relying on this data to alert them to issues before they impact the customers. At this point, the data can be used as feedback in the planning phase to allow the team to identify new features and work to deliver additional value.The aforementioned phases of the DevOps life cycle are highly effective at improving the processes of software delivery but aren't the whole practice of DevOps. Next, we will look at the culture that needs to go alongside these stages to make DevOps truly effective.
Successfully adopting a good DevOps practice is more than just following processes and procedures. It is also about adopting a culture that allows constant improvements to be made to the methodology. Microsoft defines the DevOps culture as having four key areas (available in the Further reading section). Again, I will explain only the areas that come within the scope of feature management:
Collaboration, visibility, and alignment: For teams to be successful, they must be able to collaborate and communicate well to better understand and define problems and plan effective features and solutions. For teams to be able to trust one another, there needs to be an alignment of timelines and good transparency and visibility of the progress of the work being undertaken.Shifts in scope and accountability: I touched on this in the DevOps life cycle overview, where I stated that accountability and ownership must lie with the development teams. Often, this requires a shift from the traditional approach where developers, QA, and the Operations teams work separately to one where development teams are responsible for writing, testing, and deploying a system, along with running it in production. This allows teams to take a holistic view of the problem and solution and achieve the most value for their customers.Shorter release cycles: Being able to release new features faster is crucial in being able to iterate and gain more value quickly. It also reduces risks and improves stability throughout the whole DevOps life cycle. This encompasses all aspects of DevOps, from planning through to operating.Continuous learning: A growth mindset is the key to an effective DevOps workflow as it allows teams to question everything and learn what works best for their business and customers. This requires an appetite to fail fast and learn from those failures, which helps to improve the systems and processes so that you gain the most value from them. This is possibly the most important aspect of DevOps as without this, the entire DevOps life cycle breaks down. Without this, constant improvement and growth can not be achieved.Next, we look into the four key DevOps metrics.
It is important to understand that a common way to measure how mature a team's DevOps practice is is with the four key metrics of DevOps (these are defined in State of DevOps 2019, which is available in the Further reading section):
Deployment Frequency: This measures how often deployments can be conducted. The ideal value for this metric is to be able to deploy on demand and multiple times a day.Lead Time to Change: This measure looks at how long it takes for a change to go from committed code to the production system. The target time is less than 1 day.Time to Restore Service: It is important to recover from a service incident quickly. A mature DevOps team should be able to recover from a production issue in less than an hour. This metric allows a team to see the average time it takes to restore normal services.Change Failure Rate: This measures the number of deployments that have an undesired impact on the production system. The accepted percentage of releases that result in a degraded service for a mature DevOps team is between 0 – 15% of releases.The best performing teams achieve their reliable results by following both the DevOps life cycle and by having a good DevOps culture.
By using DevOps, software teams and companies have transformed how effective they are, but this practice alone does not solve problems, nor does it limit how new ideas can make this even more effective. One way in which DevOps can be enhanced further is with the ability to manage features within systems and applications, which we will look at in the next section. We will also examine how feature management can positively impact the four key DevOps metrics.
I will explain what feature management is in detail in the next chapter, but before that, I will talk broadly about how this approach can be applied to a modern DevOps way of working and how it fits within the DevOps life cycle. The idea of feature management in modern systems is self-explanatory – it is an approach to being able to manipulate components within a production system without performing any deployments. This change can be achieved safely and easily, without the need to change or release an application's code.
As we will see throughout this book, feature management can be used in several ways within systems to offer new ways of building and developing software. These include the following:
Progressive rollouts: To deliver a new implementation to a production systemExperiments: To gain insight into which variation of a feature performs bestSwitches: To use permanent feature flags within an application to turn non-essential pieces of functionality on or offMigrations: To safely move from one system to anotherNow, let's look back over the key phases of the DevOps life cycle. Here, I will explain how they can be changed and improved by introducing feature management and its various implementations and use cases.
Let's look at how feature management can be employed within the DevOps life cycle to improve the way software is built and delivered:
Planning: With feature management, smaller amendments to an application can be considered as they can be quickly accessed to understand their value before larger and more expensive work is carried out. Feature management also allows for more risky ideas to be considered since any potential risks to production systems are reduced. All of this allows for an improved planning stage.Developing: Developing new features can be undertaken more safely with feature management as a new implementation can be built alongside an existing one and encapsulated within a feature flag code block (more on this soon). This will allow the feature flag to be used as a toggle and during testing, this can enable a granular approach to discovering where any quality issues might lie. With the ability to switch between old and new implementations, there is less risk of degrading the production system with the work being carried out. It is important to note that this does not mean that quality can be sacrificed to build new, substandard features encapsulated by a feature flag.Delivering: When in this phase, the value of feature management becomes most apparent as a feature can be turned on or off with a high degree of precision. Crucially, this reduces the risk of deployments to the production systems as features can be deployed but not turned on for users. A release no longer needs to change the customer experience, even though new functionality has been deployed. Now, with feature management, it is up to the team to decide when and to whom the feature should be enabled, with no release required to make this happen. The flexibility here around the scenarios in which a feature can be enabled is what I will be spending time discussing throughout the remaining chapters.Operating: Even when in the operating phase, feature management adds value as the entire health of the production environment can be improved with the ability to turn features off and on in real time. There are several cases where this can be useful, especially when you can turn performance-intensive features off when experiencing high load or when routing requests through different systems.Building on the understanding of how feature management can be used practically, I want to explain how it can positively impact the four key DevOps metrics I mentioned earlier:
Deployment Frequency: Feature management can assist in achieving a better score here as the feature ideas and implementations can now be smaller, making it easier for multiple deployments to happen. In addition, the risk of these deployments is reduced by having the new features turned off when they are released to production.Lead Time For Changes: Similar to Deployment Frequency, a team's performance can be improved by delivering smaller pieces of work and mitigating risk, allowing for quicker releases. There is also the option to bypass some testing environments and processes with feature management, which can save a good deal of time – we will get to this topic in Chapter 7, Trunk-Based Development, where I will explain this in more detail.Time To Restore Service: With the ability to turn features on and off with the flick of a button, feature management enables rapid responses to service incidents. This could be turning off a frontend feature to routing requests to a different backend service.Change Failure Rate: With feature management, teams can keep the change failure rate very close to 0. As we mentioned previously, if features and changes are deployed to production with the feature flag turned off, then the chance of an issue within production is minimal. Rather, the impact might occur once the feature is turned on, but the blast radius can be far smaller and better managed through targeting which users will be served the feature. Turning a feature off that is causing a problem during an incident can resolve an incident immediately. This allows you to find a real fix for the problem feature to be implemented in a less pressured manner.From these basic examples, I hope you have a good sense of how feature management can help improve how software can be built and delivered, and some of the ways that its impact can be measured. Throughout this book, we will learn more about the value it can bring to teams and businesses.
With feature management, having its biggest impact within the delivering stage of the DevOps life cycle and with the expectation that most people are adopting CI/CD pipelines, I wanted to share a few things before we move on and look at feature management and LaunchDarkly.
I want to make it clear that feature management is not a replacement for good CI/CD processes – it is an enhancement of the CI/CD process that offers more control and opportunities to teams.
For some, the idea of changing features within a production system might seem to go against the merits of a good CI/CD pipeline, in that to get a deployment to the production environment, it must go through several quality gates before it is deemed good enough to be released. But, once in production, that system could be changed, and that leads to the question, if a release to production could change once deployed, do the quality gates matter so much? The quality gates do matter and are just as valuable as they would be without feature management. However, the difference is that all possible configurations of the service should be tested within those quality gates before a feature is deemed to be ready for customers. The ability to test all these variations provides the reassurance that whether a feature is on or off, your service will continue to work as expected.
As we will see throughout this book, feature management is not an end itself, but a means to an end. By implementing feature management within CI/CD processes, new opportunities will present themselves, such as the following:
Testing in Production: This is where a new implementation can be evaluated against a current feature. By using data directly from customers, the new implementation can be proven to be more valuable before it is rolled out to all customers. This covers several topics we will explore, such as rollouts, experimentations, and switches.Trunk-Based Development: In this case, production can become the only environment for testing, which speeds up development time and reduces the cost of maintaining multiple production-like environments.Infrastructure Migrations: This is where large migrations can be carried out safely and in a methodical manner, even if some parts of a system should be migrated but other parts remain on the existing implementations.These methodologies and processes can be implemented in other ways but adopting feature management can offer them all within one approach.
This chapter has given you an introduction to the modern approach to building software and how this can be achieved and measured. We have explored several approaches in which feature management can develop those practices and the tangible ways it can improve CI/CD pipelines and DevOps metrics.
With this knowledge, you should be able to appreciate how feature management can be valuable to the software development process. This, in turn, allows teams to benefit from more efficient practices and from building products with increased value for their customers and their business.
In the next chapter, I will explain how you can build on the DevOps methodology to building software, how you can get the most from feature management, and how you can use LaunchDarkly to make it happen.
To learn more about what was covered in this chapter, take a look at the following resources:
State of DevOps Report 2019, by DORA (DevOps Research & Assessment) – available at https://www.devops-research.com/research.html#reportsWhat is DevOps?, by Microsoft – available at https://azure.microsoft.com/en-gb/overview/what-is-devops/#culture