<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Cap Theorem on Brave New Geek</title><link>https://bravenewgeek.com/tag/cap-theorem/</link><description>Recent content in Cap Theorem on Brave New Geek</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 23 Feb 2018 16:09:46 -0600</lastBuildDate><atom:link href="https://bravenewgeek.com/tag/cap-theorem/index.xml" rel="self" type="application/rss+xml"/><item><title>Building a Distributed Log from Scratch, Part 2: Data Replication</title><link>https://bravenewgeek.com/building-a-distributed-log-from-scratch-part-2-data-replication/</link><pubDate>Wed, 27 Dec 2017 12:26:55 -0600</pubDate><guid>https://bravenewgeek.com/building-a-distributed-log-from-scratch-part-2-data-replication/</guid><description>&lt;p&gt;In &lt;a href="https://bravenewgeek.com/building-a-distributed-log-from-scratch-part-1-storage-mechanics/"&gt;part one&lt;/a&gt; of this series we introduced the idea of a message log, touched on why it’s useful, and discussed the storage mechanics behind it. In part two, we discuss data replication.&lt;/p&gt;
&lt;p&gt;We have our log. We know how to write data to it and read it back as well as how data is persisted. The caveat to this is, although we have a durable log, it’s a single point of failure (SPOF). If the machine where the log data is stored dies, we’re SOL. Recall that one of our three priorities with this system is high availability, so the question is how do we achieve high availability and fault tolerance?&lt;/p&gt;</description></item><item><title>From the Ground Up: Reasoning About Distributed Systems in the Real World</title><link>https://bravenewgeek.com/from-the-ground-up-reasoning-about-distributed-systems-in-the-real-world/</link><pubDate>Fri, 01 Jan 2016 14:26:50 -0600</pubDate><guid>https://bravenewgeek.com/from-the-ground-up-reasoning-about-distributed-systems-in-the-real-world/</guid><description>&lt;p&gt;&lt;em&gt;The rabbit hole is deep. Down and down it goes. Where it ends, nobody knows. But as we traverse it, patterns appear. They give us hope, they quell the fear.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Distributed systems literature is abundant, but as a practitioner, I often find it difficult to know where to start or how to synthesize this knowledge without a more formal background. This is a non-academic’s attempt to provide a line of thought for rationalizing design decisions. This piece doesn’t necessarily contribute any new ideas but rather tries to provide a holistic framework by studying some influential existing ones. It includes references which provide a good starting point for thinking about distributed systems. Specifically, we look at a few formal results and slightly less formal design principles to provide a basis from which we can argue about system design.&lt;/p&gt;</description></item><item><title>You Own Your Availability</title><link>https://bravenewgeek.com/you-own-your-availability/</link><pubDate>Tue, 22 Sep 2015 11:12:16 -0500</pubDate><guid>https://bravenewgeek.com/you-own-your-availability/</guid><description>&lt;p&gt;There’s been a lot of discussion around “availability” lately. It’s often trumpeted with phrases like “&lt;a href="http://www.whoownsmyavailability.com/"&gt;you own your availability&lt;/a&gt;,” meaning there is no buck-passing when it comes to service uptime. The &lt;a href="http://venturebeat.com/2015/09/20/amazons-aws-outage-takes-down-netflix-reddit-medium-and-more/"&gt;AWS outage&lt;/a&gt; earlier this week served as a stark reminder that, while owning your availability is a commendable ambition, for many it’s still largely owned by Amazon and the like.&lt;/p&gt;
&lt;p&gt;In order to “own” your availability, it’s important to first understand what “availability” really means. Within the context of distributed-systems theory, availability is usually discussed in relation to the &lt;a href="https://bravenewgeek.com/cap-and-the-illusion-of-choice/"&gt;CAP theorem&lt;/a&gt;. &lt;a href="https://www.comp.nus.edu.sg/~gilbert/pubs/BrewersConjecture-SigAct.pdf"&gt;Formally&lt;/a&gt;, CAP defines availability as a &lt;em&gt;liveness&lt;/em&gt; property: “every request received by a non-failing node in the system must result in a response.” This is a weak definition for two reasons. First, the proviso “every request received by a &lt;em&gt;non-failing&lt;/em&gt; node” means that a system in which &lt;em&gt;all&lt;/em&gt; nodes have failed is trivially available.  Second, Gilbert and Lynch stipulate no upper bound on latency, only that operations &lt;em&gt;eventually&lt;/em&gt; return a response. This means an operation could take weeks to complete and availability would not be violated.&lt;/p&gt;</description></item><item><title>Service-Disoriented Architecture</title><link>https://bravenewgeek.com/service-disoriented-architecture/</link><pubDate>Sun, 07 Jun 2015 16:03:22 -0500</pubDate><guid>https://bravenewgeek.com/service-disoriented-architecture/</guid><description>&lt;p&gt;&lt;em&gt;“You can have a second computer once you’ve shown you know how to use the first one.” -Paul Barham&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The first rule of distributed systems is don’t distribute your system until you have an observable reason to. Teams break this rule on the regular. People have been talking about service-oriented architecture for a long time, but only recently have microservices been receiving the hype.&lt;/p&gt;
&lt;p&gt;The problem, as &lt;a href="http://martinfowler.com/bliki/MicroservicePremium.html"&gt;Martin Fowler observes&lt;/a&gt;, is that teams are becoming too eager to adopt a microservice architecture without first understanding the &lt;a href="http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html"&gt;inherent overheads&lt;/a&gt;. A contributing factor, I think, is you only hear the success stories from companies who did it right, like Netflix. However, what folks often fail to realize is that these companies—in almost all cases—didn’t start out that way. There was a long and winding path which led them to where they are today. The inverse of this, which some refer to as &lt;a href="http://www.thoughtworks.com/radar/techniques/microservice-envy"&gt;microservice envy&lt;/a&gt;, is causing teams to rush into microservice hell. I call this service-&lt;em&gt;disoriented&lt;/em&gt; architecture (or sometimes disservice-oriented architecture when the architecture is DOA).&lt;/p&gt;</description></item><item><title>Distributed Systems Are a UX Problem</title><link>https://bravenewgeek.com/distributed-systems-are-a-ux-problem/</link><pubDate>Wed, 03 Jun 2015 19:33:29 -0500</pubDate><guid>https://bravenewgeek.com/distributed-systems-are-a-ux-problem/</guid><description>&lt;p&gt;Distributed systems are not strictly an engineering problem. It’s far too easy to assume a “backend” development concern, but the reality is there are implications at every point in the stack. Often the trade-offs we make lower in the stack in order to buy responsiveness bubble up to the top—so much, in fact, that it rarely &lt;em&gt;doesn’t&lt;/em&gt; impact the application in some way. Distributed systems affect the user. We need to shift the focus from system properties and guarantees to business rules and application behavior. We need to understand the limitations and trade-offs at each level in the stack and why they exist. We need to assume failure and plan for recovery. &lt;strong&gt;We need to start thinking of distributed systems as a UX problem.&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>CAP and the Illusion of Choice</title><link>https://bravenewgeek.com/cap-and-the-illusion-of-choice/</link><pubDate>Sat, 18 Apr 2015 11:58:27 -0500</pubDate><guid>https://bravenewgeek.com/cap-and-the-illusion-of-choice/</guid><description>&lt;p&gt;The CAP theorem is widely discussed and often misunderstood within the world of distributed systems. It states that any networked, shared-data system can, at most, guarantee two of three properties: consistency, availability, and partition tolerance. I won’t go into detail on CAP since the literature is abundant, but the notion of “two of three”—while conceptually accessible—is utterly misleading. &lt;a href="http://www.infoq.com/articles/cap-twelve-years-later-how-the-rules-have-changed"&gt;Brewer has indicated this&lt;/a&gt;, echoed by many more, but there still seems to be a lot of confusion when the topic is brought up. The bottom line is &lt;a href="http://codahale.com/you-cant-sacrifice-partition-tolerance/"&gt;you can’t sacrifice partition tolerance&lt;/a&gt;, but it seems CAP is a bit more nuanced than that.&lt;/p&gt;</description></item><item><title>You Cannot Have Exactly-Once Delivery</title><link>https://bravenewgeek.com/you-cannot-have-exactly-once-delivery/</link><pubDate>Wed, 25 Mar 2015 18:14:57 -0500</pubDate><guid>https://bravenewgeek.com/you-cannot-have-exactly-once-delivery/</guid><description>&lt;p&gt;I’m often surprised that people continually have fundamental misconceptions about how distributed systems behave. I myself shared many of these misconceptions, so I try not to demean or dismiss but rather educate and enlighten, hopefully while sounding less preachy than that just did. I continue to learn only by following in the footsteps of others. In retrospect, it shouldn’t be surprising that folks buy into these fallacies as I once did, but it can be frustrating when trying to communicate certain design decisions and constraints.&lt;/p&gt;</description></item><item><title>If State Is Hell, SOA Is Satan</title><link>https://bravenewgeek.com/if-state-is-hell-soa-is-satan/</link><pubDate>Sun, 08 Mar 2015 12:33:18 -0600</pubDate><guid>https://bravenewgeek.com/if-state-is-hell-soa-is-satan/</guid><description>&lt;p&gt;More and more companies are describing their &lt;a href="http://nginx.com/blog/microservices-at-netflix-architectural-best-practices/"&gt;success stories&lt;/a&gt; regarding the switch to a service-oriented architecture. As with any technological upswing, there’s a clear and palpable hype factor involved (Big Data™ or The Cloud™ anyone?), but obviously it’s not just puff.&lt;/p&gt;
&lt;p&gt;While microservices and SOA have seen a staggering &lt;a href="http://www.enterprisecioforum.com/en/blogs/enadhan/secrets-behind-rapid-growth-soa"&gt;rate of adoption&lt;/a&gt; in recent years, the mindset of developers often seems to be stuck in the past. I think this is, at least in part, because we seek a mental model we can reason about. It’s why we build abstractions in the first place. In a sense, I would argue there’s a comparison to be made between the explosion of OOP in the early 90’s and today’s SOA trend. After all, &lt;strong&gt;SOA is as much about people scale as it is about workload scale&lt;/strong&gt;, so it makes sense from an organizational perspective.&lt;/p&gt;</description></item><item><title>From Mainframe to Microservice: An Introduction to Distributed Systems</title><link>https://bravenewgeek.com/from-mainframe-to-microservice-an-introduction-to-distributed-systems/</link><pubDate>Sat, 01 Nov 2014 18:12:38 -0600</pubDate><guid>https://bravenewgeek.com/from-mainframe-to-microservice-an-introduction-to-distributed-systems/</guid><description>&lt;p&gt;I gave a talk at &lt;a href="http://iowacodecamp.com/"&gt;Iowa Code Camp&lt;/a&gt; this weekend on distributed systems. It was primarily an introduction to them, so it explored some core concepts at a high level.  We looked at why distributed systems are difficult to build (right), the CAP theorem, consensus, scaling shared data and CRDTs.&lt;/p&gt;
&lt;p&gt;There was some interest in making the slides available online. I’m not sure how useful they are without narration, but here they are anyway for posterity.&lt;/p&gt;</description></item><item><title>Scaling Shared Data in Distributed Systems</title><link>https://bravenewgeek.com/scaling-shared-data/</link><pubDate>Tue, 21 Oct 2014 21:23:03 -0600</pubDate><guid>https://bravenewgeek.com/scaling-shared-data/</guid><description>&lt;p&gt;Sharing mutable data at large scale is an &lt;em&gt;exceedingly&lt;/em&gt; difficult problem. In their seminal paper &lt;a href="http://pagesperso-systeme.lip6.fr/Marc.Shapiro/papers/RR-6956.pdf"&gt;&lt;em&gt;CRDTs: Consistency without concurrency control&lt;/em&gt;&lt;/a&gt;, Shapiro et al. describe why the CAP theorem demands a give and take between scalability and consistency. In general, CAP requires us to choose between CP and AP. The former requires serializing every write, which doesn’t scale beyond a small cluster. The latter ensures scalability by giving up consistency.&lt;/p&gt;
&lt;h3 id="sharing-data-in-centralized-systems"&gt;Sharing Data in Centralized Systems&lt;/h3&gt;
&lt;p&gt;We tend to prefer weaker consistency models because they mean lower latency and higher availability. To highlight this point, consider the fact that the memory models for most programming languages are &lt;em&gt;not&lt;/em&gt; serializable by default. More concisely, programs with shared memory are not inherently thread-safe. This is a conscious design decision because enforcing memory serializability incurs a significant latency penalty. Instead, programming languages require explicit &lt;em&gt;memory barriers&lt;/em&gt; which can be used around the critical sections which need this property.&lt;/p&gt;</description></item><item><title>Understanding Consensus</title><link>https://bravenewgeek.com/understanding-consensus/</link><pubDate>Wed, 24 Sep 2014 21:35:07 -0600</pubDate><guid>https://bravenewgeek.com/understanding-consensus/</guid><description>&lt;p&gt;A classical problem presented within the field of distributed systems is the &lt;a href="http://en.wikipedia.org/wiki/Two_Generals'_Problem"&gt;Byzantine Generals Problem&lt;/a&gt;. In it, we observe two allied armies positioned on either side of a valley. Within the valley is a fortified city. Each army has a general with one acting as commander. Both armies &lt;em&gt;must&lt;/em&gt; attack at the same time or face defeat by the city’s defenders. In order to come to an agreement on when to attack, messengers must be sent through the valley, risking capture by the city’s patrols. Consider the diagram below illustrating this problem.&lt;/p&gt;</description></item></channel></rss>