<?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>Databases on Brave New Geek</title><link>https://bravenewgeek.com/tag/databases/</link><description>Recent content in Databases on Brave New Geek</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 02 Aug 2017 10:41:25 -0500</lastBuildDate><atom:link href="https://bravenewgeek.com/tag/databases/index.xml" rel="self" type="application/rss+xml"/><item><title>FIFO, Exactly-Once, and Other Costs</title><link>https://bravenewgeek.com/fifo-exactly-once-and-other-costs/</link><pubDate>Wed, 02 Aug 2017 10:14:20 -0500</pubDate><guid>https://bravenewgeek.com/fifo-exactly-once-and-other-costs/</guid><description>&lt;p&gt;There’s been &lt;a href="https://bravenewgeek.com/you-cannot-have-exactly-once-delivery-redux/"&gt;a lot&lt;/a&gt; &lt;a href="http://the-paper-trail.org/blog/exactly-not-atomic-broadcast-still-impossible-kafka/"&gt;of discussion&lt;/a&gt; &lt;a href="https://fpj.me/2017/07/04/no-consensus-in-exactly-once/"&gt;about&lt;/a&gt; &lt;a href="http://data.alishoker.com/2017/07/notes-on-exactly-once-semantics-in.html"&gt;exactly-once semantics&lt;/a&gt; &lt;a href="https://medium.com/@jaykreps/exactly-once-one-more-time-901181d592f9"&gt;lately&lt;/a&gt;, sparked by the recent &lt;a href="https://www.confluent.io/blog/exactly-once-semantics-are-possible-heres-how-apache-kafka-does-it/"&gt;announcement&lt;/a&gt; of support for it in Kafka 0.11. I’ve already &lt;a href="https://bravenewgeek.com/what-you-want-is-what-you-dont-understanding-trade-offs-in-distributed-messaging/"&gt;written at length&lt;/a&gt; about strong guarantees in messaging.&lt;/p&gt;
&lt;p&gt;My former coworker Kevin Sookocheff recently made a &lt;a href="https://sookocheff.com/post/messaging/dissecting-sqs-fifo-queues/"&gt;post&lt;/a&gt; about ordered and exactly-once message delivery as it relates to Amazon SQS. It does a good job of illustrating what the trade-offs are, and I want to drive home some points.&lt;/p&gt;
&lt;p&gt;In the article, Kevin shows how FIFO delivery is really only meaningful when you have one single-threaded publisher and one single-threaded receiver. Amazon’s FIFO queues allow you to control how restrictive this requirement is by applying ordering on a per-group basis. In other words, we can improve throughput if we can partition work into different ordered groups rather than a single totally ordered group. However, FIFO still effectively limits throughput on a group to a single publisher and single subscriber. If there are multiple publishers, they have to coordinate to ensure ordering is preserved with respect to our application’s semantics. On the subscriber side, things are simpler because SQS will only deliver messages in a group one at a time in order amongst subscribers.&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>Not Invented Here</title><link>https://bravenewgeek.com/not-invented-here/</link><pubDate>Sat, 06 Dec 2014 14:17:52 -0600</pubDate><guid>https://bravenewgeek.com/not-invented-here/</guid><description>&lt;p&gt;Engineers love engineering things. The reason is self-evident (and maybe self-fulfilling—why else would you be an engineer?). We like to think we’re pretty good at solving problems. Unfortunately, this mindset can, on occasion, yield undesirable consequences which might not be immediately apparent but all the while damaging.&lt;/p&gt;
&lt;p&gt;Developers are all in tune with the idea of “don’t reinvent the wheel,” but it seems to be eschewed sometimes, deliberately or otherwise. People don’t generally write their own merge sort, so why would they write their own consensus protocol? Anecdotally speaking, &lt;a href="https://groups.google.com/d/msg/redis-db/Oazt2k7Lzz4/MPhvXVizCAYJ"&gt;they do&lt;/a&gt;.&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><item><title>Solving the Referential Integrity Problem</title><link>https://bravenewgeek.com/solving-the-referential-integrity-problem/</link><pubDate>Sat, 01 Dec 2012 13:37:46 -0600</pubDate><guid>https://bravenewgeek.com/solving-the-referential-integrity-problem/</guid><description>&lt;p&gt;&lt;em&gt;“A man with a watch knows what time it is. A man with two watches is never sure.”&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I’ve been developing my open source Android framework, &lt;a href="http://code.google.com/p/infinitum-framework/"&gt;Infinitum&lt;/a&gt;, for the better part of 10 months now. It has brought about some really interesting problems that I’ve had to tackle, which is one of the many reasons I enjoy working on it so much.&lt;/p&gt;
&lt;h3 id="chicken-or-the-egg"&gt;Chicken or the Egg&lt;/h3&gt;
&lt;p&gt;Although it’s much more now, Infinitum began as an object-relational mapper which was loosely modeled after &lt;a href="http://www.hibernate.org/"&gt;Hibernate&lt;/a&gt;. One of the first major issues I faced while developing the ORM component was loading object graphs. To illustrate what I mean by this, suppose we’re developing some software for a department store. The domain model for this software might look something like this:&lt;/p&gt;</description></item></channel></rss>