<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Joe Doliner on Medium]]></title>
        <description><![CDATA[Stories by Joe Doliner on Medium]]></description>
        <link>https://medium.com/@jdoliner?source=rss-487b96ead925------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*L8wQgdC7bcM0iqAp3hRswQ.jpeg</url>
            <title>Stories by Joe Doliner on Medium</title>
            <link>https://medium.com/@jdoliner?source=rss-487b96ead925------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:39:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jdoliner/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Debunking the FUD about data version control implementations]]></title>
            <link>https://medium.com/pachyderm-data/debunking-the-fud-about-data-version-control-implementations-55cbe72014fb?source=rss-487b96ead925------2</link>
            <guid isPermaLink="false">https://medium.com/p/55cbe72014fb</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[pachyderm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Joe Doliner]]></dc:creator>
            <pubDate>Mon, 12 Jul 2021 16:39:52 GMT</pubDate>
            <atom:updated>2021-07-12T16:39:52.544Z</atom:updated>
            <content:encoded><![CDATA[<p>There’s a narrative popping up lately about an impossible tradeoff between version control systems — is it better to have a diff-based or snapshot-based architecture for a data version control system? But the whole narrative comes from seeing the approaches as separate. The real truth is people haven’t thought about the problem correctly.</p><p>In this post I’ll talk about the right way to think about the problem. At <a href="http://pachyderm.com/">Pachyderm</a>, we’ve implemented both types of architectures and moved beyond seeing them as mutually exclusive to create our current system which combines the best of both worlds and delivers something unique that you can’t pigeon hole as either.</p><h3>Snapshot vs diff architectures</h3><p>The essence of the snapshot versus diff argument is that version control systems can choose one of two architectures:</p><ol><li>A diff based architecture in which the core primitive, a diff, describes a change to data relative to the previous state</li><li>A snapshot based architecture where the core primitive, a snapshot, describes the state of all the data at a single point in time.</li></ol><p>The significance of this choice is in which operations are most efficient and how much storage bloat is required to keep many versions. A diff-based architecture stores less data because it’s only storing the diff between changes. It’s faster at returning diffs (unsurprisingly, since it stores them directly,) but slower at retrieving complete snapshots since it must construct them by applying diffs. A snapshot-based architecture stores more data because snapshots are redundant. It’s much faster at retrieving a given data state since it can get all the data at once, but slower at returning diffs since it must construct them by diffing two snapshots.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wnr5vplUGWG1BawG.png" /></figure><p>At a very basic level this tradeoff is true and something users should care about, but once we start to optimize these systems, the distinctions get a lot less clear and the two systems blend together.</p><p>Diff-based system adherents will probably take exception to my claim that diff-based systems need to apply diffs to return a snapshot. While that is generally true, it implies that diffs must be applied from the beginning of time. In modern systems, diff-based systems cache intermediate results of diff application so that only a small number of diffs need to be applied to get the most recent snapshot. Another way of thinking of this is that they compact many smaller diffs into an uber-diff that contains all of the changes of the smaller diff and can be applied quickly to a blank state.</p><p>Ultimately there’s very little difference between an uber-diff and the snapshot you get from applying that diff. The thing to notice though is that we’re gradually sliding toward the other architecture by storing snapshots with redundancy. It’s not totally the same, because the snapshots are cached objects, they’re not the source of truth. So we can prune them, or store them in ephemeral storage since they can always be reconstructed on the fly. But reconstructing them is the expensive thing that we want to avoid, so we do need to store them for some amount of time to get any value at all from them. Which snapshots you cache is the fundamental question for optimizing diff-based systems.</p><p>Next up, snapshot-based systems. Snapshot aficionados probably took exception to my claim that snapshots are redundant. Again this is generally true, but implies that each snapshot is storing a completely new copy of the data. Most snapshot-based systems try to deduplicate redundant data where they can so that only a small amount of redundant data is stored. If a snapshot contains only one new file, then it only needs to store that file, the rest of the files can be stored as references. This looks eerily similar to a diff-based system but on a per file basis.</p><p>The important optimization is where you decide to deduplicate redundant data. Git does this at a file level. If you have a 1KB source file and you change one character it’ll store another 1KB of data. This sounds inefficient but it works for git because source code files just aren’t that big. This is why git-based-data-version-control systems tend to struggle with large binary files though. You could also break files into smaller chunks, and deduplicate at the chunk level.</p><p>Similar to the above, the thing to notice is that we’re gradually sliding toward the other architecture by deduplicating our snapshots until they resemble diffs. Again it’s not exactly the same because you need to define your chunk size for deduplication, whereas with a diff-based system you take those boundaries directly from the user when they commit to the system, but it’s very close. With a small enough chunk size, you’ve basically approached a diff-based system where you heavily deduplicate storage, but need to stitch together many chunks to create a full file.</p><p>The ultimate conclusion is that diff vs. snapshot isn’t a real dichotomy, in math terms the two systems are isomorphic.</p><blockquote><em>You can think of a diff-based system as a snapshot-based system that deduplicates its snapshots on commit boundaries, and you can think of a snapshot-based system as a diff-based system that caches a snapshot for every commit.</em></blockquote><p>Knowing that a system is diff-based or snapshot-based really doesn’t tell you much about its performance. For that you’ll need to understand how it optimizes various operations. Understanding diffs and snapshots as primitives is useful, fixating on them as the difference between competing systems is a mistake.</p><p>The difference between the two mostly matters to the programmers writing the system, not the user.</p><p>Most users assume git is diff based because `git diff` is fast and git allows you to apply diffs as patches, but it’s not. Again the difference between these systems is fairly superficial, but git definitely does not store diffs, it stores commit trees which are snapshots of full commits, deduplicated.</p><p>So the diff vs. snapshot dichotomy isn’t useful to understanding the system, what is?</p><p>Here’s how we think about it at Pachyderm: we focus on the data.</p><h3>Large-scale data version control</h3><p>Users give Pachyderm data to store and we write that data to an underlying storage medium. Later, users can request that data back and we give it to them. We focus on how cheaply and quickly we can do those two things. This way of thinking leads us to the actual fundamental tradeoff in version control systems: you can store less data but it makes accessing that data slower and more expensive, or you can store more data, but it makes accessing that data more efficient.</p><blockquote><em>Notice that this is somewhat the same tradeoff that people perceive in diff vs snapshot systems, but it’s formulated purely in terms of data. This makes it much more useful because it allows us to think quantitatively, rather than qualitatively.</em></blockquote><p>To figure out how to make this tradeoff you need to consider the cost and performance structure of the underlying systems. Pachyderm, like most data version control systems, is designed to run on object storage so we can use s3’s cost structure to compute this. As of April 2021, s3 charges you $0.023 / GB month and $0.0004 / 1000 requests. Do the math and you’ll come to the very important, but counter-intuitive, conclusion that sometimes it’s cheaper to store more data. Specifically it’s worth it to store an extra GB of data if it saves you 57,500 requests a month.</p><p>How does storing more data save you requests?</p><p>Imagine that you have a 1MB file and you add 1MB of data to the end of it. You could store the new 1MB separately, but then when you want the content of the file it takes two requests, one for the original 1MB and another for the added 1MB. Depending on how frequently it’s accessed, storing the whole 2MB file might result in a lower s3 bill.</p><p>The other factor is that two requests is slower than one, this time cost matters when expensive GPUs are waiting for downloads to complete so they can start training on the data. Or when the most important cost of all is at stake: the user’s time. You generally don’t know exactly how often you’ll be accessing your data, and it’s hard to put a dollar value on a request taking a few ms longer, so we don’t know exactly where the global maximum of this tradeoff is. What’s important is that we understand it exists, and think in these terms.</p><p>Ultimately this tradeoff can be reduced to a single value: the optimal chunk size. This is the optimal size of a chunk of data in object storage. Smaller than this and your request costs overwhelm your storage cost savings, bigger and the reverse happens. Again, this is analogous to our diffs vs snapshots comparison, lots of very small chunks would be the equivalent of storing diffs; you can deduplicate your storage heavily but reconstructing a set of files would require requesting many chunks. Storing fewer larger chunks reduces the number of requests, but increases the storage overhead.</p><p>The optimal chunk size depends on the underlying object store and the request pattern, which is why it’s configurable. Again you’re unlikely to know this number exactly, but you can ball park it, and the difference between the optimal value and something in the right ballpark is unlikely to matter. We also do internal tests on various object stores and find that generally for most workloads on modern object stores single digit MBs makes for a good chunk size.</p><p>There is one last important optimization to consider. Once we actually have an optimal or near-optimal chunk size, how do we effectively use that information? Suppose we decide 8MB is the correct value. The naïve approach would be to take the data we want to store, chunk it up into exactly 8MB chunks and content-address those chunks. That way if we see two chunks with the same content we deduplicate them. The challenge with a naïve adherence to a set chunk size is that it falls prey to the shifting boundaries problem. It works great when data is only added at the end of a files, but can be very inefficient in write patterns with insertions and deletions. Suppose someone adds a single insertion in the middle of a file. With strict chunk sizes, all the data shifts and every chunk after the insertion may have changed! This blows up the storage costs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z60NJMQPsh4g78GJ.png" /></figure><p>The solution is to do content-based chunking in addition to content-based addressing. This allows us to keep most of the chunks the same when a small amount of data changes regardless of where the change occurred.</p><p>Content-based chunking is an interesting topic worthy of its own post, but the short version is that you derive chunk boundaries based on the content itself. To do this you compute a rolling hash of the bytes and declare a chunk boundary when that hash value has a certain property. For example you might do it when the first `n` bits of the value are all 0. A higher value of `n` means you’re less likely to find a chunk boundary which means fewer, larger blocks. Given a desired block size you can select an `n` that probabilistically gives you blocks around the size you want.</p><p>Pachyderm applies this content-based chunking and deduplication to all the data it stores, and the metadata that indexes that data. When you apply this technique throughout you get a system where the tradeoff isn’t determined by an architectural choice of diffs vs snapshots, it’s determined by the data itself and the underlying storage medium. If your data set has lots of small additions the storage pattern will look a lot like a snapshot-based system, large additions, it’ll look a lot like a diff-based system. With most real workloads, it will look like a mix of the two. In each case the storage pattern is optimized to get the most performance out of the underlying storage for the users using the system. It’s not based on an implementation detail of whether our primary data structure is diffs or snapshots.</p><p>Hopefully that gives you a much better sense of how we solve the complex problems of storage for data science at Pachyderm. While many tools out there have focused on the 20% of data science that’s experimenting and putting a model into production, we focused on one of the most challenging problems in computer and data science, storing and versioning data at massive, petabyte scale.</p><p>If you want to learn about Pachyderm’s product or dive our hybrid data versioning algorithms you can <a href="https://www.pachyderm.com/">Request a Demo</a>, check out our <a href="https://app.livestorm.co/pachyderm-inc/community-meetup?utm_campaign=community-meetup%5B%E2%80%A6%5Dweb&amp;utm_medium=web&amp;utm_content=community-meetup-registration">Pachyderm Storage Architecture Webinar</a>, explore the <a href="http://github.com/pachyderm/pachyderm">code on GitHub</a>, or try the product for free on <a href="http://hub.pachyderm.com/">Pachyderm Hub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55cbe72014fb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pachyderm-data/debunking-the-fud-about-data-version-control-implementations-55cbe72014fb">Debunking the FUD about data version control implementations</a> was originally published in <a href="https://medium.com/pachyderm-data">Pachyderm Community Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pachyderm 1.2: Stability, Performance and Usability Improvements]]></title>
            <link>https://medium.com/pachyderm-data/pachyderm-1-2-553f2574b7aa?source=rss-487b96ead925------2</link>
            <guid isPermaLink="false">https://medium.com/p/553f2574b7aa</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[pachyderm]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Joe Doliner]]></dc:creator>
            <pubDate>Fri, 23 Sep 2016 00:37:12 GMT</pubDate>
            <atom:updated>2016-09-28T17:52:24.518Z</atom:updated>
            <content:encoded><![CDATA[<p>Pachyderm 1.2 is out today and with it a host of new features. Our biggest goal with this release was to stabilize our existing code base so that it can keep up with the production use we’re seeing. This required an architectural shift for our filesystem, PFS. Our pipelining system, PPS, remains largely unchanged. We spent the rest of our development cycle extending our API to address some use cases that it wasn’t able to handle before and benchmarking our system to find and remove performance bottlenecks. Finally, with 1.2 we’re introducing our <a href="http://pachyderm.readthedocs.io/en/latest/index.html">developer docs portal</a>.</p><blockquote>Ready to take Pachyderm 1.2 for a spin? Head on over to the <a href="http://pachyderm.readthedocs.io/en/latest/getting_started/getting_started.html">Getting Started guide</a>.</blockquote><h4>PFS Improvements</h4><p>We gave PFS, the version controlled filesystem that underpins Pachyderm, a major overhaul in 1.2. In 1.1, PFS nodes held system state and could encounter issues when nodes died or containers got rescheduled. Stateful distributed system are tricky to get right, especially in containerized environments where a process can get rescheduled on different machines. As of 1.2, PFS is completely stateless — all the state that we previously stored locally in PFS nodes is now stored in a database (<a href="https://rethinkdb.com/">RethinkDB</a>) which we deploy as part of our Kubernetes manifest.</p><p>PFS also got a few new features as part of this overhaul. Pachyderm now gives commits semantically meaningful names, master/0, master/1 etc. This makes the commit lineage much more intuitive. Users can now merge commits. This enables a number of usage patterns that weren’t possible before and also allows PPS (which runs on top of PFS) to smartly rollback failed jobs and retry them.</p><p>Finally, we added a benchmarking suite in this release and started systematically testing Pachyderm’s scalability. Pachyderm now caches some of its costlier requests, particularly those that would have to go to object storage or disk to get data. (Shout out to Brad Fitzpatrick for <a href="https://github.com/golang/groupcache">GroupCache</a>, which made adding a caching layer incredibly painless.) Expect 1.3 to involve a lot more of this type of testing and many more improvements to Pachyderm’s scalability.</p><blockquote><a href="https://www.pachyderm.io/usecases/generalfusion.html">Read about how General Fusion is developing clean fusion energy with the help of Pachyderm.</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*gE_GkA9HGVP5Ek4jWrsl7A.jpeg" /></figure><h4>Update Pipeline</h4><p>One of the biggest complaints we heard about 1.1 was that it was hard to iterate on pipelines. To update a pipeline, our users had to delete it, delete its data and then redeploy it. This could take a while and slowed down iteration. Users also often wanted to update a pipeline without deleting the existing output, as outside clients might have references to it which would become defunct if it was removed. To deal with this, we added UpdatePipeline, which allows you to modify an existing pipeline. The pipeline’s output is “archived,” which means that it remains readable by explicit reference but isn’t shown in ListCommit or FlushCommit. Users of those commands will always see the most up-to-date version of the data.</p><h4>Deployment Improvements</h4><p>Deploying Pachyderm normally involves 3 steps:</p><ul><li>Install <em>pachctl</em>, the Pachyderm CLI, locally</li><li>Deploy <em>pachd</em>, the Pachyderm daemon, to your Kubernetes cluster</li><li>Get <em>pachctl </em>and <em>pachd </em>talking to each other</li></ul><p>This was harder than it needed to be in 1.1 and tripped a number of users up. People wound up with mismatched versions of <em>pachctl </em>and <em>pachd, </em>which led to compatibility issues. Furthermore, getting pachctl talking to <em>pachd </em>proved difficult, since different users needed to follow different processes. In 1.2, <em>pachctl </em>does most of the heavy lifting for you. As long as <em>kubectl </em>is working on your system, the steps now look like this:</p><ul><li>Install <em>pachctl</em></li><li>Run <em>pachctl deploy,</em> which automatically deploys a matching version of <em>pachd</em></li><li>Run <em>pachctl port-forward</em>, which automatically forwards your local port to the Pachyderm cluster.</li></ul><blockquote><a href="http://pachyderm.readthedocs.io/en/latest/getting_started/local_installation.html">See how easy deploying is for yourself!</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=553f2574b7aa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pachyderm-data/pachyderm-1-2-553f2574b7aa">Pachyderm 1.2: Stability, Performance and Usability Improvements</a> was originally published in <a href="https://medium.com/pachyderm-data">Pachyderm Community Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Provenance: the Missing Feature for Rigorous Data Science. Now in Pachyderm 1.1]]></title>
            <link>https://medium.com/pachyderm-data/provenance-the-missing-feature-for-good-data-science-now-in-pachyderm-1-1-2bd9d376a7eb?source=rss-487b96ead925------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bd9d376a7eb</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Joe Doliner]]></dc:creator>
            <pubDate>Fri, 08 Jul 2016 18:43:25 GMT</pubDate>
            <atom:updated>2016-07-11T18:17:42.508Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://github.com/pachyderm/pachyderm#getting-started">Pachyderm 1.1</a> is available today, it includes over 70 bug fixes and new features compared to 1.0. One of those features is <em>provenance</em>, something we consider to be a core function that’s surprisingly absent in other big data packages. This post is about the motivation, architecture and implementation of provenance in Pachyderm.</p><p>Before we can talk about the why and how, we should first agree on what exactly provenance is. Generally speaking provenance is something’s origin; my provenance is Ithaca, New York which is where I was born. In the context of data, provenance refers to other data that was used to compute it. For example, if I have a list of sales that my store has made I could compute the total revenue of my store. That would leave me with 2 pieces of data, a list of sales and computed revenue. The sales are the provenance for the revenue.</p><blockquote>Provenance captures dependency between data sets.</blockquote><p>So why is this concept useful? Firstly, it enables reproducibility because results can be traced back to their origins and recomputed from scratch if need be. If I notice that my revenue numbers are lower than expected, my first step is to look at the raw data and see if anything looks off. Maybe it’s a bug in my analysis in which case I can change the code and quickly rerun it on exactly the same data. From there, I can perform further computations on the raw sales data to learn more and clarify the results. For example I might want to compute my average revenue per sale and my margin; two new pieces of data both of which have my original sales list as their provenance.</p><p>Provenance gets even more powerful when it’s used by a group of people collaboratively. Suppose a colleague of mine came upon the data from the example above. She’d immediately be able to see the sales figure, the raw data that had gone into it and the later computations I’d done to clarify them. Thanks to provenance she’ll have all the context necessary to understand what our organization already knows about this data so she can get started doing her own analysis on top of mine.</p><p>Users upgrading to 1.1 won’t need to do anything special to take advantage of provenance. Pipelines automatically record provenance as they execute and it’s impossible for analysis to take input without those inputs becoming provenance for the output. This was an early design decision we made; we felt that if our provenance implementation required users to do extra work it would invariably break down in the real world. Knowing 95% of a result’s provenance is often more confusing than knowing none of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*yLws-uxwUMNsClnqKTfaxw.png" /><figcaption>Pachyderm tracking provenance with day-by-day granularity.</figcaption></figure><p>Pachyderm is different from most large scale storage systems in that it doesn’t just store data, it stores history as well. The architecture and nomenclature are similar to git. Data is organized into <em>repos</em> with <em>commits (</em>snapshots<em>) </em>in each repo representing the state of that dataset at different points in time. Pachyderm implements provenance for both repos and commits. In the above example the datasets: “revenue”, “revenue per sale” and “margin” would each be repos with the “sales” repo as provenance.</p><p>Inside of each of these repos is multiple commits which represent the historical states of the data set. These commits are also linked by provenance. For each commit in my sales repo there’s a corresponding commit in my downstream repos. You can think of these commits as a consistent snapshot of the data and analysis at a specific point in time.</p><blockquote>This prevents one of the largest sources of discrepancies in data science: people computing results from different versions of the same data set.</blockquote><p>All of the provenance functionality comes together into a high-level command called “flush-commit”. Flush-commit takes a set of commits and tracks those commits forward to downstream commits that were created as a result — that is, commits which have the original set of commits as provenance. If we flushed the commit to our sales repo from above, we’d expect to get back a commit from each of the other downstream repos. These commits form a consistent snapshot. Flush is smart about how it creates these global snapshots. Since downstream analysis takes computation time, some of the commits might not even exist when the flush is issued. Therefore, Pachyderm will wait for all the downstream analysis to finish before flush returns and if anything downstream fails it will tell you which step in the pipeline had the error.</p><blockquote>Pachyderm is founded on the principle that data tools can and should do more to enable rigorous data science.</blockquote><p>We’ve written at length about this topic and what it means to us in our <a href="http://pachyderm.io/dsbor.html">Data Science Bill of Rights</a>. Provenance is a huge step in that mission since it’s both useful by itself and forms the bedrock for later features. We’re hopeful that over time provenance will become a more standard feature in data systems as we feel it’s impossible to do good data science without it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bd9d376a7eb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pachyderm-data/provenance-the-missing-feature-for-good-data-science-now-in-pachyderm-1-1-2bd9d376a7eb">Provenance: the Missing Feature for Rigorous Data Science. Now in Pachyderm 1.1</a> was originally published in <a href="https://medium.com/pachyderm-data">Pachyderm Community Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build your own Wayback Machine in 10 lines of code.]]></title>
            <link>https://medium.com/pachyderm-data/build-your-own-wayback-machine-in-10-lines-of-code-99884b2ff95c?source=rss-487b96ead925------2</link>
            <guid isPermaLink="false">https://medium.com/p/99884b2ff95c</guid>
            <dc:creator><![CDATA[Joe Doliner]]></dc:creator>
            <pubDate>Mon, 22 Jun 2015 18:37:03 GMT</pubDate>
            <atom:updated>2015-06-22T18:37:03.987Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post we’ll be using <a href="http://pachyderm.io/">Pachyderm’s </a>shiny new pipeline system to build a simple clone of Wayback Machine. With a surprisingly small amount of code we’ll build a system that can efficiently snapshot the internet. Let’s dive in!</p><h4>Step 1: Getting Pachyderm up and running</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e42f07e5c8d7f8e97042a205579e0137/href">https://medium.com/media/e42f07e5c8d7f8e97042a205579e0137/href</a></iframe><p>First things first, we’ll need a working Pachyderm setup. I used a single node setup for this tutorial which is the easiest option. If you’d prefer to jump straight to a clustered setup for higher scalability, click <a href="https://console.aws.amazon.com/cloudformation/home?region=us-west-1#/stacks/new?stackName=Pachyderm&amp;templateURL=https:%2F%2Fs3-us-west-1.amazonaws.com%2Fpachyderm-templates%2Ftemplate">here</a> to deploy a cluster on AWS. Everything in this tutorial should work the same, just substitute `localhost:650` with the hostname of one of your EC2 machines.</p><h4>Step 2: Storing the URLs</h4><p>Next, we’ll store a set of URLs in Pachyderm so we know what to scrape. Pachyderm exposes a RESTful interface to its distributed file system, pfs. We’ll store the URLs we want to scrape in there:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66e43659e905751615912127b8b080cd/href">https://medium.com/media/66e43659e905751615912127b8b080cd/href</a></iframe><p>Notice we’re just creating empty files here. Our scraper just looks at the names of the files to figure out what to scrape.</p><h4>Step 3: Create the pipeline</h4><p>Next, we’ll install a pipeline which scrapes these URLs. In Pachyderm, pipelines are computations that get run every time new data is committed to the file system. We define them using Pachfiles with a simple text-based format. Below is the scraper Pachfile, let’s walk through how it works.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/26409ca10bf97fafe72b22594148472f/href">https://medium.com/media/26409ca10bf97fafe72b22594148472f/href</a></iframe><p>Line 5 declares that we’ll be running everything inside the Docker image <a href="https://registry.hub.docker.com/u/pachyderm/scraper/">pachyderm/scraper</a>. It’s just a stock ubuntu image with wget installed since it doesn’t come by default.</p><p>Line 8 makes the URL list we stored in pfs in Step 2 available to the pipeline during execution. The data will be mapped into the container under the path <em>/in/urls</em>.</p><p>Line 11: this is the interesting part where we actually implement the scraper. <em>Run </em>allows us to parallelize commands across the cluster. I’m running this locally so there’s only 1 machine. Our command lists the URLs and pipes them to <em>wget</em>. We also pass several flags to <em>wget:</em></p><ul><li><em>recursive, level 1</em>: scrape things the page links to but only go 1 layer deep. Increasing level will greatly increase the amount of data scraped.</li><li><em>page-requisites</em>: this tweeks the behavior of resursive scraping so that we don’t wind up with partially renderable pages.</li><li><em>convert-links</em>: modifies the scraped data to make it easy to serve.</li><li><em>timestamping</em>: this is a nifty feature that <em>wget</em> has to optimize repeatedly scraping the same URLs. We’ll look at it in depth in the later on.</li><li><em>directory-prefix /ou</em>t, <em>input-file -</em>: Write output to <em>/out.</em> Take URLs to scrape from <em>stdin</em>. <em>/out</em> is where Pachyderm will look for output once the command exits.</li></ul><p>Lastly, we append a <em>; true</em>, to the end. This is a little hack because <em>wget </em>returns errors if any of the links on a page fail to scrape causing the pipeline to fail.</p><h4>Step 4: Run the pipeline</h4><p>Time to actually run the pipeline, here’s how:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab2f82c276421ca2e6c1243dff4ad6f3/href">https://medium.com/media/ab2f82c276421ca2e6c1243dff4ad6f3/href</a></iframe><p>As soon as you create a commit Pachyderm will start running the installed pipeline. Notice that we named the commit <em>commit1.</em> If you don’t specify a name for the commit Pachyderm will generate a UUID as a name.</p><h4>Step 5: Inspect the results</h4><p>As soon as you create that commit Pachyderm will start scraping the URLs you specified and the results will become available live via http. For example, if you point your browser at: <a href="http://localhost:650/pipeline/scraper/file/news.ycombinator.com/">localhost:650/pipeline/scraper/file/news.ycombinator.com</a>/ you’ll see the most recently scraped version of HN. You can also see a specific snapshot of the site by appending ?<em>commit=commit1</em> to any request.</p><h3>What’s cool about the system we’ve created?</h3><p>That wasn’t much code but already we’ve got a pretty sophisticated scraping system with the following properties:</p><p>We can easily add and remove URLs to the scrape list through a RESTful interface. As the amount of data to be scraped increases, we can scale horizontally without writing any new code. Pachfiles are guaranteed to run the same in a cluster as they do locally, so when you outgrow a local setup you can quickly migrate the same code to a cluster.</p><p>Our scrapes have the same commit-based properties as pfs. Each commit results in a snapshot of the internet being scraped and stored. Pachyderm can store this data very space efficiently thanks to its <a href="http://pachyderm.io/pfs.html">commit-based</a> file system.</p><p>Lastly our system is well setup to have other functionality built on top of it.</p><h3>What can we build on this?</h3><p>So far we’ve built a simple system that will take a snapshot of the internet whenever we tell it to. Now we’re going to automate this process using <em>cron</em> to create complete our Wayback clone. Add the following to your crontab to create a new commit every hour on the hour:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/936642fd6dc972a8dbb323bf6afab91a/href">https://medium.com/media/936642fd6dc972a8dbb323bf6afab91a/href</a></iframe><p>The commits will have names corresponding to the time they were created, such as 2015–06–18–00 (the last number is hours). You can access a webpage as it appeared at a given time by appending ?<em>commit=2015–06–18–00</em> to any Pachyderm request. This is where the <em>timestamping </em>flag from Step 3 comes in. With this flag, <em>wget</em> matches each file’s modtime to the modtime returned by the server. This allows <em>wget </em>to avoid downloading the same data twice. You’ll find that even with a large set of URLs, scrapes show up pretty quickly after commits because of how many of the files are unchanged and thus get skipped.</p><p>Once our cronjob is set up, we’ve basically got a fully working Wayback Machine. But we can actually build even more on top of that because Pachyderm’s pipeline model makes it really easy to chain computations together. For example, we might want to index each new batch of scrapes as they come in. We can accomplish that by adding a line to our Pachfile like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a7cd971ee9a757bf7e2133d9a39fd3b/href">https://medium.com/media/5a7cd971ee9a757bf7e2133d9a39fd3b/href</a></iframe><p>This will run <em>indexer.py</em> in a container with the output of the scraper visible to it. Like with the scraped data, the indexed data can be served directly out of Pachyderm and will have the same commit-based properties as everything else in this tutorial. I haven’t actually built indexer.py, the tutorial has to end somewhere afterall. But you can build it yourself! And if you do we’d love to hear about it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99884b2ff95c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pachyderm-data/build-your-own-wayback-machine-in-10-lines-of-code-99884b2ff95c">Build your own Wayback Machine in 10 lines of code.</a> was originally published in <a href="https://medium.com/pachyderm-data">Pachyderm Community Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pachyderm v0.4: s3 and git integration]]></title>
            <link>https://medium.com/pachyderm-data/pachyderm-v0-4-s3-and-git-integration-dd7d5a185458?source=rss-487b96ead925------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd7d5a185458</guid>
            <dc:creator><![CDATA[Joe Doliner]]></dc:creator>
            <pubDate>Fri, 13 Feb 2015 17:56:50 GMT</pubDate>
            <atom:updated>2015-02-13T21:31:30.096Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pachyderm v0.4: git and s3 integration</h3><p>A key principle of <a href="https://medium.com/pachyderm-data/lets-build-a-modern-hadoop-4fc160f8d74f">modern open source projects</a> is that they need to integrate smoothly into users’ already-established workflow. We realize that learning a new interface is a huge cognitive burden for our users so we’re always looking to avoid it.</p><p>This time last month, we shipped the first version of Pachyderm MapReduce (pmr). The MapReduce engine works, but the interface was a significant barrier to using it effectively. We spent this month <a href="https://medium.com/pachyderm-data/when-grandmasters-blunder-a819860b883d">dogfooding</a> that interface so that we could come up with a better one that felt natural. At the end of the day we realized it was staring us in the face all along. Writing a computation pipeline is still just writing code and the only tool we wanted to use for managing our code is git. So that’s the interface we went with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bgRTgv8bGu_t9FuHLAxlNw.gif" /><figcaption>In Pachyderm v0.4 jobs are launched with `git push`.</figcaption></figure><h4>The spec</h4><p>The first thing we needed to do was figure out how we were going to represent pipelines. We knew we were going to be pushing this around using git so we wanted to stick to a simple directory structure with text files. A first draft of the spec is available <a href="https://github.com/pachyderm/pfs/blob/master/spec/repo-pipeline.md">here</a>. The tl;dr is that each repo comes preloaded with:</p><ul><li>a <a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph">DAG</a> of jobs which define the dependencies between them</li><li>a Dockerfile which can be built in to an image to implement the logic for each job.</li><li>A set of scripts which can be used to install the pipeline on various engines.</li><li>An optional sample of the data which can be used to test images locally to further speed up development.</li></ul><p>We’ve made the pipeline from our <a href="https://medium.com/pachyderm-data/when-grandmasters-blunder-a819860b883d">chess demo</a> into a <a href="https://github.com/pachyderm/chess">functioning example</a>.</p><h4>Installing a pipeline</h4><p>We wanted to make installation only one command harder than cloning the repo. A short setup time is just as important as short dev cycles. This is what you do to install the chess repo on a running cluster:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fbdbadd717c15d7b6b0654e4201e1862/href">https://medium.com/media/fbdbadd717c15d7b6b0654e4201e1862/href</a></iframe><p>This will give you a remote called <em>pachyderm</em> that you can push to with `git push pachyderm master`.</p><h4>What happens when you push</h4><p>When you push, the <a href="http://git-scm.com/docs/githooks"><em>post-receive</em></a> hook on the server gets triggered and:</p><ul><li>Builds an image using the code in the repo</li><li>Pushes that image to a local Docker registry in the Pachyderm cluster</li><li>Copies the DAG of jobs into the cluster</li><li>Kicks off the pipeline!</li></ul><p>These computations are all done in their own pfs branch so your job is isolated from the rest of the cluster. You can share results with others by sharing the link returned by the hook.</p><h3>Pachyderm MapReduce over S3</h3><p>Pachyderm MapReduce jobs can now take input directly from s3! This was by far our most commonly requested feature so we were happy to add it. Many people use S3 as their catch-all persistent storage layer and we wanted to minimize the friction for doing computation over that data. Pachyderm and S3 now work in tandem to offer the best of both worlds! <a href="https://github.com/pachyderm/pfs/blob/master/README.md#integrating-with-s3">Read more here.</a></p><p>We’ve loaded the dataset for our chess demo in to a public bucket, s3://pachyderm-data/chess. The chess repo uses this as its input so you can run it without downloading any data. <a href="http://github.com/pachyderm/chess">Clone it now and start analyzing games</a>!</p><p>We also made a number of other improvements including local Docker registries inside your cluster which greatly speeds up how fast you can pull jobs. We use local Docker registries and GitHub integration for internal development on Pachyderm too!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd7d5a185458" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pachyderm-data/pachyderm-v0-4-s3-and-git-integration-dd7d5a185458">Pachyderm v0.4: s3 and git integration</a> was originally published in <a href="https://medium.com/pachyderm-data">Pachyderm Community Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When Grandmasters Blunder]]></title>
            <link>https://medium.com/pachyderm-data/when-grandmasters-blunder-a819860b883d?source=rss-487b96ead925------2</link>
            <guid isPermaLink="false">https://medium.com/p/a819860b883d</guid>
            <dc:creator><![CDATA[Joe Doliner]]></dc:creator>
            <pubDate>Mon, 19 Jan 2015 21:07:26 GMT</pubDate>
            <atom:updated>2015-02-05T20:38:21.212Z</atom:updated>
            <content:encoded><![CDATA[<p>A statistical analysis of chess.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5l-3EuDZNXTXRXTkBBaIMA.jpeg" /><figcaption>Magnus Carlsen and Viswanathan Anand playing in The World Chess Championship</figcaption></figure><p>Sochi, Russia — Magnus Carlsen was 26 moves into game 6 of his title defense against Viswanathan Anand when he experienced the worst feeling in chess. The feeling that comes with the realization that you’ve left one of your pieces out to dry and there’s nothing left to do, but pray. Blunders like this are all too common when I play chess, but they’re incredibly rare at this level. Anand and Carlsen are some of the greatest to play the game, they (almost) never do things like this. What followed was even more incredible. Despite his blunder, Carlsen went on to win game 6 (and the series) thanks to Anand responding immediately with a blunder of his own. After the game Carlsen described it as “a comical exchange of blunders.”</p><p>Blunders at this level are rare, but just how lucky are we to have seen a turn of <a href="http://en.wiktionary.org/wiki/patzer">patzer</a> play from this pair? In this post we’ll take an analytic approach to this question. We’ll start by developing a computational way to classify blunders. Then we’ll gather a year’s worth of chess games and store it in a distributed file system so that we can use a cluster of machines to analyze the games with a MapReduce engine. Full disclosure: I’m one of the founders of <a href="http://pachyderm.io/">Pachyderm</a>, the distributed file system and MapReduce engine that we’re going to be using. However, I’m not a data scientist, so please email me if there are any mistakes: jdoliner@pachyderm.io.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rypQStgOFauelnPiWJimdw.png" /><figcaption>A classification of all the moves played in 2014. Created using Crafty and Pachyderm.</figcaption></figure><p>The first thing we need to settle is “what is a blunder?” A human will tell you that a blunder is a move which substantially decreases the player’s chances of winning. Good players can classify a move as a blunder with just a few seconds’ thought, but even that’s too slow for our purposes. Instead we’re going to be using a computer chess player or “chess engine” called <a href="http://www.craftychess.com/">Crafty</a>.</p><p>Crafty is far from the strongest engine on the market right now, but it has one very appealing feature called “annotation mode.” This mode takes an already-completed game and highlights moves which Crafty believes to be suboptimal. It doesn’t just classify moves as blunders or non-blunders, it also quantifies how bad the blunder is in units of pawns.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25e854b0fa1efadbc065ef3e5a6d995d/href">https://medium.com/media/25e854b0fa1efadbc065ef3e5a6d995d/href</a></iframe><p>For example, applying crafty to the Carlsen-Anand game shows that players hurt their positions by approximately two pawns with their blunders. This might not seem like a lot, but in high-level chess, a two-pawn deficit is almost always a loss.</p><p>Now that we have a way to classify blunders, we’ll need to bundle Crafty up in a Docker image so we can use it in Pachyderm. The source for our image is available on <a href="http://github.com/pachyderm/chess">GitHub</a> or it can be pulled directly from the <a href="https://registry.hub.docker.com/u/pachyderm/pfs/">Docker registry</a>. The image contains two http servers. A <em>map </em>server which takes chess games in <a href="http://en.wikipedia.org/wiki/Portable_Game_Notation">.pgn format</a> and returns the ratings of the players and a bucketed count of Crafty’s scores of the moves. And a <em>reduce</em> server which takes the results from the <em>map </em>server and aggregates them into buckets based on the player’s rating.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/735c90b6782b9a4da7bf844c806c7883/href">https://medium.com/media/735c90b6782b9a4da7bf844c806c7883/href</a></iframe><p>Next we’ll need to get a Pachyderm cluster <a href="http://www.pachyderm.io/#get-started">up and running</a> and filled with data. Using data from <a href="http://chessgames.com/">chessgames.com</a>, we wrote a simple script to upload it to Pachyderm’s file system (pfs) and kick off the pipeline. The script and data are available in the repo along with more detailed instructions on how to reproduce the results yourself.</p><p><a href="http://github.com/pachyderm/chess">Extend the analysis by forking the repo</a>.</p><p>Crunching all the games from 2014 took about six hours on Google Compute Engine. In total, Crafty analyzed 4,899,067 moves and found that a scant 67,175 (1.37%) were two-pawn blunders or worse. Limiting ourselves to players with ratings above 2500 (Grandmasters) that number falls to 1.07%. If we narrow it down to players above 2775, which both Carlsen and Anand were during the championships, it falls all the way to 0.96%. Assuming Anand and Carlsen’s blunders were independent events, what we saw was a 1 in 10,000 occurrence. In other words, 1 in every 10,000 pairs of moves exchanged by players at this level should result in a double blunder. Of course, The World Chess Championship consists of more than a single pair of moves. Assuming 12 games of about 50 moves each, we can expect to see 600 move pairs which means seeing an exchange like this in a WCC event is more like a 1 in 20 event. So what we saw wasn’t actually that incredible, merely unlikely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SbqPPsFf0RoCXcnTXc13HQ.png" /><figcaption>Blunders become exponentially less likely as rating increases.</figcaption></figure><p>The data reveals a strong correlation between blunders and rating. As we’d expect, highly-rated players blunder much less frequently than their lower-rated counterparts. Playing around with the data in Excel, we found exponential functions to be the best fit. The trendline above indicates that gaining 600 rating points halves the number of blunders a player makes. Chess, it seems, is a game of diminishing returns.</p><p>There are lots of cool stories you could tell with this data. We limited ourselves to games from 2014. I’d be interested to see how blunder occurrence has changed over time. There are also a few obvious ways that our analysis could be improved. Due to cost limitations we had to limit crafty to 2 seconds of analysis time per move and we only looked at a fraction of chessgames.com’s total corpus. We may look into doing an updated version of this post with a bigger budget.</p><p>Fork the jobs here: <a href="https://github.com/pachyderm/chess">https://github.com/pachyderm/chess</a></p><p>Install pfs here: <a href="https://github.com/pachyderm/pfs#quickstart-guide">https://github.com/pachyderm/pfs</a></p><p>Thank you to: Marc Hesse, Josh Katz, Trevor Blackwell, Slava Akhmechet, Daniel Gackle, Dalton Caldwell, Lenny Levin and Yuri Sagalov for reading drafts of this post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a819860b883d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pachyderm-data/when-grandmasters-blunder-a819860b883d">When Grandmasters Blunder</a> was originally published in <a href="https://medium.com/pachyderm-data">Pachyderm Community Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>