Preface

This is a book about feedback control—not a topic that programmers (among others) tend to know much about. This is a pity, because feedback control was originally devised to solve a problem that should be all too familiar to software engineers, especially those who are working on enterprise systems. Feedback control is a way to make sure that large, complicated systems run reliably, even when subject to external disturbances, and to make efficient use of constrained resources.

If you are looking for a system that can spin up some additional servers when traffic in your data center spikes and take them down again when the rush is over, then you have come to the right place.

What Is Feedback?

Feedback works by constantly comparing the actual behavior of a system to its desired behavior. If the actual behavior differs from the desired one, a corrective action is applied to counteract the deviation and drive the system back to its target. This process is repeated constantly, as long as the system is running.

One appealing feature of feedback control is that it requires relatively little knowledge about the controlled system. As long as one knows which direction to “nudge” the system when it has gotten off course, one can build a feedback loop. For this reason, feedback is an attractive technique for controlling large, complex, and opaque systems.

Moreover, feedback systems are self-correcting even in the presence of external disturbances. Because the system’s behavior is monitored and adjusted all the time, a feedback system naturally and automatically responds to changes in operating conditions. No need to make special provisions to activate additional servers for rush hour: the feedback controller will notice the increase in load and spin up further instances until the desired quality of service is met. It will also take the instances down again, once the rush has passed, in proportion to the lightening load.

One needs to be careful, though, since control actions that are either too large or improperly timed can “overcorrect” a disturbance. Instead of reducing the difference between the desired and the actual behavior, such control actions replace a deviation in one direction with another deviation in the opposite direction. In the worst case, the amplitude of these deviations grows with each step until the system becomes dysfunctional or, often literally, blows up!

To avoid this outcome, control theory has developed specific experiments for analyzing a system’s behavior. The results from these experiments can then be used to design and tune control loops that are safe to operate and that will track a reference value accurately and reliably.

Why This Book?

Feedback control has a long and successful history in applications to electronic circuits, industrial processes, and vehicular engineering. But it can do more. Feedback is self-correcting, so it can keep a system on target even if conditions change unpredictably. Feedback requires only limited knowledge about the process to be controlled; hence it can be applied to situations involving complex and opaque systems, such as those typical of enterprise environments.

In this book we will study the application of feedback principles to several software engineering problems, such as the optimal sizing of a cache, the management of a server farm, the control of waiting queues or buffers, and more. In all these examples, feedback will help us to make efficient use of scarce or expensive resources and to do so in the face of changing conditions.

But applying feedback principles to computer systems raises different questions than one typically encounters in the traditional application areas. The laws describing the behavior of computer systems are much less constrained than those for systems in the physical world; so we will rely more on experimental measurements and phenomenological descriptions than on theoretical analysis. (This is similar to the situation one finds in the application of feedback methods to industrial processes.) At the same time, computer systems offer a greater variety of control signals than most physical assemblies do; we therefore have greater freedom in choosing the best signal to use and hence must be aware of the trade-offs involved. We will pay particular attention to such questions.

Feedback control has been barely explored as a design paradigm for software systems. I hope to convince you that feedback control has much to offer in this regard and is, in fact, the correct solution to many problems that software engineers commonly face.

How to Read This Book

It can be difficult for an outsider to learn about feedback. Textbooks and articles use specialized terminology and examples from existing application areas, which sometimes obscures the underlying concepts. The problems that arise in the classical application areas are not necessarily the same problems that are of greatest interest to programmers. One also needs to be aware that many textbooks on feedback control are primarily concerned with the mathematical manipulations that underlie control theory and so give less attention to conceptual development or practical implementation questions.

This book takes a different approach. Theoretical development, important and beautiful as it may be, has been relegated to Part IV in the back of the book. An introductory Part I introduces the concepts of feedback control, system dynamics, and controller design. Part II describes a variety of practical techniques for the implementation and tuning of controllers, and it also discusses some examples of “design patterns” for feedback loops. Part III consists of a collection of case studies: specific problems involving computer systems that are solved using feedback methods. For each case study, a number of different approaches and their trade-offs are discussed in some detail.

The case studies are the heart of the book. I suggest beginning with the introductory Part I in order to become familiar with the basic feedback concepts. Then tackle the case studies, diving into Part II (Practice) or Part IV (Theory) as the need for additional information arises. (The sequence of case studies is arranged roughly in order of increasing complexity.)

All case studies are realized as computer simulations, and the code is available from the book’s website. The code is intentionally simple and straightforward so that it can be easily extended and modified. Experimenting with simulations is an excellent way to build intuition for the sometimes surprising behavior of closed-loop systems—and to build the necessary confidence that this feedback stuff really works!

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This icon signifies a tip, suggestion, or general note.

Caution

This icon indicates a warning or caution.

Using Code Examples

This book is here to help you get your job done. In general, if this book includes code examples, you may use the code in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Feedback Control for Computer Systems by Philipp K. Janert (O’Reilly). Copyright 2014 Philipp K. Janert, 978-1-449-36169-3.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Safari® Books Online

Note

Safari Books Online (www.safaribooksonline.com) is an on-demand digital library that delivers expert content in both book and video form from the world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.

Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like O’Reilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at http://bit.ly/feedback-control.

To comment or ask technical questions about this book, send email to .

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

It was a pleasure working on this project with a familiar group of friends and coworkers. Mike Loukides guided this project with his familiar gentle touch. Matt Darnell again did a tremendous job of copyediting the manuscript. The production team at O’Reilly was most accommodating when it came to my special requests regarding math typesetting and graphics.

Ben Peirce read the entire manuscript and provided valuable comments. I also acknowledge useful conversations with Austin King, Chris Nauroth, and Joe Adler.

I am especially indebted to Richard Kreckel, who carefully read several drafts of this manuscript and made many exceptionally valuable and insightful suggestions. I owe him big-time.

This book was written on Linux while running IceWM, tcsh, and XEmacs. The manuscript was prepared using LaTeX together with the AMS-LaTeX packages; the LaTeX manuscript was then transformed into the publisher’s internal format for production. The graphs were drawn using gnuplot and pic; some calculations for the root locus diagrams in Chapter 24 were performed with Scilab. The simulations were implemented in Python.

Get Feedback Control for Computer Systems now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.