<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Matt Klein</title>
  
  
  <link href="https://mattklein123.dev/atom.xml" rel="self"/>
  
  <link href="https://mattklein123.dev/"/>
  <updated>2024-04-24T13:49:31.120Z</updated>
  <id>https://mattklein123.dev/</id>
  
  <author>
    <name>Matt Klein</name>
    
  </author>
  
  <generator uri="https://hexo.io/">Hexo</generator>
  
  <entry>
    <title>Why does no one talk about mobile observability?</title>
    <link href="https://mattklein123.dev/2024/04/24/no-one-talks-about-mobile-observability/"/>
    <id>https://mattklein123.dev/2024/04/24/no-one-talks-about-mobile-observability/</id>
    <published>2024-04-24T07:41:09.000Z</published>
    <updated>2024-04-24T13:49:31.120Z</updated>
    
    <content type="html"><![CDATA[<p>When it comes to server&#x2F;backend, “observability” is both <a href="https://seekingalpha.com/article/4590549-datadog-strong-observability-market-and-increasing-customers">a huge business</a> and a constant topic of conversation – even if sometimes the topic is <a href="https://mattklein123.dev/2024/04/03/observability-cost-crisis/">how much money everyone is spending</a>! Yet, we rarely hear about mobile observability, even though the importance of being <a href="https://www.browserstack.com/guide/how-to-implement-mobile-first-design">mobile first</a> is now a commonly accepted business practice. Why is this? The lack of discussion and focus is even more curious when considering something else I like to say:</p><blockquote><p>An API success rate of 100% at the backend API gateway doesn’t mean anything if the customer success rate as perceived when interacting with an app is 0%.</p></blockquote><p>Said another way, the only success rate that matters is the success rate measured where the user experience actually is, all the way at the mobile edge. I cannot count how many times in my career a backend API has returned an HTTP 200 OK only to have the response crash the app!</p><p>The same reasons that we’re obsessed with observability for servers obviously apply (perhaps even moreso) to mobile. And given the clear importance of mobile observability in operating reliable customer experiences for our applications, it seems like the topic should be widely discussed and widely applied, yet it’s not. For the rest of this post I’m going to talk about why this is the case (teaser: it’s <em>very</em> difficult!), and what we can do as an industry to prioritize its implementation in a cost effective manner that ultimately improves customer experiences.</p><h2 id="Why-is-mobile-development-hard"><a href="#Why-is-mobile-development-hard" class="headerlink" title="Why is mobile development hard?"></a>Why is mobile development hard?</h2><p>Before diving into mobile observability, let’s start by talking about why mobile <em>development</em> is difficult:</p><h3 id="Extremely-long-release-and-upgrade-cycles"><a href="#Extremely-long-release-and-upgrade-cycles" class="headerlink" title="Extremely long release and upgrade cycles"></a>Extremely long release and upgrade cycles</h3><p>Unlike server where most engineers are used to being able to deploy nearly instantaneously to their entire fleet, mobile deployment is a very lengthy process that starts with submitting new app versions to the app store, waiting for it to (maybe) be approved, and then waiting for gradual rollout. More established apps also likely have processes for alpha, beta, etc. before starting production rollout. All of this means that it might take 4 weeks or more before code changes can actually wind up in users’ hands, leading to <em>excruciatingly slow iteration cycles</em>. Additionally, because there is typically a long tail of slow upgrades, we are forced to support old app versions for a very long time.</p><h3 id="Limited-resources-and-limited-control"><a href="#Limited-resources-and-limited-control" class="headerlink" title="Limited resources and limited control"></a>Limited resources and limited control</h3><p>While new smartphones have quite a bit of power, they still have a finite amount of CPU, RAM, and disk that is being shared across all apps on the device. The smartphone OSs provide very limited control around when apps get killed due to excessive CPU&#x2F;RAM usage (where the definition of “excessive” can change at any point due to low battery, “doze” mode, the CPU overheating, etc.), and apps can be interrupted at any point due to receiving a call&#x2F;text, user initiated context switch, etc. Finally, the OS makes no guarantees about disk availability which means that apps have to be very defensive about any assumed local storage. With server, <em>you</em> own the device and can control everything that’s happening on it; with mobile, you don’t.</p><h3 id="Limited-background-capability"><a href="#Limited-background-capability" class="headerlink" title="Limited background capability"></a>Limited background capability</h3><p>Related to the previous point, mobile OSs make no guarantee about whether an app can run in the background. This means that an app may be shutdown and not run again for days or weeks depending on when the user next interacts with it explicitly.</p><h3 id="Supporting-old-models-and-OS-versions"><a href="#Supporting-old-models-and-OS-versions" class="headerlink" title="Supporting old models and OS versions"></a>Supporting old models and OS versions</h3><p>Unlike server where we rarely think about the underlying hardware and Linux version (other than perhaps whether we need to support ARM), apps must routinely support old OS versions and old phone models where supported APIs and capabilities may materially differ. This can lead to complex branching and feature enablement depending on detected capabilities.</p><h3 id="Ever-evolving-privacy-controls"><a href="#Ever-evolving-privacy-controls" class="headerlink" title="Ever evolving privacy controls"></a>Ever evolving privacy controls</h3><p>Both Apple and Google are continuously evolving their posture on privacy and security. This means that apps need to support all branches of requested permissions and not all models and OS versions support all capabilities.</p><h3 id="Time-language-is-hard"><a href="#Time-language-is-hard" class="headerlink" title="Time&#x2F;language is hard"></a>Time&#x2F;language is hard</h3><p>Users are likely to have different languages, locales, time zones, calendars, etc.</p><h3 id="Sporadic-connectivity"><a href="#Sporadic-connectivity" class="headerlink" title="Sporadic connectivity"></a>Sporadic connectivity</h3><p>While the internet is fantastically reliable (all things considered), mobile apps have to contend with a wide range of poor networking conditions including:</p><ul><li>Weak cellular signal leading to slow&#x2F;sporadic connectivity</li><li>Transitioning from cellular to WiFi and vice versa</li><li>Misconfigured WiFi hotspots blackholing traffic</li><li>IPv6 and DNS issues that may be specific to certain mobile carriers or WiFi networks</li></ul><p>Additionally, even when things <em>are</em> working, bandwidth is limited and shared across the entire device. Furthermore, not all users have unlimited data (this is vastly more common in developing countries) and will <em>care about how much data apps are using because they are being charged by the byte</em>.</p><p>Clearly, mobile development has many unique challenges that are completely foreign to the average backend engineer, even when the backend engineer works on a distributed system that ultimately is in support of a widely deployed mobile first product! Not surprisingly, these challenges directly affect the implementation of observability in the mobile environment.</p><h2 id="Why-is-mobile-observability-hard"><a href="#Why-is-mobile-observability-hard" class="headerlink" title="Why is mobile observability hard?"></a>Why is mobile observability hard?</h2><p>In the vast majority of cases server engineers assume that connectivity between distributed system nodes is constant and largely consistent and reliable. This is not to say that server engineers do not have to handle sporadic failure in distributed system networking (they clearly do). However, for the most part, modern observability systems attempt to push metric&#x2F;log&#x2F;trace data through the pipeline with a limited amount of retries and local buffering in either RAM or on disk. The assumption is that the data will probably get where it needs to go. And if the retries or local buffering are not sufficient during sporadic failure, the data is dropped. Because server networks are generally extremely reliable, sporadic drops are rarely considered to be a large issue. To summarize, in the server observability world we assume:</p><ol><li>High speed and reliable networking.</li><li>Applications running out of resources and being forcibly terminated is an anomaly and not the norm.</li><li>It’s possible to rapidly deploy changes, either to fix bugs or to add new telemetry to debug an ongoing issue.</li></ol><p>Not surprisingly, the high level assumptions we make in the server observability world are at odds with the challenges inherent in mobile development and implementing mobile observability.</p><h3 id="Long-release-cycles"><a href="#Long-release-cycles" class="headerlink" title="Long release cycles"></a>Long release cycles</h3><p>Due to the epicly long release cycles inherent in mobile, the simple act of adding a log or analytic event can take weeks for initial rollout and months&#x2F;years to reach the entire population of app users. This means that all things being equal mobile engineers would like to add as much logging&#x2F;analytics as possible ahead of time in case the data is needed. However this is unfortunately at odds with the fact that:</p><h3 id="Users-care-about-data-usage"><a href="#Users-care-about-data-usage" class="headerlink" title="Users care about data usage"></a>Users care about data usage</h3><p>Users that are on metered data plans care deeply about how much data an app is using, and will notice if an app is using “too much.” Furthermore, even if users have unlimited data, slow networks and sporadic connectivity means that <em>observability data is sharing available bandwidth with critical application traffic</em>. I.e., sending too many logs can materially impact the performance of the main application. Note that nearly every large mobile app has measured that perceived application performance (time to first interaction, delay when moving screens and clicking buttons, etc.) impacts conversion and core business metrics so this is not an academic concern.</p><h3 id="Sporadic-connectivity-1"><a href="#Sporadic-connectivity-1" class="headerlink" title="Sporadic connectivity"></a>Sporadic connectivity</h3><p>Unlike on server, sporadic or poor connectivity on mobile must be considered a normal event and not an outlier. This means that observability systems must plan ahead for sophisticated batching, local storage, etc. or enough data will be lost to impact the reliability of the observation system.</p><h3 id="Unplanned-termination-is-the-norm"><a href="#Unplanned-termination-is-the-norm" class="headerlink" title="Unplanned termination is the norm"></a>Unplanned termination is the norm</h3><p>Because apps can be terminated at any time and may not be able to run in the background, mobile observability systems must plan for this case, similar to how sporadic connectivity might be dealt with.</p><h3 id="Huge-cardinality-and-cost"><a href="#Huge-cardinality-and-cost" class="headerlink" title="Huge cardinality and cost"></a>Huge cardinality and cost</h3><p>Depending on the app, a relatively small server infrastructure may support hundreds of thousands or even millions of monthly active mobile users. Storing individual telemetry for each active user is <em>very costly</em> so aggregation and summarization systems are typically needed for mobile observability.</p><h3 id="Permissions-capabilities-may-limit-data-collection"><a href="#Permissions-capabilities-may-limit-data-collection" class="headerlink" title="Permissions&#x2F;capabilities may limit data collection"></a>Permissions&#x2F;capabilities may limit data collection</h3><p>Some interesting mobile telemetry may require explicit permission opt-in (for example location tracking). App developers need to think carefully about whether they want to request permissions from a user and either way have to handle the case where a user denied the permission request. This makes data analysis tricky as the analysis has to account for data that a user refused to send.</p><h3 id="Naive-implementation-of-local-storage-for-observability-data-can-impact-UI-performance"><a href="#Naive-implementation-of-local-storage-for-observability-data-can-impact-UI-performance" class="headerlink" title="Naive implementation of local storage for observability data can impact UI performance"></a>Naive implementation of local storage for observability data can impact UI performance</h3><p>While mobile apps can be multithreaded, in general a single “main” thread is used for drawing the UI and handling user input events. Care must be taken to not block the main thread unnecessarily or the app’s frame rate and general responsiveness may suffer. This is particularly important for local storage of observability data which needs to be durably stored due to several of the previously described issues. Thus, the observability implementation needs to carefully consider how logging data is processed and stored so as to not adversely impact app performance.</p><p>I will also mention that the idea that logging in production in mobile apps is “bad” (due to network utilization, blocking the main thread, etc.) is pervasive. Some examples include:</p><ol><li>Google’s <a href="https://developer.android.com/studio/publish#publishing-prepare">instructions for preparing an app for release</a> say: <em>“At a minimum, you need to make sure that logging is disabled and removed…”</em></li><li>A popular Android logging framework called <a href="https://github.com/JakeWharton/timber">Timber</a> says: <em>“There are no Tree implementations installed by default because every time you log in production, a puppy dies.”</em></li></ol><p>There are clearly a lot of challenges stacked against mobile observability that we need to solve in order to get it widely deployed so that we can accurately measure <em>real</em> user experience.</p><h2 id="A-path-forward-for-mobile-observability"><a href="#A-path-forward-for-mobile-observability" class="headerlink" title="A path forward for mobile observability"></a>A path forward for mobile observability</h2><p>Given how important mobile observability is for measuring and debugging customer experiences <em>where they ultimately matter</em>, it is in our best interest as an industry to invest more heavily in fundamental technologies that solve for all of the challenges described above.</p><p>In a <a href="https://mattklein123.dev/2024/04/10/do-you-need-to-store-that-telemetry/">previous post</a> I argued for not storing any telemetry by default, adding a control plane, and adding sophisticated local storage. The goal of this system is to reduce cost overall, but still allow for highly detailed telemetry to be accessed when needed in order to debug customer issues: <a href="https://mattklein123.dev/2024/04/17/1000x-the-telemetry/">1000x the telemetry at 0.01x the cost</a>. Is this type of observability system a potential path forward for mobile observability? I think it is. Adding a control plane and distributed local storage solves the challenge of mobile observability in multiple ways:</p><ol><li>Due to very long release cycles, we optimally want mobile engineers to add as much logging as possible to their apps. This will increase the chance that a piece of telemetry is present if needed to root cause a production issue. If we don’t send this telemetry anywhere by default, we avoid concerns around data usage and shared bandwidth consumption.</li><li>To workaround extreme cardinality and cost issues if we were to theoretically send and store all logs, we can utilize the control plane to selectively target cohorts of devices for telemetry retrieval (e.g., all users in San Francisco, all users on a particular phone model, all users on a particular app version). We also have real-time control over what telemetry we send. For example, instead of sending raw logs we can dynamically create synthetic metrics on the device and send them instead as a substantially cheaper (and easier to reason about) aggregation mechanism.</li><li>As long as <a href="https://blog.bitdrift.io/post/bitdrift-ring-buffer">local storage for telemetry data is sophisticated enough</a>, we can avoid UI performance issues (main thread blocking) and have resilience against sporadic network connectivity and uncontrolled app termination. Putting local storage directly on the device also allows us to “time travel” and retrieve historical data when an explicit set of events within the app occurs (effectively the control plane sending a finite state machine to the app for use in event matching).</li></ol><p>If anything, the technical and cost challenges inherent in effective mobile observability most obviously necessitate a drastic change in how we think about observing systems in general via adding a control plane and distributed local storage. (Perhaps not surprisingly this is why <a href="https://bitdrift.io/">bitdrift’s</a> initial focus has been on mobile observability, though I think adding a control plane and local storage is broadly applicable to the entire observability ecosystem.)</p><p>I look forward to the day when identifying and diagnosing mobile-centric issues — like a server change causing crashes in older app versions due to malformed JSON in HTTP 200 responses, becomes as simple as it is with the server-side observability systems of today. If as an industry we prioritize the importance and implementation of effective mobile observability (the “final frontier” as it were), this day may be just around the corner. Onward!</p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;When it comes to server&amp;#x2F;backend, “observability” is both &lt;a href=&quot;https://seekingalpha.com/article/4590549-datadog-strong-observabil</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>1000x the telemetry at 0.01x the cost</title>
    <link href="https://mattklein123.dev/2024/04/17/1000x-the-telemetry/"/>
    <id>https://mattklein123.dev/2024/04/17/1000x-the-telemetry/</id>
    <published>2024-04-17T08:31:59.000Z</published>
    <updated>2024-04-24T13:49:31.120Z</updated>
    
    <content type="html"><![CDATA[<p>This is my third post in a series on a different take on modern observability. In my <a href="https://mattklein123.dev/2024/04/03/observability-cost-crisis/">first post</a> I talked about why modern observability is so expensive. In my <a href="https://mattklein123.dev/2024/04/10/do-you-need-to-store-that-telemetry/">second post</a> I talked about whether we really need to store every piece of telemetry that we generate, and a new way of thinking about observability using a control plane and local storage.</p><p>In this post, I’m going to take you through a journey where we explore a world in which observability is flipped on its head: we store nothing by default, but have access to anything we would ever want on the fly. What does life look like when you can get any telemetry you want, any time, without thinking about cost or storage? What would it mean for our ability to debug and operate systems?</p><h2 id="How-can-I-store-nothing-but-have-access-to-everything"><a href="#How-can-I-store-nothing-but-have-access-to-everything" class="headerlink" title="How can I store nothing, but have access to everything?"></a>How can I store nothing, but have access to everything?</h2><p>The sad, or maybe just ugly, reality is that <em>the vast majority of telemetry in traditional systems is never read</em>, either by human or machine. Even as storage, compute, and network have gotten cheaper over the years, the complexity of our systems (microservices, CaaS, FaaS, etc.) and their ability to generate large volumes of telemetry data has kept pace, leading to egregious waste, high relative costs, and unhappy operators.</p><p>In <a href="https://mattklein123.dev/2024/04/10/do-you-need-to-store-that-telemetry/">my previous post</a>, I argued that we can apply a dynamic control plane, plus use local storage, to intelligently decide what telemetry to store and use. If we conservatively estimate that overall monthly telemetry volumes and costs can be decreased by 90% using a fully dynamic control plane and local storage (I think the real volume decrease could approach 99% or more in some systems), we now have slack to reuse some of this excess capacity for <em>more telemetry when it matters</em>. Effectively we are trading a steady state of dubiously useful telemetry for <em>bursts of extremely high fidelity telemetry</em> that are targeted towards solving specific problems at hand.</p><p>For the rest of this post I am going to go into some specific examples across both mobile and server observability where getting bursts of 1000x the telemetry will fundamentally change how engineers debug and operate systems. These examples are by no means exhaustive and I fully expect that once dynamic telemetry systems are widely deployed we will continue to see new use cases, limited only by the imagination of engineers around the world.</p><h2 id="What-does-cost-mean-when-talking-about-telemetry"><a href="#What-does-cost-mean-when-talking-about-telemetry" class="headerlink" title="What does cost mean when talking about telemetry?"></a>What does cost mean when talking about telemetry?</h2><p>Before talking about different examples of what 1000x the data can do, let’s first discuss the definition of <em>cost</em> in the telemetry context.</p><ol><li>The most obvious definition of cost is of course in terms of dollars and cents: what is the bill to transport, store, and make queryable telemetry data? This one doesn’t need further explanation.</li><li>Another critical definition of cost, though less discussed, is what is the <em>overhead</em> of collecting telemetry data. Nothing is free in computing. Generating telemetry in and of itself uses CPU time, increases RAM usage, and possibly increases disk usage. In highly concurrent systems, the production of telemetry can change timings enough to alter program behavior. The more telemetry collected the higher the cost. Thus for the most in-depth telemetry collection at scale we want to <em>amortize</em> the overhead cost by limiting the data capture either by sampling across a very large population, limiting the collection time, or both.</li><li>Another definition of cost is what I would call <em>cognitive cost</em>. The larger the overall volume of data, the more of it there is to sift through in order to find the signal within the noise. If we generate large amounts of telemetry data, optimally we would like it to be targeted and obviously useful in understanding the problem currently at hand.</li><li>A final definition of cost is what I would call <em>opportunity cost</em>. These are all of the things that we <em>can’t</em> and <em>don’t</em> do because of the other three types of costs.</li></ol><p>As an aside, on the topic of overhead I recall one particular bug I was chasing early in my career inside a mobile phone cellular stack – if we turned on all logging the bug wouldn’t repro – we had to add a single log line at a time and spend hours trying to repro the issue! The problem ended up being a super rare race condition deep in the telephony stack which was tickled by a particular phone model on a particular network carrier. What a fun bug!</p><p>For the remainder of the post when I talk about cost I am talking about <em>all four</em>: the financial cost, the performance overhead of telemetry collection, the cognitive cost of having too much irrelevant data to sift through, and the opportunity cost of not being able to get all of the data we need. Adding a control plane and local storage allows us to <em>amortize</em> the cost of extremely high fidelity telemetry collection across short collection intervals, large populations, and very specific collection triggers (finite state machine matchers sent from control plane to data plane), <em>thus making all four costs low</em>.</p><h2 id="Debug-and-trace-logging"><a href="#Debug-and-trace-logging" class="headerlink" title="Debug and trace logging"></a>Debug and trace logging</h2><p>Nearly every logging&#x2F;event framework in existence has a way to categorize logs into relative levels of severity. For example, error, warn, info, debug, and trace. While there is no standard on how to categorize logs, and no standard on which severity level of logs to emit by default to traditional observability systems, most engineers have some rubric that they follow, typically based on personal experience and&#x2F;or company culture.</p><p>In order to reduce volume and cost, most organizations emit info and higher severity logs to be stored by a traditional log storage system. Because of this, most engineers have been trained to categorize the severity of their logs, and are generally told to be judicious about info and higher severity, while debug&#x2F;trace have no restrictions due to not being sent anywhere by default.</p><p>Thus, it is an extremely common occurrence that info logs do <em>not</em> have sufficient data to fully understand the path of execution that a program took prior to arriving at the info log in question. The number of times in my career that I have wished to easily see debug&#x2F;trace logs on a production system are innumerable!</p><p>Adding a control plane and local storage on the other hand allows us to dynamically enable debug and trace logs for a limited period of time (and in response to a specific sequence of events) and get access to the entire volume of data that is invaluable in understanding the full set of events that led up to a particular application event.</p><h2 id="Per-instance-metrics"><a href="#Per-instance-metrics" class="headerlink" title="Per-instance metrics"></a>Per-instance metrics</h2><p>While metrics are largely <a href="https://www.splunk.com/en_us/blog/learn/logs-vs-metrics.html">considered to be more cost efficient than logs</a>, they still can create enormous bills in large organizations. The largest organizations typically perform metric aggregation, essentially taking a set of related metrics and collapsing them into a single aggregate time series, in order to both reduce cost and increase query performance (since many queries typically end up asking for an aggregate average, max, etc. on the many underlying time series). A concrete example of this approach would be taking a counter generated by all Kubernetes pods in a service, dropping the pod label, and aggregating the remainder into a per-service count.</p><p>Using this technique can drop overall metric volume by 1-2 orders of magnitude depending on the deployment. Most users don’t notice any difference because as I mentioned above, queries tend to ask for aggregates anyway of the per-pod data.</p><p>However, there are cases in which having per-instance (per-pod) metrics is useful during debugging. For example, looking for outliers that are easy to lose in a large batch of aggregate data. A control plane driven observability architecture makes it trivial to temporarily turn on per-instance metrics, and even stream them to a live viewer if live debugging is all that is needed. This avoids permanently storing orders of magnitude more metrics when they are rarely needed.</p><h2 id="Network-protocol-traces"><a href="#Network-protocol-traces" class="headerlink" title="Network protocol traces"></a>Network protocol traces</h2><p>Networking is pervasive in modern systems, both within server-side infrastructure as well as spanning the internet out to large fleets of mobile&#x2F;IoT&#x2F;web devices. Due to the highly concurrent and inherently fallible nature of networking, debugging problems that crop up can be <em>very</em> difficult without detailed tracing. Example low level protocols used in modern distributed systems include: <a href="https://en.wikipedia.org/wiki/Internet_Protocol">IP</a>, <a href="https://en.wikipedia.org/wiki/Transmission_Control_Protocol">TCP</a>, <a href="https://en.wikipedia.org/wiki/User_Datagram_Protocol">UDP</a>, <a href="https://en.wikipedia.org/wiki/QUIC">QUIC</a>, and <a href="https://en.wikipedia.org/wiki/Transport_Layer_Security">TLS</a>. High level protocols include <a href="https://en.wikipedia.org/wiki/HTTP">HTTP</a>, <a href="https://en.wikipedia.org/wiki/GRPC">gRPC</a>, and many others specific to individual databases, caches, and so on.</p><p>Similar to logging severity levels discussed in the previous section, it is possible to emit variable levels of network protocol tracing, up to and including “trace” logging which might include <em>the actual network payloads</em> to greatly aid debugging.</p><p>Clearly, continuously sending extremely detailed network payload information is infeasible due to overhead and cost, but if it could be accessed on-demand when needed imagine how much simpler it would be to debug hard to understand issues!</p><p>Having worked in the application networking world for many years, I cannot count the number of times I have been asked to help capture HTTP REST&#x2F;gRPC request and response bodies to aid debugging. A control plane and local storage makes this easily possible at a reasonable cost.</p><p>As an aside, collecting deeply detailed telemetry, especially of this nature, has <em>substantial</em> security implications. For example, network payloads are very likely to have PII, credit card numbers, passwords, etc. Future highly dynamic observability systems will have to very carefully consider data access security and encryption of telemetry data. One nice property of the control plane &#x2F; data plane split is that some cases can be solved by <em>matching only</em> within the data plane and not capturing any data at all with its inherent security implications (for example emitting a synthetic metric when a match condition happens). This will be the topic of a future post!</p><h2 id="Hardware-instruction-sensor-traces"><a href="#Hardware-instruction-sensor-traces" class="headerlink" title="Hardware instruction&#x2F;sensor traces"></a>Hardware instruction&#x2F;sensor traces</h2><p>Using software technologies like <a href="https://ebpf.io/">eBPF</a> or <a href="https://thenewstack.io/hardware-tracing-fast-precise-performance-analysis/">functionality built in to hardware itself</a>, it’s possible to produce extremely high volume tracing data to aid in problem analysis. Like networking data, it’s not practical to send this level of data all the time, but when required for in-depth analysis of hard to reproduce problems, being able to dynamically enable hardware level tracing for a short period of time can be invaluable in root cause analysis. Note that this category applies to <a href="https://www.howtogeek.com/781792/there-are-a-lot-of-sensors-in-your-phone-heres-what-they-do/">all types of high volume hardware signals</a> including instruction traces, accelerometer readings, GPS&#x2F;location readings, virtual reality camera&#x2F;sensor recordings, etc.</p><h2 id="Hardware-performance-profiles"><a href="#Hardware-performance-profiles" class="headerlink" title="Hardware performance profiles"></a>Hardware performance profiles</h2><p>Similar to hardware instruction&#x2F;sensor tracing, in-depth profiling using tools like <a href="https://perf.wiki.kernel.org/index.php/Main_Page">Linux perf</a> can be invaluable in understanding performance bottlenecks during application execution. However, collecting performance profiles has non-zero overhead and also generates large volumes of data which are impractical to collect. <a href="https://grafana.com/docs/pyroscope/latest/introduction/continuous-profiling/">Modern continuous profiling tools</a> get around this limitation by using sampling which is a fantastic approach but can make it difficult to drill down into very specific cases and get accurate real-time data specific to a particular program sequence. By allowing the observability control plane to engage the profiler when a specific sequence of events occurs, very accurate performance data can be retrieved on demand and at low overall cost.</p><h2 id="Mobile-web-session-UX-tracing"><a href="#Mobile-web-session-UX-tracing" class="headerlink" title="Mobile&#x2F;web session UX tracing"></a>Mobile&#x2F;web session UX tracing</h2><p><em>Session replay</em> is generally defined as recording a user’s journey through a mobile or web application. Some variant of session replay is included in many different Real User Monitoring (RUM) and general observability tools. Typical session replays capture some variant of the following UX data:</p><ol><li>Screen captures</li><li>Taps and clicks</li><li>“Rage events” such as shaking and aggressive tapping</li><li>Rotation &#x2F; general orientation changes</li></ol><p>This is in addition to general observability data capture including logs, networking events, etc.</p><p>The important thing to understand about session replay is that cost increases linearly along with the amount of data stored (the fidelity). For example, <a href="https://bitdrift.io/replay">recording screen wire-frames</a> is far more efficient (and privacy conscious) than doing pixel perfect recordings, but has less overall fidelity. Similarly, the more additional UX data is captured (up to and including phone gyroscope readings) the higher the cost both in terms of data volume and capture overhead.</p><p>Because of this, especially on mobile, very high fidelity session replay is rarely deployed to production due to overall cost. However, when using a control plane and local storage it becomes possible to on-demand capture very high fidelity data when a specific sequence of events occurs, making it substantially easier to understand real user journeys even for applications that are deployed to millions of active users.</p><h2 id="What-1000x-case-will-you-think-of"><a href="#What-1000x-case-will-you-think-of" class="headerlink" title="What 1000x case will you think of?"></a>What 1000x case will you think of?</h2><p>In this post I’ve covered a small number of cases where using a control plane and local storage to dynamically enable very high fidelity telemetry can aid in root cause analysis of customer issues. Fundamentally, this type of system provides a <em>massively</em> better ROI on telemetry cost (both financial, overhead, and cognitive), because the generated data is highly detailed when needed and absent when not. 1000x telemetry at 0.01x the cost sounds too good to be true, but in the future I firmly believe that we will look back on traditional observability systems and wonder how we were ever able to debug anything!</p><p>At <a href="https://bitdrift.io/">bitdrift</a> we are just beginning to scratch the surface of what is possible when reimagining observability with a control plane &#x2F; data plane split, and I can’t wait to see what other systems and use cases the industry comes up with collectively over the coming years!</p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;This is my third post in a series on a different take on modern observability. In my &lt;a href=&quot;https://mattklein123.dev/2024/04/03/observa</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>Do you *really* need to store all that telemetry?</title>
    <link href="https://mattklein123.dev/2024/04/10/do-you-need-to-store-that-telemetry/"/>
    <id>https://mattklein123.dev/2024/04/10/do-you-need-to-store-that-telemetry/</id>
    <published>2024-04-10T00:00:00.000Z</published>
    <updated>2024-04-24T13:49:31.116Z</updated>
    
    <content type="html"><![CDATA[<p>In my <a href="https://mattklein123.dev/2024/04/03/observability-cost-crisis/">last post</a> I talked about why modern observability has become so expensive. At the end of the post I posit a question: <em>What if by default we never send any telemetry at all?</em></p><p>In this post I’m going to talk specifically about the perceived need of storing all possible telemetry data. Is this a real need? Or is this an idea that has been drilled into us for so long that we think there’s no other possible way of doing it? If we can break away from the disconcerting idea that all possible telemetry is not stored by default, what new paradigms and cost models for observing and debugging systems become possible?</p><h2 id="Reasons-for-emitting-telemetry"><a href="#Reasons-for-emitting-telemetry" class="headerlink" title="Reasons for emitting telemetry"></a>Reasons for emitting telemetry</h2><p>Before diving into the question of whether we really <em>need</em> to store telemetry, it’s first important to break down the reasons why we <em>do</em> store telemetry. Telemetry emission can be generally placed into three discrete categories:</p><ol><li><strong>Telemetry used for debugging, monitoring, and general observability</strong>: When people mention telemetry in the observability context, this is typically the category that they are thinking about. Emitting logs, metrics, and traces to be used for alarming on anomalous conditions as well as debugging hard to understand issues. The end goal is to prevent downtime, continuously improve performance, and make customers happy.</li><li><strong>Telemetry required for compliance and auditing</strong>: Security and compliance requirements may force us to store specific pieces of information for our applications (audit trails, network access logs, etc.). This class of telemetry generally never has to be queried live so can be sent to relatively cheap cold storage and queried later if absolutely necessary.</li><li><strong>Telemetry required for business intelligence</strong>: Established businesses have core metrics that they track for decision making. Telemetry (whether in the form of traditional metrics, analytics events, or something else) is emitted by applications and tracked in business intelligence dashboards.</li></ol><p>For the purpose of the remainder of this post I will only consider the first category. Telemetry required for compliance, auditing, or business intelligence is very important though out of scope due to its required storage and is thus exempt from the thought exercise: can we disable everything by default?</p><h2 id="Are-there-truly-unique-problems"><a href="#Are-there-truly-unique-problems" class="headerlink" title="Are there truly unique problems?"></a>Are there truly unique problems?</h2><p>When presented with the idea of disabling all telemetry by default, the most common skeptical response is: “What if I need to debug a problem that just happened?” This is a perfectly reasonable response and I admit that the idea of disabling all telemetry by default is likely to be deeply disconcerting to some.</p><p>Let’s start by breaking down how telemetry helps with observability of systems:</p><ol><li><strong>Metrics</strong> provide a cost effective summarization of application events and can be used for understanding the overall shape of system behavior.</li><li><strong>Logs&#x2F;events</strong> provide a more detailed trail of exact application behavior at higher relative cost to metrics. Logs are great for digging into the details of what led up to a specific event.</li><li><strong>Traces</strong> provide a parent&#x2F;child grouping of events and timings either within a single process or across multiple processes&#x2F;distributed nodes. Traces are great for understanding exact relationships between system components.</li></ol><p>In my personal experience as an engineer working on very large scale systems for nearly 25 years, I understand the fear of disabling telemetry by default, but I also believe that there is <em>no problem that happens once and never happens again</em>. This is the critical point. If problems are not truly unique and are likely to happen again, can’t we <em>take steps to catch the issue the next time around with targeted telemetry specific to that problem</em>? Said another way, once a problem is known, can we instruct the system to collect additional information and provide it to us the next time the problem occurs?</p><p>One might then naturally ask, “if I disable all telemetry by default how would I know about problems in the first place?” While the terms APM, monitoring, observability, etc. have become muddled due to vendor marketing, it is important to differentiate the act of “monitoring” a system from the act of debugging. The ideas presented in this post do not aim to change the methods of “monitoring” for problems: we are notified of problems via customer complaints, alert conditions on metrics or event counts (that are sent all the time so that we can run alert queries), in newer systems possibly anomaly detection, and so on. A different way of thinking about “off by default” is that all signals become opt-in vs. opt-out. I.e., the data needed to run an alert query would be opted-in by default. This post is talking about what happens <em>after</em> we are notified of a problem.</p><p>I admit that the scale of the systems that I have worked on have strongly shaped my views on this topic. Between working on high performance computing in AWS EC2, to building Twitter’s edge proxy, to creating <a href="https://www.envoyproxy.io/">Envoy</a> at Lyft, the order of magnitude of requests per second across the entire system and on each node has always meant that capturing detailed logging by default was never practical purely from an overhead perspective. (By default, Envoy logs at Info level and at that level emits nearly no logs after startup, a pattern I have come to use on all systems that I build, for better or worse.)</p><p>Instead, I have relied on metrics for large scale debugging and monitoring of these systems. While this has been a successful approach overall (Envoy after all is run by thousands of organizations and is considered a highly reliable piece of software), it’s not without issues. Taking Envoy as specific example (even though the same idea applies to other systems I have worked on):</p><ol><li>Envoy emits so many metrics that the cost of the metrics themselves becomes prohibitive for many organizations, to the point that many operators <a href="https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/metrics/v3/stats.proto#envoy-v3-api-msg-config-metrics-v3-statsmatcher">statically disable a portion of Envoy metrics by default</a>. (As an aside this disabling mechanism has exposed <a href="https://github.com/envoyproxy/envoy/issues/8771">many bugs</a> over the years because the metrics themselves have been erroneously used for control logic – but that is an interesting story for a different day!)</li><li>When problems do crop up that require more intensive debugging, the lack of explicit logging at all times can lead to a prolonged debugging process.</li></ol><p>On the topic of the prolonged debugging process, what does that look like using traditional telemetry production techniques?</p><ol><li>Attempt a local reproduction. If this is easily possible, using debug and trace logs to root cause the issue is usually relatively easy.</li><li>If that fails (or in parallel), start with code inspection to try to manually intuit what might have happened.</li><li>If local reproduction and manual intuition fails, we are then left with the painful process of manual code changes, possibly across many deployments, to add telemetry breadcrumbs to aid in catching the issue <em>the next time it happens</em> and root causing it.</li></ol><p>Thankfully (3) above doesn’t happen often, but it does happen, necessitating painfully involved debugging experiences.</p><p>Building these types of systems over many years and debugging them has led me to think that there must be a more efficient way. And if there is a more efficient way for debugging and observing systems like Envoy, can those ideas be applied to systems at large in such a way to both improve the debugging and observation experience but <em>also reduce cost along the way</em>?</p><h2 id="How-does-adding-a-control-plane-help"><a href="#How-does-adding-a-control-plane-help" class="headerlink" title="How does adding a control plane help?"></a>How does adding a control plane help?</h2><p>For 30 years how telemetry is produced has not changed: we define all of the data points that we need ahead of time and ship them out of the origin process, typically at large expense. If we <a href="https://konghq.com/learning-center/cloud-connectivity/control-plane-vs-data-plane">apply the control plane &#x2F; data plane split</a> to observability telemetry production we can fundamentally change the status quo for the first time in three decades via getting real-time access to the data we need to debug without having to store and pay for all of it:</p><ol><li>Enable&#x2F;disable metrics, logs, and events at the source.</li><li>Filter telemetry at the source.</li><li>Live stream telemetry at the source to a web portal or CLI without storing it anywhere along the way!</li></ol><p>Beyond simply enabling&#x2F;disabling&#x2F;filtering at the source, we can add <em>intelligence</em> to our telemetry production points and do so much more. We can have the control plane send instructions on a specific sequence of events to match on (effectively a finite state machine sent from control plane to data plane), followed by a set of actions to take when that sequence of events occurs. Actions could be to dump extra information, take profiles, take screenshots on mobile apps, and so on.</p><p>Continuing with the Envoy example in the previous section, instead of having to painfully make code changes and deploy them over a long period of time, if all of the built-in metrics, debug, and trace logs could be controlled dynamically with very specific match conditions and actions, think about how much shorter the debugging cycle would be. If we assume that problems are never unique and will happen again, we can start doing iterative debugging in real-time against a fleet of running instances, and likely vastly reduce the time required to root cause an issue.</p><p>Another way of thinking about it is that <em>this model makes debug information available with immediacy relative to the criticality of the issue as defined by the number of occurrences</em>. Meaning, during an incident the wait time for recurrence will be close to zero, while the wait time might be longer for very uncommon things that are likely to be considered less critical.</p><p>This approach is powerful across multiple dimensions:</p><ol><li>By targeting specific conditions, operators can avoid wading through volumes of information that are not relevant to their observation of the system, significantly reducing cognitive load.</li><li>Operators can decide in real-time what is the best observation method. Would they like to see actual log lines? Would they like to see synthetic metric aggregates of log lines? Would they like to see a subset of explicit metrics?</li><li>Not surprisingly, because the data needed for investigation is enabled and nothing more, the value of the transported and stored data approaches 100%, making the ROI of the more limited dataset a great value proposition.</li></ol><p>As long as operators are able to accept the idea that problems <em>will</em> occur again, with the right system they can catch them the next time around!</p><h2 id="What-about-local-storage"><a href="#What-about-local-storage" class="headerlink" title="What about local storage?"></a>What about local storage?</h2><p>Along with real-time control, we can also add <em>local storage</em> of telemetry data in an <a href="https://blog.bitdrift.io/post/bitdrift-ring-buffer">efficient circular buffer</a>. Typically, local storage is cheap and underutilized, allowing for “free” storage of a finite amount of historical data, that wraps automatically. Local storage provides the ability to “time travel” when a particular event is hit. How many times have we logged an error only to realize that it’s impossible to figure out the real source of the error without the preceding debug&#x2F;trace logs?</p><p>A possibly obvious tradeoff of this system is that the lookback period is bounded, with the number of seconds of data available a function of the buffer size and the data rate. I still think that the benefits of the circular buffer in terms of cost efficiency outweigh the downsides of limited historical retention.</p><p>When coupled with the matching and actions described in the previous section, dumping the local buffer becomes a specific action to take, along with many other possible actions.</p><p>I will note that this is not a new idea: the Apollo spacecraft guidance computer had a system to store recently executed instructions in a circular buffer and dump them when a problem occurred to ease debugging. Similar debugging tools have been implemented for many years in embedded devices and other systems. Circular buffers have also been used in modern observability systems as part of <a href="https://docs.honeycomb.io/manage-data-volume/sample/honeycomb-refinery/monitor/#collector-metrics">centralized trace aggregation systems</a>. The key difference is moving local storage all the way to the edge where it is easier to scale and coupling it with a control plane, which unlocks the ability to deploy dynamic queries across many targets that can result in history being dumped to ease debugging.</p><p>Imagining the combination of local storage and real-time control being used to debug Envoy is what started me down this entire path in the first place!</p><h2 id="Putting-it-all-together"><a href="#Putting-it-all-together" class="headerlink" title="Putting it all together"></a>Putting it all together</h2><p>The paradigms used to emit telemetry have remained unchanged for many years. To this end, engineers are very used to sending data, and expecting it to be there in case they might need it.</p><p>Adding a control plane, local storage, and not sending any data by default is a <em>drastic</em> change to how engineers think about observability. Some engineers find these ideas deeply disconcerting, and fear that the data might be needed so it should be sent no matter what.</p><p>By starting from a default of no exported telemetry, engineers have the ability to “change the game” in multiple ways:</p><ol><li>Because the major cost of telemetry production is what happens to data after it leaves the process, not the production within a process, we can free developers from thinking about cost at all. Emit as many metrics, logs, events, traces, etc. as desired. It’s effectively free!</li><li>Real-time control via the control plane allows telemetry to be enabled and disabled on-demand, whether to temporarily debug an issue, permanently generate (synthetic) metrics to populate dashboards and alerts, etc. Ad-hoc investigations can lead to dynamic production of telemetry, solely for the purpose of solving the issue at hand, before being disabled again.</li><li>Critical telemetry needed for auditing and&#x2F;or monitoring <em>can</em> be sent by default by request of the operator. Furthermore, the definition of critical telemetry can be changed without the need for any code changes or deployments.</li></ol><p>It’s true that changing how engineers and operators think about telemetry production and consumption is a tall order, but in my opinion the benefits of this change far outweigh the challenges of relearning fundamental techniques: namely, vastly decreased cost and vastly <em>increased</em> fidelity for helping to understand and fix product issues that are actively problematic.</p><p>I founded <a href="https://bitdrift.io/">bitdrift</a> last year with the singular purpose of moving away from 30 year old telemetry production paradigms and tackling this problem head on. Is it indeed possible to not send any telemetry by default and still successfully observe large scale production systems?</p><p>Since we <a href="https://blog.bitdrift.io/post/honey-i-shrunk-the-telemetry">launched Capture</a> publicly a few months ago it’s been super interesting to start talking to potential customers; the responses we have received vary widely, ranging from those that immediately buy into the idea of off by default to those that are inherently skeptical, asking the same (completely reasonable!) question posed above: “But what if I <em>really</em> need to look at some of that data after the fact?”</p><p>I continue to be extremely excited by the idea of what we can build if we start from the position of accepting that bugs <em>will</em> happen again, not sending any telemetry by default, and proceeding from there.</p><p>So, say it with me: “No, I don’t <em>really</em> need to store all of that telemetry!” Or, <a href="https://twitter.com/mattklein123/status/1775632985192349754">“Just say no to the logging industrial complex!”</a></p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;In my &lt;a href=&quot;https://mattklein123.dev/2024/04/03/observability-cost-crisis/&quot;&gt;last post&lt;/a&gt; I talked about why modern observability has </summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>Why is observability so expensive?</title>
    <link href="https://mattklein123.dev/2024/04/03/observability-cost-crisis/"/>
    <id>https://mattklein123.dev/2024/04/03/observability-cost-crisis/</id>
    <published>2024-04-03T08:53:36.000Z</published>
    <updated>2024-04-24T13:49:31.116Z</updated>
    
    <content type="html"><![CDATA[<p>It’s no secret that observability costs are top of mind for many organizations in the <a href="https://newsletter.pragmaticengineer.com/p/zirp">post-zero interest rate phenomenon</a> (ZIRP) era (see <a href="https://devops.com/observability-costs-are-too-damn-high/">here</a>, <a href="https://medium.com/@chriscooney/observability-is-too-damn-expensive-e3ba60852f8b">here</a>, and <a href="https://www.honeycomb.io/blog/cost-crisis-observability-tooling">here</a> for example discussions, though similar sentiments can be found far and wide). Organizations are frustrated with the percentage of infrastructure spend (<a href="https://www.honeycomb.io/blog/how-much-should-my-observability-stack-cost#:~:text=Rule%20of%20thumb%3A%20your%20observability,30%25%20of%20your%20infra%20spend">sometimes &gt; 25%!</a>) allocated towards logging, metrics, and traces, and are struggling to understand how much of this data is actually <em>utilized</em> (i.e., yields real business value) once stored.</p><p>Meanwhile vendors are tripping over each other trying to come up with the next great <em>incremental</em> innovation in pricing models and overall cost reduction techniques for storing logs, metrics, and traces. To be clear, there is some innovative and exciting work happening in areas like:</p><ul><li>More efficient databases using columnar techniques and cloud blob storage as the primary persistence tier.</li><li>Work on observability pipelines allow for data filtering, transformation, and aggregation closer to the point of origin, thus producing less data that needs to be stored to the database.</li><li>Using generative AI and machine learning models to better automate useful collection and filtering of data that matters to end users.</li></ul><p>These techniques will possibly lead to better customer experience and lower bills over time. Yet, they are still a <em>small iteration</em> on the basic formula that we have been using for distributed system monitoring and observability for 30 years:</p><ul><li>Determine what data might be needed ahead of time, and send it, typically requiring code changes and deployments. In the case of mobile observability, deployment might take 4 or more weeks considering app store rollouts and upgrades.</li><li>At the same time we have to be at least theoretically cognizant of the performance and cost implications of sending too much data, so often we get wrong what data is needed to solve customer problems, and have to repeat the code change and deployment cycle.</li><li>Take the firehose of data that we have decided on and store it, typically at very high cost, so that it <em>may</em> be queried in near real-time (even though greater than 90% of data is likely never read).</li></ul><p>The critical thing to understand is that because the fundamental <em>origin</em> of observability data has not changed (engineers must determine what <em>might</em> be needed ahead of time and send it), there is only so much that can be done to bend the overall cost curve. Said another way, <em>there is no free lunch in computing</em>. Once data is emitted, every layer it passes through and its eventual storage incurs significant incremental cost.</p><p>The remainder of this post covers a (very) brief history of modern observability, how we arrived at the current observability cost crisis, and offers a new way to think about observability costs and pricing models: how would the computing world change if we turn 30 years of status quo on its head and <em>by default</em> <em>never send any observability data</em>?</p><h2 id="A-very-brief-history-of-modern-observability"><a href="#A-very-brief-history-of-modern-observability" class="headerlink" title="A (very) brief history of modern observability"></a>A (very) brief history of modern observability</h2><p>Though engineers and operators have been debugging computer systems since “the beginning,” the origin of modern distributed systems observability can be traced to the 90s with the creation of the first major internet services such as Yahoo!, Amazon, and Google. The big difference with these systems versus what came before was both the complexity of the underlying distributed architecture as well as the expectation of 24&#x2F;7 high reliability operation.</p><p>Engineers at these organizations pioneered (often independently) observability systems that look not all that different from what many of us are used to using today:</p><ul><li>Systems to collect application logs, ship them to a central location, and make them searchable.</li><li>Systems to collect application metrics (time series data), ship them to a central location, make them queryable, and display them in charts.</li><li>Systems to alert on anomalous predefined conditions (often expressed as time series data queries).</li></ul><p>During the 00s as the internet and large scale distributed systems proliferated, other organizations such as Facebook, Twitter, Uber, etc. had to solve the same set of basic observability and monitoring problems, and developed similar parallel systems. The late 00s brought AWS and the beginning of the cloud era, and along with it came a new cohort of infrastructure software providers, a portion of which operated in the APM&#x2F;observability&#x2F;monitoring space, including pioneers like Splunk, New Relic, AppDynamics, and Datadog. Organizations implementing large internet systems found themselves no longer needing to reimplement basic observability primitives and could focus on other more urgent business concerns.</p><p>The 10s brought two major changes that directly lead to the observability cost crisis covered in the following section:</p><ul><li>The rise of microservices and complex cloud architectures massively boosted the need for in-depth observability: microservices are inherently very difficult to implement and debug. Without very detailed observability tooling it is difficult to understand failures in these systems and root cause them in a reasonable timeframe.</li><li>The ZIRP era produced an army of large and fast growing internet companies that all ultimately converged on complex and hard to maintain microservice architectures. By nature of the economics of the decade, these companies largely were not concerned with making money, only growing as fast as possible. <a href="https://blog.pragmaticengineer.com/datadog-65m-year-customer-mystery/">Monumental infrastructure costs were the norm with relatively little concern given to cost reduction</a>.</li></ul><p>Another important innovation of the 10s was the commoditization of infrastructure building blocks via open source and open protocols. <a href="https://prometheus.io/">Prometheus</a>, <a href="https://opencensus.io/">OpenCensus</a>, <a href="https://opentracing.io/">OpenTracing</a>, <a href="https://opentelemetry.io/">OpenTelemetry</a>, <a href="https://github.com/elastic/elasticsearch">Elasticsearch&#x2F;Kibana</a>, and <a href="https://grafana.com/">Grafana</a> were all introduced during this time period. As it became easier and easier to build large scale distributed systems via IaaS, PaaS, CaaS, and FaaS, <em>the amount of telemetry emitted both by default from underlying systems and directly by engineers, and without regard to cost, increased exponentially</em>.</p><h2 id="The-real-root-cause-of-the-current-cost-crisis"><a href="#The-real-root-cause-of-the-current-cost-crisis" class="headerlink" title="The real root cause of the current cost crisis"></a>The real root cause of the current cost crisis</h2><p>By now it is hopefully clear what the real root cause of the current cost crisis in observability tooling is:</p><ol><li>The adoption of large scale service&#x2F;function architectures have vastly increased both the need for observability as well as the possible production points of telemetry.</li><li>Over the past 2 decades infrastructure as a service providers and open source have made it easier and easier to produce voluminous amounts of telemetry.</li><li>Engineers have to pre-define and send all telemetry data they <em>might</em> need – since it’s so difficult to make changes after the fact – regardless of the percentage chance of the actual need.</li><li>The ZIRP era and its “free money” coincided with the previous 3 points, leading to a bonanza of telemetry output, with little to no regard given to the cost of production or storage.</li></ol><p>Observability vendors will gladly identify any number of other causes such as “It’s important and should be 30% of one’s budget!” and “Stop using metrics and just use events!”, but the fundamental reality as was said previously is that there is simply no free lunch: massive production of telemetry at the source, without regard for the usefulness of the data, will inevitably lead to high costs and unhappy end-users. <em>Someone</em> has to pay for all of that transport and storage.</p><p>I should mention that OpenTelemetry, while a great advance for end-users that decouples data production from transport and storage, does not in any way solve this problem. If anything it exaggerates the existing crisis by making it even easier to emit large amounts of <em>pre-defined</em> telemetry data.</p><h2 id="Moving-away-from-pre-defining-all-observability-data"><a href="#Moving-away-from-pre-defining-all-observability-data" class="headerlink" title="Moving away from pre-defining all observability data"></a>Moving away from pre-defining all observability data</h2><p><em>So much</em> about building large distributed systems has changed in the last 30 years. And while there is no dispute that observability tooling has gotten more feature rich and prettier to look at, the fundamentals have really not changed at all. We pre-define all of the data we might ever need, and then pay for the privilege of emitting the data and storing it. Even worse, because we are not <em>completely</em> ignorant of the cost or the performance implications of emitting large volumes of telemetry, we often still do not have what we need to debug issues and must make changes and deploy, sometimes multiple times.</p><p>But perhaps there is a better way.</p><p>Another major infrastructure innovation of the 10s is what might be called the “control plane data plane split.” Spearheaded by projects like <a href="https://www.envoyproxy.io/">Envoy</a>, infrastructure concerns began to be split into two discrete components:</p><ol><li>Data plane: the part of the system that deals with the live traffic flow. For example, network routers or observability metric scrapers.</li><li>Control plane: the part of the system provides real-time configuration to data plane components. For example, network routing configuration or which specific metrics the metric scrapers should scrape.</li></ol><p>Historically, data plane configuration was notoriously hard to update, so it was largely static. Operators would define a configuration and then when updates were required go through a laborious and lengthy deployment process. With the rise of the control plane driven architecture, it became possible to update data plane configuration in near real-time, opening up a new age of dynamically adaptable infrastructure.</p><p>What if we were to apply the control plane &#x2F; data plane split to observability? And taken to its extreme, what if the data plane is the original source of telemetry before moving outside the process to be filtered, transformed, and stored by sometimes <em>many</em> proxy layers, at substantial cost? <em>What if by default we never send any telemetry at all</em>?</p><h2 id="Looking-forward"><a href="#Looking-forward" class="headerlink" title="Looking forward"></a>Looking forward</h2><p>I firmly believe that the end of ZIRP excess and the rise of control plane driven infrastructure is going to lead to a new golden age of large scale observability that spans both backend systems and the massive mobile&#x2F;IoT&#x2F;web networks they service. We are already beginning to see this in practice via more dynamic observability pipeline offerings (both open source and vendor driven), AI&#x2F;ML driven observability control, and observability products built from the ground up starting with fully dynamic control over production (full disclosure I started one such company).</p><p>I am personally very excited to work on this problem and leave behind 30 year old observability data production paradigms. I can’t wait to see what we as an industry come up with next. Onward!</p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;It’s no secret that observability costs are top of mind for many organizations in the &lt;a href=&quot;https://newsletter.pragmaticengineer.com/p</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>The next chapter: bitdrift</title>
    <link href="https://mattklein123.dev/2023/06/12/The-next-chapter-bitdrift/"/>
    <id>https://mattklein123.dev/2023/06/12/The-next-chapter-bitdrift/</id>
    <published>2023-06-12T00:00:00.000Z</published>
    <updated>2024-04-24T13:49:31.116Z</updated>
    
    <content type="html"><![CDATA[<p>Today I am thrilled to announce a watershed moment in my career: I am starting a company! Before I get into the details of what the new company is about, I will start with a bit of recent history.</p><p>During my 8 (!) years at Lyft we built some <em>very</em> impactful systems that enabled Lyft to weather its hypergrowth years. During this time we learned a lot of lessons that are broadly applicable across the industry. For the last year and a half I’ve had the opportunity at Lyft to develop a new business unit, aimed at commercializing some of the pieces that we felt would be most impactful, especially given the recent industry-wide renewed focus on infrastructure cost cutting. During this time we have made tremendous progress, including acquiring our first external customers.</p><p>By late last year it had become clear that in order for the fledgling opportunity to reach its full potential it would be necessary to spin out into an independent entity, so my co-founders <a href="https://sfba.social/@pmorelli">Pete Morelli</a> and <a href="https://www.linkedin.com/in/reflejo">Martin Conte Mac Donell</a> and I set out to do that. After months of ups, downs, and close calls (it turns out spinning out a company is hard!), we are an independent entity named <a href="https://bitdrift.io/">bitdrift</a>. We are starting as a team of 9, with 6 folks from Lyft joining us on this journey: <a href="https://jacksonhardaker.dev/">Jackson</a>, <a href="https://medium.com/@murki">Miguel</a>, <a href="https://www.linkedin.com/in/rafalaugustyniak/">Rafal</a>, <a href="https://www.linkedin.com/in/sarvar-muminov/">Sarvar</a>, <a href="https://twitter.com/snowypeas">Snow</a>, and <a href="https://www.linkedin.com/in/vicky-li/">Vicky</a>. This is a fantastic team, and I could not be more excited for what we and the new company are going to accomplish.</p><p>By now you are likely wondering: what does this company <em>do</em>? We will share much more soon, but we are going to stay in stealth a while longer while we work with more design partners and finish our go to market feature set. However, if you want a bit of a tease and a way to sign up to be notified when more info becomes available, check out our website at <a href="https://bitdrift.io/">bitdrift.io</a>.</p><p>While it is certainly bittersweet that my time at Lyft has come to an end - I will be forever grateful for the opportunity to build Envoy and share it with the world - I am beyond excited for this new chapter. More soon and onward!</p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;Today I am thrilled to announce a watershed moment in my career: I am starting a company! Before I get into the details of what the new c</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>5 years of Envoy OSS</title>
    <link href="https://mattklein123.dev/2021/09/14/5-years-envoy-oss/"/>
    <id>https://mattklein123.dev/2021/09/14/5-years-envoy-oss/</id>
    <published>2021-09-14T00:00:00.000Z</published>
    <updated>2024-04-24T13:49:31.116Z</updated>
    
    <content type="html"><![CDATA[<p>Today marks the <a href="https://eng.lyft.com/announcing-envoy-c-l7-proxy-and-communication-bus-92520b6c8191">5 year anniversary</a> of the open sourcing of <a href="https://www.envoyproxy.io/">Envoy Proxy</a>. It would not be an exaggeration to say that professionally, the last 5 years have been a roller coaster of epic proportions, my emotions ranging between exhilaration, pride, anxiety, embarrassment, boredom, burnout, and everything in between. Before a loss to the sands of time, I thought it would be fun to share a brief prehistory and history of the project, along with some of the lessons I have learned along the way about growing a large OSS project.</p><h2 id="Prehistory-and-history"><a href="#Prehistory-and-history" class="headerlink" title="Prehistory and history"></a>Prehistory and history</h2><h3 id="Prehistory"><a href="#Prehistory" class="headerlink" title="Prehistory"></a>Prehistory</h3><p>Except for a few small detours, my two decade career in the technology industry has been focused on low-level systems: embedded systems, operating systems, virtualization, filesystems, and most recently distributed system networking. My journey with distributed system networking began at Amazon in early 2010 where I had the fortunate opportunity to help develop the first high performance computing (HPC) EC2 instance types. I learned a tremendous amount about low-level high performance computer networking, though I had only limited exposure to distributed systems concepts.</p><p>In 2012 I joined Twitter, where after a few false starts I wound up on the edge networking team. This was my first real exposure to distributed system application networking concepts. I lead the development of a new HTTP edge proxy called the Twitter Streaming Aggregator (TSA), which was first launched in 2013 to scale delivery of Twitter’s “firehose” API (streaming all tweets). In the runup to the 2014 world cup, we decided to launch TSA as a general purpose HTTP&#x2F;HTTP2&#x2F;TLS edge proxy in points of presence (POPs) close to the event in Brazil. This was done primarily because it was not possible to deploy the existing resource hungry JVM based edged proxy on the small number of colocation racks that would be available in the POPs. My team delivered a successful and incident free world cup on an extremely compressed schedule. (I can fondly remember a period of time in which I would page myself when the software crashed, no matter the time of day, fix the bug, and redeploy the canary fleet to keep testing.) During my time at Twitter I also had exposure to the way the company performed service-to-service networking with great success via the Finagle library.</p><p>Around New Year’s Eve 2015, in what would begin the coda to my time at Twitter, TSA caused millions of Twitter Android users to get logged out via a bug I wrote:</p><blockquote class="twitter-tweet"><p lang="en" dir="ltr">Let me tell you about the time that I (indirectly) logged out about 40M Android users from <a href="https://twitter.com/Twitter?ref_src=twsrc%5Etfw">@Twitter</a> with a single character bug. They couldn&#39;t log back on for several hours, and the follow on impact on logged in users was ... not great. <a href="https://t.co/HeivgpUimN">https://t.co/HeivgpUimN</a></p>&mdash; Matt Klein (@mattklein123) <a href="https://twitter.com/mattklein123/status/984587431717486592?ref_src=twsrc%5Etfw">April 13, 2018</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> <h3 id="Joining-Lyft-and-the-creation-of-“Lyft-proxy”"><a href="#Joining-Lyft-and-the-creation-of-“Lyft-proxy”" class="headerlink" title="Joining Lyft and the creation of “Lyft proxy”"></a>Joining Lyft and the creation of “Lyft proxy”</h3><p>I left Twitter in the spring of 2015, partly due to the fallout from the logout incident, partly due to frustration about not being promoted, and partly due to a desire to try something new. I followed my boss from Twitter to Lyft, along with a bunch of my other Twitter coworkers. </p><p>When I joined Lyft, the company was relatively small (&lt; 100 engineers), and was struggling with a migration from a monolithic to microservices architecture. I have talked about this portion of the Envoy journey <a href="https://mattklein123.dev/appearances/">many times</a>, so I won’t rehash it again, but the very short summary is that Lyft was having all of the typical microservice migration problems, primarily rooted in networking and observability. Additionally, Lyft was already “polyglot” (using multiple languages and frameworks), so it seemed impractical to use a library based solution to solving these problems. Thus, based on my previous experience building TSA and observing how service-to-service communication worked at Twitter, and due to my immediate credibility via overlapping coworkers, I proposed building a new application networking system called “Lyft proxy.”</p><p>After some spirited discussion that included whether the new proxy should be built in Python (yes, really), we agreed on the broad outlines of the project and settled on using C++ as the implementation language. At the time C++ seemed the only reasonable choice. Would I choose C++ today? No. However, today is not early 2015, eons ago in the technology world.</p><p>This part of the history would not be complete without the origin of the name “Envoy.” We were setting up the initial devops scaffolding for the project when a forward thinking coworker (Ryan Lane) said that we couldn’t call this new project “Lyft proxy,” we had to pick something better. Always practical, I went to the thesaurus, looked up “proxy,” and settled on Envoy as the new name.</p><h3 id="Lyft-rollout"><a href="#Lyft-rollout" class="headerlink" title="Lyft rollout"></a>Lyft rollout</h3><p>I didn’t start in earnest on the Envoy source code until the summer of 2015. Those months were some of the most fun of my career. Empty source files and no support burden should be treasured while they last, because they don’t last long. I worked long hours toward producing something that would add value to Lyft within a reasonable amount of time (by my definition 3-4 months for a project of this type.). Lyft had given me a tremendous amount of rope to hang myself with, as the saying goes, and I was committed to making sure said hanging did not happen.</p><p>Of course, my efficiency can mostly be attributed to being fresh off of the compressed development schedule and many mistakes (mostly my own) that went into TSA at Twitter. I knew what mistakes not to make, what abstractions were needed, what type of testing worked and what didn’t, etc.</p><p>The initial version of Envoy that was readied for production in the fall of 2015 contained just a tiny fraction of the functionality and sophistication that the project contains today. It did not support TLS termination, only supported HTTP&#x2F;1, and had extremely simplistic routing and resilience features. What it did have was the bones of what you see today. There have been very few major refactors in the history of the project, primarily because, as I said previously, I knew what was coming and what abstractions needed to be in place in order to support the functionality. What Envoy <em>did</em> have from the very beginning was top notch observability output, in the form of metrics and logs. In 2021, this type of network observability is table stakes (thanks in large part to the success of Envoy), but it was not so at the time.</p><p>Envoy was first rolled out at Lyft as an edge proxy, sitting behind the AWS ELBs that were providing TLS termination. By late fall of 2015 Envoy was serving 100% of Lyft traffic, and the edge dashboards that were produced by the system paid dividends immediately (e.g., providing API call percentile latency histograms, per endpoint success rate and request rate, etc.).</p><p>Shortly after the initial launch, another Twitter coworker (Bill Gallagher) joined me on the project and we quickly added features, such as TLS termination, HTTP&#x2F;2 support, more routing and load balancing functionality, etc.</p><p>At the same time, Lyft’s Envoy based “service mesh” started to take shape. First, Envoy was deployed next to the PHP monolith to replace HAProxy and some of its inherent operational issues (at the time HAProxy was still single threaded for example) to aid with MongoDB proxying. It would not be an exaggeration to say that a substantial portion of Envoy’s early development was targeted towards MongoDB stability (load balancing, rate limiting, observability, etc.).</p><p>The benefit of direct Envoy based observability between the edge fleet and the monolith was immediately obvious. Shortly after, we deployed Envoy next to some of the high RPS decomposed microservices to aid in troubleshooting networking issues. The value was proven there as well. Over time we expanded beyond an observability focus and added features to aid in system reliability such as direct connection and service discovery (skipping internal ELBs), outlier detection, health checking, retries, circuit breakers, etc. The number of load based major incidents at Lyft slowly decreased from a frequency of every 1-2 weeks to much less. Envoy cannot take credit for all of that decrease, of course, but the network abstractions it provided did help a substantial amount.</p><p>In early 2016, we decided to push for a service mesh with 100% coverage. Initially, we thought it was going to be a slog that would require top-down mandates. In practice, <em>teams signed up to do migrations because  the benefit they would get was evident</em>. “Carrot” migrations are almost always successful. “Stick” migrations are rarely successful, or if they are, leave behind a trail of tears and anger within the organization.</p><p>By mid 2016 Envoy was used for all network communication at Lyft including edge serving, service-to-service communication, databases, external partners, etc. By any measure the project had been a resounding success, helping Lyft complete the microservice migration, increasing overall reliability, and abstracting the network such that most engineers did not need to know anything about the real system topology. Bill had since left the project to work on other things at Lyft, and in his place Roman Dzhabarov and Constance Caramanolis had joined me. Our small team developed and operated Envoy for all of Lyft.</p><h3 id="Road-to-OSS-and-launch"><a href="#Road-to-OSS-and-launch" class="headerlink" title="Road to OSS and launch"></a>Road to OSS and launch</h3><p>By the summer of 2016 we started to have a serious discussion about open sourcing Envoy. Early Lyft employees had an appreciation for open source and what it had done for the company. It was clear that Envoy was not Lyft’s primary business, so why not put it out there and give back? I will be honest in saying that we all approached the open sourcing process with different goals and expectations, as well as a substantial amount of naivety around what would happen if the project became very successful.</p><p>Prior to Envoy, I had used quite a bit of open source, but I had almost no experience with open source contributions and zero maintainer experience. (I did have a <a href="https://github.com/torvalds/linux/commit/00370b8f8dd6e3171b8202f9c5187a5f73e99497">single commit</a> in the Linux kernel though!) Open sourcing Envoy seemed like a great opportunity to expand my skill set and learn something new, possibly further my career, and frankly, I had no desire for there to be a TSA v3 at a third company. For Lyft, Envoy was a substantial piece of engineering, and leadership felt that open sourcing would lend credibility to Lyft as an engineering organization and help with recruiting. As I said before, all of us were naive about what it takes to both create successful open source and - more importantly - nurture it if it becomes successful.</p><p>But, we decided to give it a shot. We spent a good portion of the summer of 2016 working on documentation (Jose Nino joined the team around this time and his first task was reading and helping improve all of the docs), cleaning up the repository to make it “less embarrassing,” working on a website, a launch blog post, etc. I am truly grateful for my coworkers at Lyft during this time who not only supported us but helped us with myriad tasks including website design, logos, and more. Even at this early time, it was intuitive to us that first impressions matter, and if we were going to make a go of open source we had to make a good first impression via quality documentation, web presence, etc.</p><p>During this period we also used our industry connections to meet with some of Lyft’s “peer companies” (“unicorn” bay area internet startups) to show them what we had done with Envoy and get their feedback, thinking that if we managed to get a launch partner before going public it would be a major help to the project. All of these meetings were very friendly, and across the board all of the companies we met with were extremely impressed with what we had accomplished. But, as is obvious in hindsight, all of them said that there was no way they could adopt Envoy right away with their small infrastructure teams. They wished us the best with open sourcing and said they would check back later. We couldn’t help but feel depressed at the outcome of these meetings, but we pushed forward anyway.</p><p>In August of 2016, I had my first auspicious meeting with Google. A Lyft coworker (Chris Burnett) had spoken at a gRPC meetup and mentioned Envoy as it related to Envoy’s <a href="https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/other_protocols/grpc#grpc-bridging">gRPC bridging</a> support. Unbeknownst to me, Google was preparing for the launch of Istio on top of NGINX when they found out about Envoy. One meeting led to another, and then many more, and before Envoy was open sourced a substantial number of Google employees had already seen the source code and documentation. (More on this later.)</p><p>By the beginning of September we were ready, and set the open source day as September 14th. In general I’m a (over?) confident person, but there have been times in my life where I had a significant amount of anxiety about my ability to succeed. The ones that immediately come to mind are: starting high school, starting college, and starting at Microsoft after college. And open sourcing Envoy was one of those times. I remember being petrified about the public reaction. What would people say? Would the feedback be positive or vicious? Although we were a small team by the time we open sourced, I had still written 90% or more of the code, and felt like putting it into the public domain was a reflection on myself and my abilities.</p><p>As scheduled, <a href="https://eng.lyft.com/announcing-envoy-c-l7-proxy-and-communication-bus-92520b6c8191">Envoy became open source</a> on September 14th, 2016. I remember celebrating with my wife and saying something along the lines of: “I will be happy if we can get just one other company like Lyft to use Envoy.”</p><p>The reaction to the open source release was almost universally positive. Much to our surprise, almost immediately, we started hearing from big companies, not small ones. Within weeks we were talking to Apple, Microsoft, and the conversations with Google kept picking up pace. Large companies had issues with existing solutions, and had large teams of people ready to dive in and work on solving those issues. Ironically (at least in the view of the Twittersphere), C++ was a help here, not a hindrance. The large companies all already had ample C&#x2F;C++ development resources, existing libraries they wanted to integrate, etc. C++ was a selling point to them.</p><p>During this time, not surprisingly we had the most interaction with folks at Google. Initially primarily the teams building Istio, but gradually we spent more time with Anna Berenberg, now a distinguished engineer at Google leading various networking and load balancing efforts. That relationship would turn out to yield the “jet fuel” that really launched the project in early 2017.</p><h3 id="Rocket-ship-takes-off"><a href="#Rocket-ship-takes-off" class="headerlink" title="Rocket ship takes off"></a>Rocket ship takes off</h3><p>By early 2017, it was becoming clear that Envoy was gaining traction quickly. Google committed to replacing NGINX with Envoy for Istio (which eventually launched in the spring of 2017), and much more importantly for the future of the project, Anna’s large team working on GCP cloud load balancing features began their march towards using Envoy for various cloud load balancing products as well as internal use cases (this was all very secret during this time period but is now well known).</p><p>I will always remember that period interacting with Google as being one of the most stressful of my career. In all honesty, it felt like an acquisition (inquisition?) process. I remember long meetings and email threads justifying our technical decisions, “interviews” in which Google was trying to determine whether we would be a good OSS partner to work with, etc. It was painfully obvious to us at the time that landing this “acquisition” would put Envoy on a trajectory that we could never achieve on our own, so we did everything in our power to make it a success, which it ultimately was. And, our work with Google truly has been an outstanding partnership over the last 4+ years. Early Google cloud engineers that eventually became maintainers, Harvey Tuch and Alyssa Wilk, brought loads of talent to the project, both technically, as well as leaning into open source and the community. My gratitude to them is immense and the project would not be what it is today without them. The rest of the Google engineers who have contributed to the project over the years (there are now many) have added an immense amount of engineering horsepower that the project would not have otherwise had, in addition to universally being excellent community stewards. I certainly had concerns about the initial Google partnership (technical and philosophical differences, etc.), but I can honestly say that none of those concerns have become a reality.</p><p>Apart from ensuring the success of the Google collaboration, both across Istio and GCP teams, we were also spending a considerable amount of time working with and onboarding other companies and maintainers, many of whom have had outsized impact on the project and are still heavily involved today either as maintainers, contributors, or users. The project would not be what it is today without these early community members and I am extremely grateful to them as well for placing their trust in the project.</p><p>At the same time, as the project continued to gain traction, I started to receive a substantial amount of investor interest in Envoy. There was a strong desire to get me to leave Lyft and start a company around the project. I <a href="https://medium.com/@mattklein123/optimizing-impact-why-i-will-not-start-an-envoy-platform-company-8904286658cb">wrote about this part of the journey</a> so I won’t rehash it here, other than to say that a lot of time and headspace went towards processing all of these interactions. As the linked post describes, I ultimately decided to stay at Lyft and not start a company in order to support Envoy’s continued success.</p><p>Meanwhile, I still worked at Lyft, and as I will discuss further later, I was increasingly working two jobs. My first job was internally leading the networking team and operationally supporting Envoy at Lyft. My second job was being the public face of Envoy including OSS leadership, code reviews, fixing bugs, writing features that would further the project, speaking at conferences, helping other companies adopt and deploy Envoy, etc. I was starting to get spread too thin and showing signs of burnout. However, by mid 2017 there was no denying the fact that Envoy’s trajectory was substantially “up and to the right.” Adoption continued to climb across major corporations, “peer companies,” vertical products and services, etc.</p><h3 id="CNCF-donation-and-burnout"><a href="#CNCF-donation-and-burnout" class="headerlink" title="CNCF donation and burnout"></a>CNCF donation and burnout</h3><p>By the fall of 2017, two things were clear:</p><ol><li>Envoy was outgrowing what the Lyft OSS apparatus could provide. The project needed help with legal, public relations, marketing, event organization, etc.</li><li>I was fast approaching total burnout, and needed to figure out a sustainable path forward.</li></ol><p>To address point one, we finally agreed to consider moving Envoy to the CNCF. The CNCF had been courting the project for months, but it never seemed like there was any compelling reason to join. By late 2017, it was clear that CNCF resources would be at least neutral to the project, if not a net benefit. We began the submission process and ended up <a href="https://eng.lyft.com/envoy-joins-the-cncf-dc18baefbc22">joining the foundation</a> almost exactly a year after we initially open sourced the project. I am thankful to Alexis Richardson and Chris Aniszczyk for shepherding the project through this process.</p><p>Point two was much more complex. Fundamentally, I was working more hours than I had capacity to work, effectively across two different jobs. Furthermore, I was expecting my first child, due in early 2018, which as the arrival date got closer was causing me increasing anxiety. By this time it had become clear that I had not done a good enough job on setting expectations and boundaries on what I was capable of providing to Lyft while still focusing on the continued growth of Envoy from an industry perspective. Increasingly, I was letting things drop at Lyft, getting into interpersonal squabbles, and not meeting the expectations of my level in terms of providing mentorship and leadership to more junior team members.</p><p>In short, I was hitting my breaking point and ultimately I chose Envoy over Lyft, to the detriment of my Lyft coworkers. I would like to think that if I had been more transparent with the Lyft leadership about my workload in early to mid 2017 I might have avoided some of the worst outcomes, but the unfortunate reality is that resourcing OSS industry work which is not immediately obviously useful to the employing company is a complex endeavor. It might have gone better and it might not have. In any case, while I regret some of the interpersonal issues that I could have handled better, for better or worse I do not regret focusing on Envoy. My priority was Envoy over Lyft and I did what I thought I had to do at that time to make it succeed.</p><h3 id="Plotting-a-more-sustainable-path"><a href="#Plotting-a-more-sustainable-path" class="headerlink" title="Plotting a more sustainable path"></a>Plotting a more sustainable path</h3><p>My first child was born in February of 2018, and Lyft’s extremely generous paternity leave policy provided a natural break and reset for me. I got some space from Lyft, and started to think more deeply about what I wanted and what would be sustainable for me.</p><p>When I came back from paternity leave, I was clear with the Lyft leadership that I could no longer participate in the “day to day” of operating Envoy at Lyft. Conversely, the infrastructure team also wanted some separation from me due to some of the fallout from late 2017. Due to this, I stepped back substantially, and actually took a complete hiatus from infrastructure at Lyft to work on writing the firmware networking code in the Lyft Bikes and Scooters initial release in mid to late 2018. This was an amazing team effort to get something shipped on a compressed time scale, and I really enjoyed doing something completely different for a few months.</p><p>2018 was also the year in which I aggressively started to figure out what it would look like to “replace myself” within the Envoy OSS community. I spent a substantial amount of time (and continue to spend a substantial amount of time) grooming maintainers, new contributors, organizing the first dedicated EnvoyCon, etc. Any leader should always have a goal of making sure that the organization will continue to function well should that leader step aside one day.</p><p>By the end of 2018, my major burnout risk had been sorted out, and I was working reasonable hours again and spending plenty of time with my wife and son, splitting my time roughly 50&#x2F;50 between Envoy OSS work and general infrastructure leadership at Lyft. To be clear, the privilege that came from Envoy’s success enabled me to carve out this work life balance with Lyft. Over time, as my industry stature increased, my leverage increased in parallel, making it easier to set the terms of my employment as I liked them. Not many have the fortune of being in this situation and I understand how lucky I have been to “break through” to the other side of the burnout wall without having to leave my job.</p><h3 id="Envoy-starts-to-grow-up"><a href="#Envoy-starts-to-grow-up" class="headerlink" title="Envoy starts to grow up"></a>Envoy starts to grow up</h3><p>Since 2019, and through Covid, I have continued roughly the 50&#x2F;50 split between Lyft infrastructure leadership and OSS leadership that I described above. There have certainly been times of monotony and yearning for something different (historically I am a habitual job changer - 6.5 years is by far the longest I have ever worked on one thing), but overall I have enjoyed seeing Envoy move from being an “upstart” to more of a “teenager.” I’m no longer preoccupied with doing everything my competitive brain can come up with to make Envoy an outsized success, because frankly Envoy is an outsized success, has swept the market, and has changed what users have come to expect from their application load balancing tools. Instead, I’m more focused on project sustainability. We are in this for the long haul, and these days I feel much more like a run of the mill CEO looking at attrition numbers, priorities, budgeting, security issues, etc. It’s not to say this is not useful work; it clearly is, it’s just a different kind of work from the early days which was substantially more technical and fast paced.</p><p>As of late 2021, the thing I am most proud of about Envoy is that in my opinion the community has become self-sustaining. We have an incredible group of maintainers, contributors, and users who are passionate about the project’s success and have all played a part in making Envoy what it is today. It is truly a team effort.</p><h2 id="Lessons-learned"><a href="#Lessons-learned" class="headerlink" title="Lessons learned"></a>Lessons learned</h2><p>The past 5 years have been an epic journey. While I feel I have learned relatively little technically, I have grown and learned so much about leadership, community building, and all of the other non-technical things that go into building a successful enterprise, whether corporate or a major open source success story. What follows are short summaries of some of my main learnings.</p><h3 id="Successful-OSS-is-like-starting-a-business"><a href="#Successful-OSS-is-like-starting-a-business" class="headerlink" title="Successful OSS is like starting a business"></a>Successful OSS is like starting a business</h3><p>Perhaps controversially, I think that if one has a goal to create an extremely successful OSS project they need to think of it like starting a business. There are lots of factors involved in starting a business beyond the core technology:</p><ul><li>Hiring (in OSS this translates to recruiting contributors and maintainers)</li><li>Customer acquisition (in OSS this translates to users)</li><li>Documentation and technical writing</li><li>Public relations</li><li>Marketing</li><li>Legal (trademarks, licensing, etc.)</li><li>HR (in OSS this translates to resolving community disputes and setting culture)</li><li>Funding (in OSS this translates to ancillary costs like CI, finding maintainers jobs that allow them to work part or full time on the project, etc.)</li><li>General catch-all leadership and direction setting. There are limited resources and lots of things that can be worked on. The business&#x2F;project needs to focus on the most important things to achieve product market fit.</li></ul><p>Intuitively, I knew this going into the initial open source effort for Envoy, and I aggressively pursued all of the above areas as I worked to grow the project from where it started to what it is today. Everything in the above list is critical and a project is unlikely to succeed without all of them, especially if the technology area is crowded with well financed corporate competitors.</p><p>I strongly encourage those contemplating a large open source effort to invest in the above areas ahead of time to make the best possible impression on day one. Additionally, new open source projects should be prepared to invest more heavily in the above areas if the project grows and starts to see adoption.</p><p>Not surprisingly, I do relatively little coding on Envoy these days. My time on the project is primarily managing all of the non-technical aspects of the project (everything in the above list and more!) and making sure things are on track. Most of the coding items I do take on are “janitorial” background projects that are good for the project, but are not very much fun and are not likely to inspire other contributors (which I of course have no say over what they do on a day to day basis and am incentivized to keep them happy as much as possible so they don’t leave).</p><h3 id="End-user-driven-OSS-is-a-structural-advantage"><a href="#End-user-driven-OSS-is-a-structural-advantage" class="headerlink" title="End-user driven OSS is a structural advantage"></a>End-user driven OSS is a structural advantage</h3><p>These days a lot of “big OSS,” especially in the infrastructure space, is financed by large corporations and venture backed startups. I won’t detour into a discussion about the difficult economics of OSS as I <a href="https://medium.com/@mattklein123/the-broken-economics-of-oss-5a1b31fc0182">already wrote about it</a>. I will say that I strongly believe that end-user OSS has a substantial advantage over corporate and venture backed OSS: an initial captive customer that is almost certainly deriving value from the software, otherwise the software wouldn’t be funded. This virtuous cycle of building something alongside a customer is powerful. It almost universally leads to better outcomes: software that is more reliable, more focused, and with less feature bloat. There are many examples of end-user driven OSS that then goes on to achieve substantial commercial success. This is not surprising to me given the solid foundation and inbuilt product market fit. I would love to see more end-user driven OSS than we do today, though I recognize the economics are difficult. For those who have the opportunity, lean into the structural advantage that this type of software has!</p><h3 id="Don’t-follow-the-hype-follow-the-customer"><a href="#Don’t-follow-the-hype-follow-the-customer" class="headerlink" title="Don’t follow the hype, follow the customer"></a>Don’t follow the hype, follow the customer</h3><p>This is perhaps a corollary to “successful OSS is like starting a business” and “end-user driven OSS is a structural advantage,” but I can’t stress how critical it is to focus relentlessly on what customers actually want versus what the hype cycle thinks they might want. For example, over the years, there has been an endless amount of fun poked at Envoy for being written in C++. Do I like C++? No, not really. Did it get the job done in 2015 and appeal to the initial set of main users? Definitely. This is an example of focusing on the customer and the market and not giving into hype with no real “business” impact. If one treats OSS like a business, it becomes immediately clear that being customer and market focused is the only way to achieve massive success. With Envoy I have spent a substantial amount of time arguing for the end user, to make sure we are building things in a way that benefits everyone, and not just a small set of niche users.</p><h3 id="Default-to-“yes-”-via-extensibility"><a href="#Default-to-“yes-”-via-extensibility" class="headerlink" title="Default to “yes,” via extensibility"></a>Default to “yes,” via extensibility</h3><p>Following the customer can often lead to customer requests that may not fit cleanly into a project’s architecture. From an OSS perspective, losing focus of the primary goal of the project can lead to feature sprawl, unmaintainable software, and overburdened maintainers. At the same time, saying “no” is a guaranteed way to lose a potential user.</p><p>With Envoy I wanted to make sure that we could always at least say “yes, but…” in the form of offering a robust extensibility model that would allow users to fulfill their needs without having every change and feature need to be pushed upstream. This strategy has paid dividends many times over by reducing maintainer burden, allowing users to solve their own problems and, more importantly, pushing Envoy into use cases that I never would have imagined when the software was initially designed.</p><p>Extensibility, especially for OSS building blocks, is critical.</p><h3 id="Quality-matters"><a href="#Quality-matters" class="headerlink" title="Quality matters"></a>Quality matters</h3><p>A further corollary to following the customer is that quality really does matter. Users want software that is easy to operate, is relatively free of bugs, cares about security, etc. At times it can seem that because OSS is “free,” quality is not guaranteed. This is maybe true in spirit, but practically users will not converge on a piece of software in large numbers until it’s clear that a project takes software quality seriously. Because acquiring users is a flywheel that acquires further users (especially when moving from early to late adopters) it’s even more critical to make sure that time is budgeted for overall software quality.</p><p>With respect to Envoy, I have always had a “zero crash” philosophy. Any crash is investigated and fixed, no matter how infrequent. This kind of attention to stability and quality does not go unnoticed.</p><h3 id="Community-is-the-only-way-to-scale"><a href="#Community-is-the-only-way-to-scale" class="headerlink" title="Community is the only way to scale"></a>Community is the only way to scale</h3><p>It’s obvious, but I will say it anyway: community is the only way to scale OSS. This is a community of maintainers, contributors, and users. Furthermore, the <em>tone</em> of the community is set at the very beginning of the project and is extremely hard to change. Humans tend to follow norms. Once norms are set, outliers to those norms tend to be shunned, no matter what the norms are. Thus, the initial public tone of the project is extremely critical to setting its long term community trajectory.</p><p>When we made Envoy OSS, I put in a huge amount of effort into working with people on GitHub, using constructive and welcoming language. In general I did everything I possibly could to make Envoy a welcoming place where people wanted to come and contribute, whether that be maintenance, the occasional contribution, or users helping other users.</p><p>Of all the different types of success that Envoy has had, the part that gives me the most personal gratification, by far, is that I have been told by a non-trivial number of people that they had sworn off OSS, and especially infrastructure OSS, because they felt people in most projects were awful to each other. Conversely, they love contributing to Envoy because the community is so respectful and welcoming to each other. It required a lot of hard work and discipline, especially early on in the project, to achieve this outcome and it has paid off in multitudes.</p><p>Do not underestimate the compounding effect of setting a project’s culture and tone from the very beginning.</p><h3 id="Mixing-commercial-and-OSS-interests-is-very-difficult"><a href="#Mixing-commercial-and-OSS-interests-is-very-difficult" class="headerlink" title="Mixing commercial and OSS interests is very difficult"></a>Mixing commercial and OSS interests is very difficult</h3><p>There has been much written about the difficult economics of OSS (<a href="https://medium.com/@mattklein123/the-broken-economics-of-oss-5a1b31fc0182">including my own article</a> which I referenced above). Suffice to say that trying to mix commercial success and open source success is very difficult, primarily because the successes can often be at odds with each other.</p><p>I do believe that Envoy threaded this needle via both its robust API and extensibility system. Essentially, Envoy became a tool that is now consumed by a large variety of vertical products and services. This has yielded a community that is filled with companies who have chosen to work together on a common substrate, even while shipping higher layer products that compete with each other, via innovating at the extension&#x2F;API&#x2F;control plane&#x2F;UI&#x2F;UX layer.</p><p>Any successful open source project will see substantial commercial&#x2F;investor interest. If the goal of a project is to maintain a vibrant community while still allowing commercial success (which I would argue is required for overall project success as the money has to come from somewhere), it’s extremely important to think up front about how to split the core from the commercial layers. The practicality and strategy of doing this will differ depending on the project and technology, but I believe that focusing on a robust API&#x2F;extensibility split is a fruitful strategy. </p><h3 id="Foundations-are-tricky"><a href="#Foundations-are-tricky" class="headerlink" title="Foundations are tricky"></a>Foundations are tricky</h3><p>There is much discussion in the modern open source discourse about the role of foundations. I’m not going to comment heavily on this topic, but my main piece of advice is not to get distracted by foundations and the theoretical benefit they might provide. Instead, focus aggressively on product market fit, shipping quality software, and providing value to users. The rest will come naturally if these things are achieved.</p><p>For very successful projects, foundations, and more specifically neutral trademark holding grounds, are useful constructs, so I would definitely consider one at that point. The value that Envoy has derived from being part of the CNCF has increased over time as the project has matured. CNCF employs OSS lawyers, marketers, public relations personnel, a top notch event staff, and more. These extra resources are invaluable when it comes to “running the business.”</p><h3 id="Think-about-governance-up-front"><a href="#Think-about-governance-up-front" class="headerlink" title="Think about governance up front"></a>Think about governance up front</h3><blockquote class="twitter-tweet"><p lang="en" dir="ltr">Every time I see another OSS community leadership blowup, I can&#39;t help but think that BDFL is in practice the lowest drama and most practical way of running large OSS projects over the long term.<br><br>I wish this were not the case but it certainly seems that it is.</p>&mdash; Matt Klein (@mattklein123) <a href="https://twitter.com/mattklein123/status/1437512942962954244?ref_src=twsrc%5Etfw">September 13, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script><p>Open source governance is <em>extremely</em> hard. By its very nature, open source is anarchic, without a clear leadership structure. There is no one size fits all approach to project governance, and each project has to find its way forward, either via a “BDFL”&#x2F;CEO type model, a steering committee, an Apache PMC like process, etc. All governance models have pros and cons and have different failure modes.</p><p>What’s most important is to think hard about governance up front, before the project becomes large and successful. Write down a set of rules and norms and especially take time to document the project’s conflict resolution process.</p><p>Also realize that per my comment above about how community norms are set early, early project maintainers will have an outsized impact on the overall style of dialog and conflict resolution, much like early employees at a company have an outsized impact on the company’s culture.</p><p>We have been extremely fortunate within Envoy to not have had any major disagreement that I can remember that was not quickly resolved amicably. We have never in the history of the project needed to invoke the <a href="https://github.com/envoyproxy/envoy/blob/main/GOVERNANCE.md#conflict-resolution-and-voting">maintainer voting process for conflict resolution</a>. This is in my opinion a substantial achievement, and a testament to the quality and professionalism of all of the maintainers, especially given how popular the project has become and all of the commercial interests that surround it.</p><h3 id="Open-source-contribution-expectations-are-critical"><a href="#Open-source-contribution-expectations-are-critical" class="headerlink" title="Open source contribution expectations are critical"></a>Open source contribution expectations are critical</h3><p>I alluded to this above, but much of my own burnout stemmed from a poor job of setting reasonable expectations with my employer on the amount of time I needed to spend managing Envoy’s open source growth. I’m not going to lie and say that having such a conversation will magically make an employer carve out lots of time for someone to work on OSS, especially items that may not be directly applicable to one’s day job. With that said, I do believe it’s very important for all involved to have open and honest expectations about the open source process. The following are reasonable questions to ask either before open sourcing a project or before starting to work in an open source capacity:</p><ul><li>Employees should ask their employer why they want to open source something.</li><li>Employers should ask their employees why they want to open source something. (It’s completely reasonable that the answers to this question and the previous one are different, but it should be discussed in the open.)</li><li>Employees should ask their employer what will happen if the project becomes successful? What resources will be available to the project? How much time will the employee be able to work on general OSS issues with the goal of directly furthering the project?</li></ul><p>Mismatched expectations between employers and employees is a recipe for future resentment and burnout.</p><h3 id="Proxies-are-easy-APIs-are-hard"><a href="#Proxies-are-easy-APIs-are-hard" class="headerlink" title="Proxies are easy, APIs are hard"></a>Proxies are easy, APIs are hard</h3><p>To some, it may seem like the underlying network proxy mechanics that Envoy provides is the complicated part of the project. As it turns out, the proxy bits are (in my opinion) relatively simple compared to what it has taken to evolve a stable API ecosystem for Envoy. The mechanics of balancing API ergonomics for both human and computer consumption, maintaining stability across versions, growing the API to support other clients such as gRPC, specifying protocol semantics so that Envoy can speak to hundreds (possibly thousands?) of different management servers, etc. are mindboggingly complicated. I’m proud of what the team has achieved in this area (and a special shout out to Harvey who has driven much of this work), even with some mistakes along the way (such as the forced migration from v2 of the API to v3).</p><p>If a piece of software offers an API, and more importantly wants this API to be a critical building block for other systems, don’t underestimate the cost and complexity of offering a stable and ergonomic API surface. The flipside of this is that robust APIs are a strong part of an ecosystem’s flywheel of more products and users yielding further products and users, so in my opinion it’s well worth the effort.</p><h3 id="Don’t-ignore-burnout"><a href="#Don’t-ignore-burnout" class="headerlink" title="Don’t ignore burnout"></a>Don’t ignore burnout</h3><p>I’m not one to believe that a good work life balance is achievable 100% of the time if one wants to accomplish big things. The reality is that any success is a mix of existing privilege&#x2F;opportunity, a good idea, good execution, and a whole lot of luck including being in the right place at the right time. All of these things came into play with Envoy, and I’m not going to pretend that I didn’t work myself almost into the ground, especially in 2017. I would also do 2017 all over again, because from my perspective I did what I had to do to make the project a success. (Sometimes I wonder whether Envoy would have happened at all if I had already had children. I’m not sure that it would have, but that is a subject of a much longer conversation!)</p><p>With all of that said, the type of epic pushes that I describe in 2017 can only go on for so long until a person breaks. I encourage everyone to be reflective on an ongoing basis about their work life balance, and figure out a sustainable path forward for themselves. All situations are different, and I can’t offer any one piece of advice for avoiding burnout, but I think being reflective is a good start, and something that I have had to work on quite a bit for myself.</p><h2 id="Thank-you"><a href="#Thank-you" class="headerlink" title="Thank you"></a>Thank you</h2><p>Working on Envoy for the past 6.5 years, 5 of those as open source software, has been the highlight of my career. The project’s success has truly been a team effort that I never could have accomplished on my own, and I am so proud of what all of us (maintainers, contributors, and users) have accomplished together. The maintainers and contributors who work on the project are the best group of engineers I have ever worked with; too talented a group to ever find themselves all at the same company or in the same geographic location - truly the theoretical potential of open source played out in practice. As a team we have had worldwide impact, changed what users expect from their software load balancing systems, and also built a vibrant and welcoming community. In my wildest dreams I never would have imagined that the project would become what it is today.</p><p>What the future holds for me is less clear. As I said above, my focus has shifted to sustainability. I want to make sure that should I leave one day, the project will remain healthy. With that said, that day is not yet here, and I look forward to helping to lead the project forward for the foreseeable future, to hopefully even greater success and adoption. Onward!</p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;Today marks the &lt;a href=&quot;https://eng.lyft.com/announcing-envoy-c-l7-proxy-and-communication-bus-92520b6c8191&quot;&gt;5 year anniversary&lt;/a&gt; of t</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>On the state of Envoy Proxy control planes</title>
    <link href="https://mattklein123.dev/2020/03/15/2020-03-14-on-the-state-of-envoy-proxy-control-planes/"/>
    <id>https://mattklein123.dev/2020/03/15/2020-03-14-on-the-state-of-envoy-proxy-control-planes/</id>
    <published>2020-03-15T03:00:49.422Z</published>
    <updated>2024-04-24T13:49:31.116Z</updated>
    
    <content type="html"><![CDATA[<p>I have been thinking a lot about <a href="https://www.envoyproxy.io/">Envoy</a> Proxy <a href="https://blog.envoyproxy.io/service-mesh-data-plane-vs-control-plane-2774e720f7fc">control planes</a> recently so I thought it would be useful to share some of my conclusions about the industry status quo and where I envision the state of the art progressing over the next few years.</p><h2 id="The-current-lay-of-the-land"><a href="#The-current-lay-of-the-land" class="headerlink" title="The current lay of the land"></a>The current lay of the land</h2><p>Although I am continuously talking to Envoy users, our now yearly <a href="https://envoycon2019.sched.com/">EnvoyCon</a>&#x2F;KubeCon has become an important check-in point for me as I try to wrap my head around the types of problems that are being faced deploying Envoy “on the front lines.” Although I have access to this type of information via Lyft’s deployment, having more data points allows me to get a better idea of the most important things the project can be working on to better serve the needs of the broadest possible set of users.</p><p>After attending the most recent EnvoyCon&#x2F;KubeCon and having some time to think about what I learned, a few high level points have become very clear to me:</p><ol><li>Although the number of “out of the box” service mesh and API gateway solutions based on Envoy continues to increase (e.g., <a href="https://istio.io/">Istio</a> and derivatives, <a href="https://kuma.io/">Kuma</a>, <a href="https://www.consul.io/docs/connect/index.html">Consul Connect</a>, <a href="https://aws.amazon.com/app-mesh/">App Mesh</a>, <a href="https://cloud.google.com/traffic-director">Traffic Director</a>, <a href="https://www.getambassador.io/">Ambassador</a>, <a href="https://projectcontour.io/">Contour</a>, etc.), the reality is that these products are on the bleeding edge. By bleeding edge I mean that it’s early days, and most deployments trying them out right now are relatively small and typically greenfield.</li><li>At the same time, I would conservatively estimate that there are now hundreds of organizations deploying Envoy-based service mesh and API gateway solutions with custom private control planes written directly against the <a href="https://www.envoyproxy.io/docs/envoy/latest/configuration/overview/introduction">xDS API</a> (often built on top of <a href="https://github.com/envoyproxy/go-control-plane">go-control-plane</a>), some at very large scale.</li><li>All of the organizations deploying custom control planes are solving many of the same distributed systems problems over and over again independently, not benefiting from the power of collaborative development, learning, and hardening.</li></ol><p>In the following sections I will touch on each of the above points in more detail and then discuss what I think we can do as a project to pragmatically help the greatest number of large scale Envoy users in the near term.</p><h2 id="Realities-of-greenfield-versus-brownfield"><a href="#Realities-of-greenfield-versus-brownfield" class="headerlink" title="Realities of greenfield versus brownfield"></a>Realities of greenfield versus brownfield</h2><p>Much of the current cloud native ecosystem is a shiny place that mostly assumes greenfield deployment. In this context, greenfield means starting from scratch with a set of cloud native technologies that have been designed and tested to work well together. Although as an industry we certainly have a long way to go to make greenfield cloud native systems easy to use (I’m looking at you massive tangles of YAML), we have made large strides in making the building blocks stable. On the other hand, large organizations already deploying legacy technology at very large scale have a different and more complicated problem entirely: attempting to bridge the old with the new without forcing users to undergo massive migrations, instability, and pain.</p><p>To use Lyft as a concrete example, our “legacy” compute stack is a bespoke build&#x2F;deploy system that uses raw EC2 virtual machines, auto scaling groups, etc. Our original Envoy-based service mesh and API gateway grew up tightly integrated into this system and all of its inherent assumptions. Over the last couple of years, Lyft has undertaken a migration to Kubernetes. Setting aside the discussion of whether this migration has yielded positive ROI, the technical requirements of such a migration are massive. We have built a mechanism to bridge our legacy system and new system into a unified compute platform, thus allowing services to be run simultaneously and transparently across both to allow for safe compute migrations. It’s almost inconceivable to think that one of the “out of the box” Envoy service mesh solutions could have been used for this purpose without massive modifications. (For more information on how Lyft adapted its service mesh to Kubernetes see <a href="https://www.youtube.com/watch?v=BTuDY2naDJI&list=PLj6h78yzYM2MF1Ti3Mrfa9P0IlavyZYWt">this excellent EnvoyCon talk</a> by Lita Cho and Tom Wanielista.)</p><p>One of the hardest problems we face in the cloud native space is balancing configurability with complexity and usability. The more opinionated a solution is, the less configuration it needs, and the less complex it is (at least theoretically). In this regard, greenfield solutions, and especially PaaS and FaaS, have a major leg up. They can make a variety of assumptions about compute stack, deploy tooling, networking, etc. that allow them to significantly reduce needed configuration, thus decreasing complexity and increasing usability.</p><p>As a project, Envoy has never tried to simplify configuration as a primary goal. We assume that Envoy is a tool that is used in a large variety of deployments and vertical products. This assumption works against us in the form of sometimes bewildered users that come to our documentation and APIs and don’t know where to start. At the same time, Envoy’s <a href="https://blog.envoyproxy.io/the-universal-data-plane-api-d15cec7a">rich API has been one of the driving forces behind its rapid adoption within the industry</a>, making this a fruitful tradeoff in my opinion. The main point is that configurability versus complexity is a sliding scale, and it’s impossible to make every customer happy, thus necessitating a layered approach to composing systems.</p><p>In this regard, the various service meshes and API gateways built on top of Envoy are approaching layering in a pragmatic way: they are using Envoy as a building block and creating a “simpler” and more opinionated platform on top. However, as previously explained, simplification is at odds with configurability, making it significantly more complicated (if not impossible) for these solutions to work in more complex brownfield deployments such as Lyft’s.</p><p>Lyft’s story is not uncommon and is representative of why Envoy is extensively deployed across the industry most often with a proprietary custom control plane written in-house: each of these organizations have independently decided that for their brownfield deployment it is more efficient to have full control over the Envoy xDS API and the control plane code that drives it. </p><h2 id="Common-control-plane-concerns"><a href="#Common-control-plane-concerns" class="headerlink" title="Common control plane concerns"></a>Common control plane concerns</h2><p>Will most organizations still be writing custom Envoy control planes in 3-5 years? I doubt it. In that timeframe we will have seen more migration to standard cloud native technologies and many of the current greenfield systems will have since become large scale deployments. In such a future world, I would expect the majority of deployments to use one of the vertical solutions that are being developed today. In the interim however, things are messy. The realities of large scale brownfield deployments are pushing users to develop custom Envoy control plane solutions, and all of them are facing similar problems at scale. These problems include:</p><h3 id="Immutable-infrastructure-driving-high-rates-of-system-change"><a href="#Immutable-infrastructure-driving-high-rates-of-system-change" class="headerlink" title="Immutable infrastructure driving high rates of system change"></a>Immutable infrastructure driving high rates of system change</h3><p>Immutable infrastructure compute systems such as Kubernetes typically drive very high rates of system changes, as containers are created and terminated rapidly due to autoscaling, deploys, batch jobs, etc. Our experience at Lyft has been that the rate of change can be an order of magnitude or more beyond that which occurred with our legacy system. A high rate of change in the compute&#x2F;network topology puts a substantial amount of pressure on the control plane; if not careful, a naive implementation is easily susceptible to runaway topology recomputations.</p><h3 id="Implementing-common-distributed-systems-best-practices-in-the-control-plane"><a href="#Implementing-common-distributed-systems-best-practices-in-the-control-plane" class="headerlink" title="Implementing common distributed systems best practices in the control plane"></a>Implementing common distributed systems best practices in the control plane</h3><p>An Envoy control plane has to implement a large number of standard distributed system best practices. This is partly due to immutable infrastructure leading to high rates of system change and partly due to the realities of scale in general. Such best practices include:</p><ul><li><strong>Rate limiting</strong>: Making sure the control plane does not bombard backend configuration discovery systems with too many requests (the K8s API, Consul, Zookeeper, etc. are all susceptible to similar DoS scenarios).</li><li><strong>Batching</strong>: Making sure that the control plane does not thrash every Envoy with too many sequential updates. While this is particularly important in high rate of change systems, the control plane typically needs to batch updates that are received by the configuration discovery system. Note that while Envoy itself does similar batching internally to avoid thrashing the data plane worker threads, this is typically not sufficient and is only a modest defense against a control plane requesting a high rate of system change.</li><li><strong>Back pressure</strong>: The control plane needs to detect when overloaded either by incoming Envoy client connections or by a configuration discovery system issuing too many updates in too short a period of time. During times of duress the control plane needs to start dropping updates and have mechanisms to catch up in the future and ensure that all Envoys eventually converge on the system’s target state.</li><li><strong>Caching</strong>: In order to maintain high performance given a large number of clients, most control planes end up implementing some amount of caching to avoid refetching the state of the world from the configuration discovery system independently for each client. Implementing caching correctly is not without significant challenges, particularly when using Envoy’s push-based xDS variant.</li></ul><h3 id="Large-scale-control-plane-features-including-incremental-xDS-and-endpoint-subsetting"><a href="#Large-scale-control-plane-features-including-incremental-xDS-and-endpoint-subsetting" class="headerlink" title="Large scale control plane features including incremental xDS and endpoint subsetting"></a>Large scale control plane features including incremental xDS and endpoint subsetting</h3><p>At large enough system scale, it becomes untenable to send every endpoint for a service to every downstream client for the following reasons:</p><ul><li>If using client-side active health checking this can lead to an N^2 health checking explosion.</li><li>Envoy’s memory usage scales mostly linearly with the number of upstream endpoints that it connects to. Thus, a large number of upstream endpoints leads to increased memory usage as well as inefficient connection pool utilization.</li><li>“Simple” control planes typically use the State-of-The-World (SoTW) xDS API which means that the control plane sends a complete snapshot of a resource set whenever any resource in that set changes. I.e., if a single endpoint in a cluster gets added or removed, the control plane needs to send every endpoint in the cluster to Envoy when using SoTW. This leads to a substantial amount of CPU and network bandwidth being required for small updates.</li></ul><p>The solutions to the previous two problems are twofold:</p><ul><li><strong>Subsetting</strong>: Using the known topology of both the downstream and upstream service, the control plane can send a subset of upstream endpoints to each downstream client such that the overall load on each endpoint remains similar.</li><li><strong>Incremental&#x2F;delta xDS</strong>: Each <a href="https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol#variants-of-the-xds-transport-protocol">xDS API implements both a SoTW and incremental variant</a>. Incremental xDS allows the control plane to send deltas to each client, at the expense of substantially more control plane complexity, as the control plane needs to keep track of the state of each connected client. However, implementing delta updates vastly reduces the CPU and network bandwidth required for performing small updates against each client.</li></ul><p>Each of the previous two solutions are far from easy to implement in practice.</p><h3 id="Control-plane-debugging-and-observability"><a href="#Control-plane-debugging-and-observability" class="headerlink" title="Control plane debugging and observability"></a>Control plane debugging and observability</h3><p>The debugging and observability requirements for operating a control plane at scale are not significantly different from operating Envoy at scale. It’s critical to understand the state of the control plane and its caches, whether the configuration has converged, what the current configuration is, etc. Although implementing such debugging and observability features are not complicated, each organization deploying Envoy at scale has duplicated this effort in a slightly different way.</p><h2 id="Moving-more-control-plane-engineering-into-the-open"><a href="#Moving-more-control-plane-engineering-into-the-open" class="headerlink" title="Moving more control plane engineering into the open"></a>Moving more control plane engineering into the open</h2><p>If we assume, as this post outlines, that deploying Envoy is going to be messy for the next 3-5 years as organizations eventually converge on vertical solutions and products, what can we do as a community to make deploying Envoy control planes easier for everyone currently writing custom solutions?</p><h3 id="Move-more-functionality-into-go-control-plane"><a href="#Move-more-functionality-into-go-control-plane" class="headerlink" title="Move more functionality into go-control-plane"></a>Move more functionality into go-control-plane</h3><p>The <a href="https://github.com/envoyproxy/go-control-plane">go-control-plane</a> project has existed for quite some time as a library that can be used to speed up development of Go-based Envoy control planes. The library provides the outline of things that a control plane needs to support including caching, configuration delivery, etc. It also handles the unglamorous task of compiling Envoy’s protobuf API to Go code.</p><p>However, go-control-plane is a very thin library and does not currently provide any of the distributed systems best practices functionality described above, nor does it implement subsetting or incremental&#x2F;delta xDS.</p><p>I’m often asked if Lyft will ever open source our control plane. The answer is no, primarily because of the brownfield tangle that I described earlier in the post. There are simply too many assumptions about Lyft’s legacy infrastructure and business logic built into the control plane. Not surprisingly, every organization of Lyft’s size or larger using Envoy says a similar thing.</p><p>What I think both Lyft and the industry <em>can</em> do is move more functionality into go-control-plane such that the library itself becomes more useful. This includes things like rate limiting, batching, back pressure, enhanced caching, a reference Kubernetes and <a href="https://smi-spec.io/">Service Mesh Interface (SMI)</a> implementation, etc. This obviously won’t help organizations that want to build their control plane in a different language, but with Go (like it or not) becoming the lingua franca of cloud native development this seems a reasonable compromise. Moving more functionality into the library will not produce a new service mesh product, but it will produce a more reliable base that we can all collaborate on, find bugs in, and harden.</p><h3 id="Develop-xds-relay"><a href="#Develop-xds-relay" class="headerlink" title="Develop xds-relay"></a>Develop xds-relay</h3><p>In addition to enhancing the out-of-box capabilities of go-control-plane, we are kicking off a project called <a href="https://github.com/envoyproxy/xds-relay">xds-relay</a> (<a href="https://docs.google.com/document/d/1X9fFzqBZzrSmx2d0NkmjDW2tc8ysbLQS9LaRQRxdJZU/edit">design document</a>). This easiest way to think about xds-relay is that it is a CDN for Envoy configuration. We believe that it is possible to create a self-contained server (built itself on go-control-plane) that can be deployed in front of any xDS compliant control plane “origin” server. The relay will be a scale out component that helps large Envoy deployments achieve high availability by implementing all of the distributed systems best practices outlined in this post in one open source place.</p><p>Additionally, once the xds-relay MVP (simple caching and scale out) is complete, there is a huge amount of potential for community collaboration on additional features such as:</p><ul><li><strong>State-of-The-World (SoTW) to incremental&#x2F;delta XDS conversion</strong>: It will be possible create SoTW to incremental conversion code in the relay, thus keeping the origin control plane simple and relegating the delta logic to shared open source code.</li><li><strong>Automatic endpoint subsetting</strong>: The relay will know about overall system topology in terms of raw xDS building blocks such as clusters, endpoints, etc. Thus, the relay should be optionally capable of performing endpoint subsetting directly without the origin control plane being aware of it.</li><li><strong>xDS translation hooks</strong>: Allowing transformation of Envoy configuration as it travels through the control plane pipeline is a frequent feature request. The relay would be a common location where this could optionally be performed.</li><li><strong>API-driven relay configuration updates</strong>: One of the design goals of the relay is that it will only ever speak raw xDS. With that said, there is nothing to prevent the relay from eventually becoming an API-driven control plane itself. There are many interesting directions to explore in this area!</li></ul><p>By moving much of the complexity of building Envoy control planes into open source, we can all collaborate together, find bugs together, and harden the implementation together, thus making the proprietary&#x2F;internal pieces much simpler to reason about. This is a win&#x2F;win for everyone. If you are interested in helping with relay development please reach out and join us!</p><h2 id="Conclusion"><a href="#Conclusion" class="headerlink" title="Conclusion"></a>Conclusion</h2><p>The rapid industry uptake of Envoy has seen the creation of many vertical products and services, but also the creation of hundreds of custom bespoke control planes. It has become clear that many organizations with a custom control plane are not going to give it up any time soon in favor of shrink wrapped service mesh and API gateway solutions, but they are also redundantly solving the same set of distributed systems and scaling problems. Over the next year, through projects such as go-control-plane enhancement and xds-relay, we can improve the status quo for the average Envoy user as well as increase the stability of the vertical products and services that will ultimately utilize these projects as building blocks.</p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;I have been thinking a lot about &lt;a href=&quot;https://www.envoyproxy.io/&quot;&gt;Envoy&lt;/a&gt; Proxy &lt;a href=&quot;https://blog.envoyproxy.io/service-mesh-da</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>Office hours</title>
    <link href="https://mattklein123.dev/2020/03/08/2020-03-08-office-hours/"/>
    <id>https://mattklein123.dev/2020/03/08/2020-03-08-office-hours/</id>
    <published>2020-03-08T14:54:57.000Z</published>
    <updated>2024-04-24T13:49:31.116Z</updated>
    
    <content type="html"><![CDATA[<p>Recently I started offering open office hours at Lyft. I was skeptical that anyone would signup, but it turns out that a lot of people have, and the conversations have been very engaging.I can’t speak directly for those that I have talked to, but I myself have learned a lot and I thinkit’s very useful for senior non-managers to make themselves available for random discussionswithout fear of imposition.</p><p>Because ~50% of my job is engaging with the industry via Envoy, CNCF, etc. I thought it wouldbe fruitful to set aside some time each week to have office hours open to anyone. This time can beused to talk about Envoy, CNCF, cloud native technologies, or just get general career advice. I’m open to anything! For more information on how to sign up please see <a href="/office-hours">this page</a>. I look forward to chatting with you!</p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;Recently I started offering open office hours at Lyft. I was skeptical that anyone would sign
up, but it turns out that a lot of people h</summary>
      
    
    
    
    
  </entry>
  
  <entry>
    <title>New website!</title>
    <link href="https://mattklein123.dev/2020/03/08/2020-03-07-new-website/"/>
    <id>https://mattklein123.dev/2020/03/08/2020-03-07-new-website/</id>
    <published>2020-03-08T00:00:00.000Z</published>
    <updated>2024-04-24T13:49:31.116Z</updated>
    
    <content type="html"><![CDATA[<p>Welcome to my new website! I’ve increasingly realized that I need a single digital hub where I can organize my contact information, bio, previous appearances, writing, etc. After many months of avoiding the task, here we are, and I’m quite happy with the (basic) result.</p><h2 id="Technical-details"><a href="#Technical-details" class="headerlink" title="Technical details"></a>Technical details</h2><p>The last time I did any substantial web development was in the 90s. A lot has changed since then!</p><blockquote class="twitter-tweet"><p lang="en" dir="ltr">I decided that I need a personal website. I haven&#39;t done any web work since the 90s. What you can build today in an hour \\\\\*for free\\\\\* with <a href="https://twitter.com/Netlify?ref_src=twsrc%5Etfw">@Netlify</a>, <a href="https://twitter.com/letsencrypt?ref_src=twsrc%5Etfw">@letsencrypt</a>, and static site generators is absolutely incredible.</p>&mdash; Matt Klein (@mattklein123) <a href="https://twitter.com/mattklein123/status/1235078497241935872?ref_src=twsrc%5Etfw">March 4, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script><p>We use <a href="https://www.netlify.com/">Netlify</a> for the <a href="https://www.envoyproxy.io/">Envoy website</a>. I have a bit of experience with it so I decided to use it for my personal site. I registered my domain name using <a href="https://domains.google/">Google Domains</a> and then switched the name servers over to Netlify. Netlify automatically takes care of getting a TLS cert via <a href="https://letsencrypt.org/">Let’s Encrypt</a>. For the static site generator I decided to use <a href="https://hexo.io/">Hexo</a> based on a coworker recommendation. After browsing through a bunch of Hexo themes I picked a simple one called <a href="https://github.com/probberechts/hexo-theme-cactus">Cactus</a>. With 1-2 hours of tweaking I had the fully functioning website you see now. Amazing! I even set up <a href="https://www.netlifycms.org/">Netlify CMS</a> so I can write posts directly in any browser. Netlify takes care of all of the authentication and authorization via GitHub, and even opens PRs for in-progress draft posts.</p><p>The fact that I could create this level of sophistication in such a short period of time, without using a database, and for free absolutely blows my mind. Granted my experience in this area is 20+ years out of date but it’s nice to see so much progress in the state of the art.</p><p>In the future I plan on adding comment support, Google analytics, and a few other small features.</p><h2 id="The-future-of-my-blog"><a href="#The-future-of-my-blog" class="headerlink" title="The future of my blog"></a>The future of my blog</h2><p>Up until now I have done all of my writing on <a href="https://medium.com/@mattklein123">Medium</a>. Although I know that Medium is a frequent source of complaints, it has worked well for me. I haven’t decided yet whether I will transfer my medium posts here, only write new posts here, or potentially keep using Medium for long form writing. Stay tuned.</p>]]></content>
    
    
      
      
    <summary type="html">&lt;p&gt;Welcome to my new website! I’ve increasingly realized that I need a single digital hub where I can organize my contact information, bio, </summary>
      
    
    
    
    
  </entry>
  
</feed>
