<?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 Boaz Berman on Medium]]></title>
        <description><![CDATA[Stories by Boaz Berman on Medium]]></description>
        <link>https://medium.com/@boazberman?source=rss-c934e94437e8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7J-YOBWkDygw0eB9p8ftsg.jpeg</url>
            <title>Stories by Boaz Berman on Medium</title>
            <link>https://medium.com/@boazberman?source=rss-c934e94437e8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 16:47:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@boazberman/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[The Big Data Intro I wish I’ve got]]></title>
            <link>https://medium.com/@boazberman/the-big-data-intro-i-wish-ive-got-b435875b4dbe?source=rss-c934e94437e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b435875b4dbe</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[airflow]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[spark]]></category>
            <dc:creator><![CDATA[Boaz Berman]]></dc:creator>
            <pubDate>Thu, 10 Jan 2019 18:27:53 GMT</pubDate>
            <atom:updated>2019-01-10T18:27:53.849Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8ntzbuisxSPJcrwL.jpg" /></figure><h3>Preface</h3><p>According to Wikipedia, Big Data is defined as:</p><blockquote>Data sets that are too large or complex for traditional data-processing application software to adequately deal with.</blockquote><p>So if you can deal with your data by common tools, do it. If not, this article is for you.</p><h3>Prologue</h3><blockquote><strong>We don’t know a millionth of one percent about anything. </strong>Thomas Edison</blockquote><p>The gold standard in doing big data is to stream constantly, and do it in real time. But streaming is complicated and usually more expensive. That is why we are currently happy with the mid-way solution of batch processing.</p><p>Batch processing is the task of timing a processing job every epoch (could be triggered by time or by size).</p><p>The task of processing data to make it ready for consumption is often referred to as <a href="https://en.wikipedia.org/wiki/Extract,_transform,_load">ETL (<strong>E</strong>xtract <strong>T</strong>ransform <strong>L</strong>oad) Processing</a>, and the journey of taking a piece of data from a raw form to it’s final form is called “the <strong>data pipeline</strong>”.</p><h3>Choose Your Tools</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eTc56tDRPLAUVEMUQxBUog.png" /></figure><p><a href="https://spark.apache.org/">Apache Spark</a> is the tool helping us to write the transformations (the T in ETL), while the data is being extracted (the E in ETL) from our HDFS (which works tightly together with Spark).</p><p>The data is finally saved after being processed (the L in etl) in either HDFS or any other database elected as a best fit (e.g. S3 for JSON files, Oracle DB for BI…).</p><p>To time the processing of the data and to handle the dependencies between various processing stages,we use <a href="https://airflow.apache.org/">Apache Airflow</a>.</p><h3>Rules of Data Engineering in the Big Data World</h3><h4>1. Save What You Serve</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*dtczrG-cWhuGZbbx.jpg" /></figure><p>As there are many reasons to why, this section will address only one of them, as the rest will be discussed further in the next sections.</p><p>Saving the data in the form it will be consumed is the best way to guarantee good performance and reduce possible bottle necks.</p><p>For example if the data cannot be altered once produced and is consumed by a web app, it can be saved as a single JSON file to be served from the file system once the request will arrive.</p><p>If the consumer of the current ETL process is another ETL process then probably a good solution (in our tooling) would be to save it as a <a href="https://parquet.apache.org/">parquet</a> on the HDFS for faster processing.</p><h4>2. The Least Common Denominator</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*FiKu2pWK6oSjttJp.jpeg" /></figure><p>Once an ETL was finished, the produced data is used by various consumers, including another ETLs, web applications and such. This creates coupling between the schema of the produced data and its consumers.</p><p>The coupling to schema of data is a two edged sword in which the producer is eager to provide the consumers with as much data as he can, and the consumers starts to use the data in ways the producer has not imagined.</p><p>Data sources change over time. Including what information they carry and what fields they contain. Data produced from them in our pipeline has either to be produced differently, or to be fetched from another source.</p><p>To reduce the fragility of our data pipeline and bake robustness into it, we strive to provide as shallow and concrete schema of data as possible in each step of the pipeline.</p><h4>3. Check, Verify, Ensure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/0*y8Qupx7ztYGApy3F.jpg" /></figure><p>Check that the data is present before even attempting to further process it.</p><p>Verify that the schema is as expected, and that there is no corruption within, and that the amounts of aggregated data is as expected.</p><p>Ensure that the produced data is reasonable, that the outputted schema is correct, and that the sizes match.</p><p>Remember, once a step in the pipeline had finished successfully, the next steps are relying on its product to be a hundred percent correct.</p><h4><a href="https://www.restapitutorial.com/lessons/idempotency.html">4. Idempotency</a>, the Unforsaken Saver</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*u6qnbvecLejXKuI2.jpg" /><figcaption>Non idempotent solution to power, as one click is to turn it on, and an identical secondary click will turn the power off.</figcaption></figure><p>Software breaks. Sometimes due to computer faults, sometimes due to human/developer faults.</p><p>Once a fault has occurred in our data pipeline, we wish to iron it, by rerunning the step that faulted. To not cause data corruption, duplicates, zombie data, or any other bad consequence, we wish to <strong>allow the same processing stage to run again, regardless of past runs</strong>. This is called <em>idempotency</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*KGzfhO9gJAGc7Z2B.jpg" /><figcaption>Idempotent solution to power, as on &amp; off are a complete separate actions.</figcaption></figure><p>Baking this kind of robustness into the steps in our data pipeline is the difference between a robust data pipeline and a fragile one.</p><h4>5. Commit To Your Tools for Better Leverage</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*MtEcRa9uR-9VoCuF.png" /><figcaption>Airflow’s GUI, here showing a DAG of some data pipeline.</figcaption></figure><p><strong>Airflow </strong>is supplying us with lots of checks and validations, such as:</p><ul><li><strong>HdfsSensor </strong>which we use to verify that the hdfs files exist before processing them.</li><li><strong>ExternalTaskSensor</strong> to force connections between tasks of different teams.</li><li><strong>TimeSensor </strong>to wait till mid-night to process some heavy tasks.</li><li>etc.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*siOt2Um1rpHsac70.jpg" /></figure><p><strong>Spark</strong> can enforce schema matching, and verify data sizes before processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uB4x2bi3ecFUIx3N.png" /></figure><p><strong>Gitlab-CI</strong> is running tests upon code change to ensure that the ETL’s code remains correct.</p><figure><img alt="×ª××¦××ª ×ª××× × ×¢×××¨ âªjupyterâ¬â" src="https://cdn-images-1.medium.com/proxy/1*LPnY8nOLg4S6_TG0DEXwsg.png" /></figure><p>And <strong>Jupyter </strong>is playing a crucial part of the way we explore and study various aspects of the data.</p><h3>Epilogue</h3><blockquote>Data is eating the world, have your bite of it.</blockquote><p>Interested in <strong>testing data pipelines</strong>? Stay tuned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b435875b4dbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Going Transaction-less]]></title>
            <link>https://medium.com/@boazberman/going-transaction-less-3efad66eabbd?source=rss-c934e94437e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3efad66eabbd</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[transactions]]></category>
            <category><![CDATA[message-queue]]></category>
            <dc:creator><![CDATA[Boaz Berman]]></dc:creator>
            <pubDate>Sat, 06 May 2017 11:24:29 GMT</pubDate>
            <atom:updated>2017-05-11T17:15:00.410Z</atom:updated>
            <content:encoded><![CDATA[<p>When migrating to microservices architecture, there are several implications that should be considered. In this article, I review the implications of breaking a monolith, where a single relational database is used, to a newly distributed system, where a transaction is needed to span over multiple services and databases.</p><p>In a monolith with a single relational database, all actions are shielded by a single transaction. The transaction in the relational space is what preventing us from losing any data in case of failure.</p><p>A transaction is defined by a set of rules, referred to as <a href="https://en.wikipedia.org/wiki/ACID"><strong>ACID</strong></a>, consist of the following:</p><ul><li><strong>A</strong>tomicity- transaction must be “all or nothing”.</li><li><strong>C</strong>onsistent- applying a transaction must resolve in the expected state.</li><li><strong>I</strong>solated- one transaction should not affect another.</li><li><strong>D</strong>urable- once a transaction was ended, it shall not be defected.</li></ul><h3>No Single Transaction, Who Cares?!</h3><p>Well, you should. Let’s describe a failure scenario which result in an inconsistent state of our system. In this simple scenario we have two services: A &amp; B. Now lets describe an action which demands some data to be changed on Service A, and afterwards on service B.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*oP0pdVWy8ymAyDmsvnun9g.png" /><figcaption>Illustration of a command effecting service A and service B</figcaption></figure><h4>Two scenarios:</h4><p>Commit A’s transaction, then we apply our changes to service B. In That scenario, in case service A crashes right after the transaction ended, and before B’s changes were applied, we resolve in a new state in A, and an outdated state in B. Not good.</p><p>Trigger changes in service B, then commit A’s transaction. Here, if A crashes after B has received the notification, and triggered his changes, B’s state would alter, but A’s state would rollback. Now resolving in an outdated state in A (or perhaps a wrong state in B if A’s failure was cascaded properly). Bad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gYRQ3sHmvL41CfSNcIihNg.jpeg" /></figure><h3>Dealing with failure</h3><p>As in the scenario I’ve described, this is by far the riskiest element inserted to distributed system. Distributed systems fail, and fail a lot. Coming from the comfy spot of <a href="https://en.wikipedia.org/wiki/ACID">ACID</a>, you ought to figure out how to ensure that failure won’t cascade, neither damage data consistency. Although this new concern must be tackled, <strong>aim solving it while adding as less developer complexity as possible.</strong></p><h3>A Solution Must Be Found</h3><p>The following part describe how we tackled failure in my current project, where we migrated to microservices architecture.</p><h3>All Praise CQRS</h3><p>Command Query Responsibility Segregation (<a href="http://cqrs.nu/Faq">CQRS</a>) was a key in how we approached the problem. CQRS basically means separating how you deal with query- a request for data, translated to get requests in the http world, from how you deal with a command- an action that result in altering data/state, which is equivalent to post/put/patch/delete requests in http.</p><p>Following the much abstract guidelines of CQRS, we took a decision to deal with each of them differently: Query would remain a simple json call over http. Command however is far tricky.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*nWTWhgWQIptphFylZHCf9A.png" /></figure><h3>Breaking down the Command</h3><blockquote>The command is the trickiest part. As we left our cozy ACID world, compromises must be made. We decided to make one on consistency.</blockquote><p>Our compromise was aiming at <strong>eventual consistency</strong>. Which is the allowance for a service’s state to not reflect the most recent condition in the entire application, as long as there is a promise for that further ahead at time, the whole system would consume and reflect that condition. So how do we put it on practice?</p><blockquote>Smart endpoints and dumb pipes. Martin Fowler.</blockquote><p>Every command wished to be sent to another service is published as a message in a queue, without explicitly designating it to that service. Our purpose is to make the message public for all to consume, so the messaging architecture becomes pull-driven instead of push-driven.</p><h3>The Journey</h3><p>A command is treated as a message that is needed to be passed along. <strong>The message </strong>is first <strong>persisted</strong> to the relational database along <strong>with the transaction</strong>. Afterwards, a Kafka Connect JDBC <strong>service</strong> <strong>is pulling</strong> that event from the database. Third, the Kafka Connect <strong>service</strong> <strong>is publishing</strong> the event onto a <strong>topic</strong> (which is a message queue in Kafka). From there on <strong>any service wishing to consume</strong> that event and act upon it can.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*Klwge8rNgN9wIHd8407x9w.png" /><figcaption>The journey of a Command that affects service A and then service B</figcaption></figure><blockquote>We diminished any possible failure points, where multiple actions needed to be made together, by replacing them with atomic operations.</blockquote><p>Now let’s deep dive into the architecture decisions made here.</p><h4><strong>Kafka as a message queue</strong>.</h4><p><a href="https://kafka.apache.org/">Kafka</a>, being a distributed <a href="https://engineering.linkedin.com/distributed-systems/log-what-every-software-engineer-should-know-about-real-time-datas-unifying">Log </a>(data structure) is very plain and has no side effects in it. Its whole goal is to enable appending data to a log, and allow consuming it. We were aiming at easy to grasp architecture, with as few “magics” as possible. Yet Kafka is rocket-fast, rock solid, highly tolerate and very popular.</p><h4><strong>Kafka JDBC Connect</strong> Source</h4><p>This is a service, written by the creators of Kafka, aimed at allowing pulling data from a relational database (any database that could be connected via a JDBC connection url). We run this service in production next to our services. We get two major gains from the Connect:</p><p>First, and foremost, persisting to the relational database our message keeps us in the ACID world, retaining the transaction, and therefore preventing any data loss (since in case of failure, the whole transaction is rolled back, and no other mutations are occurring).</p><p>Second gain is that developers are sticking to their traditional RDBMS world, so no sharp objects here as they develop features.</p><h3>Commit;</h3><p>Even though some understanding in distributed systems is needed to understand our reasons for this bit complicated architecture, the real goal this architecture is aiming for is to minimize the impact of service to service communication in the everyday development process, less points of failure, leading to robustness in low cost.</p><p>So far for this article. Thanks for reading, feel free to contact me through twitter and share your thoughts with me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3efad66eabbd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>