<?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[Quantcast Engineering - Medium]]></title>
        <description><![CDATA[Insights and perspectives from Quantcast engineers - Medium]]></description>
        <link>https://medium.com/quantcast-engineering?source=rss----c43aa6b14788---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Quantcast Engineering - Medium</title>
            <link>https://medium.com/quantcast-engineering?source=rss----c43aa6b14788---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 05:55:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/quantcast-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Making Online Advertising Less Obnoxious with Frequency Management]]></title>
            <link>https://medium.com/quantcast-engineering/making-online-advertising-less-obnoxious-with-frequency-management-bb3aafc05287?source=rss----c43aa6b14788---4</link>
            <guid isPermaLink="false">https://medium.com/p/bb3aafc05287</guid>
            <category><![CDATA[pid-controller]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[quantcast]]></category>
            <category><![CDATA[advertising]]></category>
            <category><![CDATA[control-theory]]></category>
            <dc:creator><![CDATA[Rolland He]]></dc:creator>
            <pubDate>Fri, 28 Jun 2019 19:03:04 GMT</pubDate>
            <atom:updated>2019-06-28T19:03:04.740Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_z7LR5hB9gwewKmWVSw8Hg.png" /></figure><p>According to a <a href="https://research.hubspot.com/why-people-block-ads-and-what-it-means-for-marketers-and-advertisers">consumer survey published by Hubspot</a> in 2016, “83% of respondents agree that not all ads are bad, but they want to filter out the really obnoxious ones.” At Quantcast, we know that when digital advertising is obnoxious, everyone loses — marketers, publishers, and consumers. So we’re constantly trying to make ads more useful and less annoying.</p><p>Lately, we’ve been tackling one category of obnoxious ad: the repeated banner ad (you know, that same ad that seems to appear on every single site you visit). We wanted to help our advertisers set a desired frequency for their campaigns, making them frequent enough to be memorable, but not so frequent as to waste budget or drive away potential customers. Even though it seems straightforward — just track the number of ads that have been shown to each user, right? — frequency management presents a number of complexities in a real-time bidding environment.</p><h3>Goal</h3><p>We solve a multi-objective optimization problem when we make bids on ad opportunities (this happens millions of times a second), and for most of the goals we’re trying to optimize, we’re aiming at a single number, like our advertiser’s target budget or audience composition. For frequency management, the natural corollary would be an <strong>average</strong> <strong>frequency</strong>: # of ads delivered (AKA impressions) / # of users who saw ads for the campaign.</p><p>But the desired average could be maintained even if a few users get bombarded with ads while others only see a single ad. Our goal was to have most users see the ads enough times to get a memorable impression of the product, but not so many times that they become annoyed. So we needed a way to control for both the average frequency and the <strong>frequency distribution</strong>.</p><p>Finally, consider the difference between a user seeing an ad once a day for five days vs once a minute for five minutes. Even if the frequency is identical, a change in the <strong>cadence </strong>— the time interval in between repeating the ad — could mean the difference between a good and a bad experience. Therefore,<strong> </strong>our solution also needed to maintain the right cadence.</p><h3>Implementation</h3><p>Whether or not we show an ad on a given page depends on whether we win the online auction for that ad opportunity. In the backend, we generate billions of potential bids per second, trying to make the optimal one that will push us closer to our advertisers’ various (and often competing) campaign goals. Introducing a new goal of average frequency required updating and re-tuning this complex system; additionally, we needed to implement some new methods of control for the frequency distribution and the cadence.</p><p>Parts of our bidding system use proportional-integral-derivative (PID) control, a type of closed feedback loop that looks at the error between where we are and where we want to be, and sums a proportional, integral, and derivative term to update our bidding behaviors in a way that keeps us on track towards the advertisers’ goals. When we introduced a new campaign goal targeting an average frequency (impressions / cookies), we updated our PID control system to adjust our bidding behavior so that we favor ad opportunities that help us hit that desired average. After some tuning, here’s an example of how our PID system did at honing in on the average and maintaining it over a month-long campaign:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/0*fgOJ4j7dv92lQUOJ" /></figure><p>But as we mentioned before, setting an average frequency wasn’t enough to achieve our goals; we had to make sure we were also seeing a frequency distribution that resembled a bell curve. So in addition to keeping the average frequency in control, we implemented a parallel control loop which closely monitors the frequency distribution and appropriately adjusts the maximum frequency of impressions we can show any individual cookie. The basic mechanism is that if we’re undershooting the target frequency, we’ll increase the frequency cap, and if we’re overshooting, we’ll decrease it. We capped the max frequency as well, setting a firm limit on how many repeat ads can be shown to a user.</p><p>Finally, to serve ads at the appropriate cadence, we introduced some logic to prevent bombarding a single cookie with multiple impressions in a short span of time. We use a factor that devalues cookies that we recently served to (in the past several hours), and this devaluation effect decays exponentially over time.</p><h3>Results</h3><p>After implementing our new frequency goal in our multi-goal optimization system, we were able to achieve a much better frequency distribution than before, as shown in this campaign:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*7XHK9-p0cPKSVbEY" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/0*xmhvt_D5oLKrk5pj" /><figcaption>Comparison of our frequency distributions before and after we implemented our frequency controller</figcaption></figure><p>In this example, we’ve greatly mitigated the repeated banner ad problem. Before, one third of the total impressions in the campaign were shown to users who saw more than 50 impressions (shown by the gray bars); additionally, a nontrivial number of users (cookies) were served the same ad more than 20 times (shown by the red bars). After implementing frequency control, we see these extremes mostly disappear. Another positive outcome is that frequency management should make ads more effective for marketers. Before, 45% of users would only see the ad once; now, many more users see the ad enough times for it to have an impact.</p><h3>Challenges</h3><p>While frequency management has the potential to be a big win for consumers, marketers, and publishers, there are some inherent difficulties to solving it entirely.</p><p>For one, the way our system identifies a unique user is through an anonymized cookie. But cookies are a highly imperfect representation of unique users, because they have a notorious churn rate; they constantly get deleted and replaced. <strong>Cookie churn </strong>is an unavoidable challenge affecting the ad tech industry as a whole, but it’s particularly problematic for frequency management, where unique users is a key metric.</p><p>Additionally, implementing frequency management started to push the limits of our PID control system. PID control is robust and fast, but it was designed for simple single-input/single-output (SISO) systems. The more variables we add, and the more correlations that spring up between them, the less accurate and stable PID becomes. In implementing frequency management and other additional goals, we’ve seen PID experience problems with converging on the optimal solution even after extensive tuning. As such, we’ve turned to other methods of control, like Model Predictive Control (MPC).</p><p>MPC is a term encompassing a large number of different ideas; broadly, it means using historical data to build a model that predicts how a process will perform given a set of input signals, and updating the model at each time step with information from the previous time step. Compared to PID, MPC is able to handle nonlinear dynamics in the control problem and can get to equilibrium faster. On the other hand, MPC is much more computationally and memory intensive, more laborious to implement, and requires training and maintaining a potentially complex model.</p><p>___________________________________________________________________</p><p>In tackling frequency management, we’ve made a dent in the number of obnoxious ads online, improving the outcomes for advertisers, publishers, and end users. Frequency management is a complex problem that has had implications for our entire control system, and we aren’t done solving it. Want to help make online advertising more useful and less annoying? Check out some of Quantcast’s open roles <a href="https://jobs.lever.co/quantcast?">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb3aafc05287" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quantcast-engineering/making-online-advertising-less-obnoxious-with-frequency-management-bb3aafc05287">Making Online Advertising Less Obnoxious with Frequency Management</a> was originally published in <a href="https://medium.com/quantcast-engineering">Quantcast Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lessons From Migrating DNS Systems]]></title>
            <link>https://medium.com/quantcast-engineering/lessons-from-migrating-dns-systems-140c22b5218c?source=rss----c43aa6b14788---4</link>
            <guid isPermaLink="false">https://medium.com/p/140c22b5218c</guid>
            <category><![CDATA[quantcast]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[dns]]></category>
            <dc:creator><![CDATA[Mike Booth]]></dc:creator>
            <pubDate>Wed, 12 Jun 2019 22:56:36 GMT</pubDate>
            <atom:updated>2019-06-12T23:00:56.588Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XL65lGKiRNKg3Tazk1-g5w.gif" /></figure><p>On the Network and Cloud Infrastructure team at Quantcast, we use Amazon Web Services (AWS) as part of our cloud-majority hybrid infrastructure setup. Our platform runs mainly on Amazon VPCs (Virtual Private Clouds), which process and route more than 20 petabytes of data per day. Up until recently, these VPCs used our old, in-house DNS system, Active Directory with Linux DNS resolvers. This article is about moving to Amazon’s DNS system (called Route 53) and the surprising “gotchas” that happened along the way.</p><p>It seemed like an easy transition: we just had to get the zones in Route 53 to look exactly like the zones in Active Directory. In a DNS system, a zone is a container that holds information, called resource records, about how you want to route traffic for a domain and its subdomains within the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*WWBNeTllZdwA0IWEAreMrg.png" /><figcaption>Visualization of initial transfer flow</figcaption></figure><p>We wrote a script to do a zone transfer (the standard way to share zone information in DNS) from Active Directory to a service we spun up for this purpose, since Route 53 doesn’t like talking directly to AD. This intermediary service then performed another zone transfer to Route 53, filling in the records. After this was done, the transition itself was literally a one line change in a config file for all our VPCs, to get them to start talking to Route 53 Resolver instead of our Linux resolvers. We didn’t even expect anyone at Quantcast to notice the change (besides maybe appreciating a performance bump).</p><h3>What Could Go Wrong?</h3><p>After the transition, to our dismay, we saw some automated jobs failing. When we investigated, it looked like the network wasn’t able to locate an internal resource — something was missing from the zones in Route 53. Our tests hadn’t caught this problem, and so we felt like it was a good idea to roll back the change. The rollback was, again, a simple config change to point the network back to our old DNS system.</p><p>As the rollback went into effect in the evening, we were shocked to see a huge slowdown across our platform. Some of our servers were running up a rapidly growing backlog, and as pages started going down, the whole platform team jumped on Slack. After a late night of debugging, when it seemed like we had tried everything, we decided to try pointing one of the affected servers back at Route 53 DNS — and its performance skyrocketed. We got our system back online by pointing all the affected servers back at Route 53. It took us a while to untangle what had happened (read on for our theory) and to finish up the transition.</p><h3>Lessons Learned</h3><h3>1) Know the limits of both your DNS systems before trying to replicate between them</h3><p>Eventually, we discovered that only one record had caused those jobs to fail, kicking off the rollback and the outage. The culprit was the sole record in a zone in AD DNS that wasn’t being pulled into Route 53. Route 53 doesn’t allow private subzones such as `test.quantcast.internal` IF `quantcast.internal` already exists as a Route 53 zone. On the other hand, AD does support this. Had we done an initial accounting of the restrictions of the systems, we might have realized where the rules differed. (Better testing to confirm that Route 53 was a perfect mirror of AD DNS could have also caught this problem.)</p><h3>2) Clean up tech debt before a migration</h3><p>It’s a good idea to think of a DNS migration as a chance to clean up unused or redundant records and internal resources. The zone that was creating the problem held a single CNAME record which just pointed to another domain name. It was sitting around because most of the jobs still used the old name, and no one had refactored the many internal references to it. (Fun fact: Quebecois websites are typically hosted under .qc.ca, so we moved away from our .qc naming structure internally, since we were worried about split-horizon DNS issues in the event of independence. Perhaps we can rest easier knowing <a href="https://en.wikipedia.org/wiki/.quebec">.quebec</a> now exists.)</p><h3>3) Rollbacks can’t always be counted on to return a system to its previous state</h3><p>Although the missing resource record was the real bug here, we ran into much bigger problems when we rolled back. One of the things that can complicate rollbacks is that the automatic control mechanisms in use by your clients may have changed because of the release. It’s a particularly pernicious form of hidden state.</p><p>In this case, our theory of what happened is that when our VPC hosts started hitting Route 53 DNS, it was answering much faster than the Legacy DNS they were used to. In return, the hosts ramped up their performance to take advantage of what Route 53 could handle. But when Route 53 was suddenly replaced by Legacy DNS after the rollback, the hosts didn’t ramp down their behavior. They kept acting as if they were interfacing with the much higher-performing Route 53 Resolver, and Legacy DNS couldn’t handle the volume of queries.</p><p>Amazon doesn’t expose much here, and there weren’t any major red flags in our server logs to go off of. But the best working understanding we have of what happened is this: client behaviors are version dependent, and as a result rollbacks can lead you to suffer from problems the previous system didn’t have because the client behaviors have changed.</p><h3>4) When migrating to a new DNS system, use forwarding from your current nameservers as an initial test</h3><p>With the outage behind us, we went back to test our migration to Route 53 with a new plan: we would keep the clients talking to Legacy DNS, and turn the Legacy DNS servers into forwarders that would point to Route 53. The general idea is to try to maintain control over the client behavior by shielding them with an extra layer of abstraction. With traffic still going through the Legacy DNS servers, we’d maintain much more control over the system, and rolling back this type of change would be much safer.</p><p>When you set up a forwarding test, make sure to clear the cache on the current nameservers to catch any DNS resource records that don’t exist in the new system. Otherwise, your legacy servers might have the resolved lookups saved, often for as long as several days.</p><h3>Conclusion</h3><p>The DNS migration seemed simple and straightforward, but if we were to do it all over again, we’d do it a little differently. Even a supposedly easy route can be full of surprises when it comes to network engineering, and we hope you can learn from us to proceed with a bit more caution and awareness of the potholes. But one of the best things we learned? Don’t panic. A sense of being in it together and a positive outlook helped us get through this outage with some takeaways to share.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=140c22b5218c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quantcast-engineering/lessons-from-migrating-dns-systems-140c22b5218c">Lessons From Migrating DNS Systems</a> was originally published in <a href="https://medium.com/quantcast-engineering">Quantcast Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Saving Millions by Dumping Java Serialization]]></title>
            <link>https://medium.com/quantcast-engineering/saving-millions-by-dumping-java-serialization-cff5ec7051c1?source=rss----c43aa6b14788---4</link>
            <guid isPermaLink="false">https://medium.com/p/cff5ec7051c1</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[distributed-computing]]></category>
            <dc:creator><![CDATA[Jackson Newhouse]]></dc:creator>
            <pubDate>Tue, 09 Apr 2019 18:47:13 GMT</pubDate>
            <atom:updated>2019-04-09T18:47:13.044Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wfssH9crgVaTRUHt99IhlQ.png" /></figure><h3>Big Data Problems</h3><p>Quantcast’s competitive edge lies in our ability to process vast amounts of data efficiently. We have hundreds of pipelines running on our hardware, processing over 30PB per day. We got to 30PB per day over the years by constantly finding new optimizations. Recently, with the cluster backlog growing and engineers starting to tap their fingers waiting for results, we faced an occasion to invent another one. We targeted an improvement to shave 10–20% off of our compute costs while reducing our storage size by several hundred terabytes. This scale of improvement would allow us breathing room necessary to either optimize additional pipelines or scale our cluster.</p><p>Here’s what we did.</p><h3>Getting to the Root</h3><p>Our commitment to instrumentation in our infrastructure aided our search for potential improvements. We keep detailed logs of every map-reduce step we run, tracking the mapper class, reducer class, job name, and cluster time. These logs revealed our most expensive pipelines, and thus which would yield the biggest gains.</p><p>We quickly zeroed in on one particular pipeline — let’s call it Hercules. Hercules was one of our most expensive jobs, produced one of the largest datasets, and output data upon which much of our advertising business depends. Improving the internals of Hercules would improve not just its performance, but the performance of downstream pipelines as well.</p><p>The second tool in our toolbox was our map-reduce profiler. This statistical profiler takes periodic stack-traces on every mapper and reducer, then aggregates the data, letting you know how much CPU time is spent within a given call. Analyzing the most expensive steps involving Hercules, we found our culprit: nested records being serialized and deserialized using native Java serialization.</p><h3>The Perils of Nested Structures and Java Serialization</h3><p>Serialization is crucial to any software company doing long-term data storage at scale; you need to reliably write your data to the filesystem and load it back into your programming language later. Serializing records is such a common problem that there is a host of ways to go about it, including Protobuf, Thrift, ORC, Avro, Kudu, and Parquet. At Quantcast, we use a proprietary format simply called a <em>rowfile</em>.</p><p>Our code is written in Java — and we could’ve just used internal Java serialization — however, this is inefficient for a number reasons. First, Java serialization relies on one of the slowest parts of Java — reflection. Reflection involves inspecting the class of an object at runtime and making decisions based on those facts. For instance, it can determine whether a List is an ArrayList or LinkedList. Unfortunately, using reflection can be incredibly slow because the Java compiler and runtime environment are unable to optimize execution.</p><p>Secondly, Java serialization produces very bulky outputs. Each serialization contains all of the data required to deserialize. When you’re writing billions of records at a time, recording the schema in every record massively increases your data size.</p><p>Rowfiles were designed to address these issues. Each Row knows the type of its fields and writes the values directly to bytes. The schema is written once on each file in a metadata header. This allows us to change schemas and read files even without knowing the class definition.</p><p>What we found when digging through the Hercules profiling data is that we were still using java serialization in some places. In particular, we were serializing the raw input rows using native serialization, converting it to a string, and saving it into a single String field. This operation was taking 50% of the cluster time for some key steps, and reading out the raw input row also proved expensive. Some quick tests showed that using rowfile serialization instead and leaving everything else untouched would yield significant benefits.</p><h3>The Devil is in the Details</h3><p>We knew that we wanted to replace the Java serialization with Rowfile serialization; the compute and space speedups were too big to ignore. However, the exact details still had to be worked out. Rowfile serialization does not keep a fixed schema around; instead, it relies on metadata to know what data corresponds to which fields. Just saving the raw bytes would render us unable to ever change the input row’s schema — an unacceptable state of affairs.</p><p>We convened a group of senior engineers to brainstorm solutions to this problem and threw solutions onto a whiteboard. Most tried to attach the input row schema in some clever way so that we would be able to modify it. Solutions in this class included the following.</p><ul><li>Prepend the byte[] with a schema ID, which could then be looked up in the code. This would require us to recompile downstream jobs in order to read new files.</li><li>Have the first byte of the encoding encode the number of fields saved. This would allow us to add fields to the end of input row but never delete them.</li><li>Store the schema in the file’s metadata along with the Hercules metadata. This would require a tremendous amount of bookkeeping as the data in these records gets passed between jobs.</li></ul><p>These were all novel solutions but faced the same challenge: serializing records disjoint from a schema in a way that allows you to modify the schema is very hard. One of the senior engineers, Kristi Tsukida, realized that Quantcast had solved this problem before, with our rowfiles. She suggested promoting the input row’s columns up to the rows in Hercules. This would allow for schema changes and efficient storage, the reasons we implemented rowfiles in the first place.</p><blockquote><em>“Early on in Hercules’ development, we used this blob approach to minimize extra work while iterating quickly — no need to add columns, modify tests, etc. — but it’s always been difficult to query. Now that Hercules is mature and more narrowly scoped, it seemed better to have the data in a simple format, rather than having to unpackage something inside of the row, as we’re optimizing for operating efficiency rather than development speed. As engineers, it’s tempting to want to design something custom, but realizing we could solve this problem with a simple approach using our pre-existing toolset was the key.” — </em><strong><em>Kristi Tsukida</em></strong><em>, Sr. Software Engineer</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZWEp0TNz7xwWwOAb.gif" /></figure><h3>Implementation</h3><p>Implementing these changes took about two months. First, we published new Row definitions for downstream consumers to use. Next, we modified Hercules to write to the new format, and verify the jobs correctness. The final and most time-consuming step were coordinating with all downstream consumers to modify their jobs so that they could read either file format. These changes affected every engineering office, 13 distinct teams, and over 50 pipelines. By working closely with other teams, we were able to deploy this big change with minimal disruption.</p><h3>Final Results</h3><p>Making this change made working with these datasets much easier. What previously required a complex series of incantations now only requires a simple field access. The non-engineer consumers of this data find it much easier to understand what data is available and what it means.</p><p>Beyond readability, the effect on our compute cluster has been dramatic. We doubled the overall targets for the optimization, saving 30% of our cluster time and a petabyte of storage. While we were running on our own hardware, in AWS these savings would back out to about a million dollars of EC2 and two million dollars of storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KG4YUa20gKFluG71.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bYsDYL1LJdjB0Eys.png" /></figure><p>How we structure our data is crucial to making our computation efficient. At the scale we operate, improving even a single pipeline can yield huge returns. Doubling down on our core infrastructure and being willing to make big changes gave us the step level improvements we needed to continue to scale.</p><p>Interested in making an impact at Quantcast? Learn more about engineering at Quantcast <a href="https://www.quantcast.com/careers/engineering/">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cff5ec7051c1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quantcast-engineering/saving-millions-by-dumping-java-serialization-cff5ec7051c1">Saving Millions by Dumping Java Serialization</a> was originally published in <a href="https://medium.com/quantcast-engineering">Quantcast Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Letting Go of the Wheel]]></title>
            <link>https://medium.com/quantcast-engineering/letting-go-of-the-wheel-e3aec253d0b3?source=rss----c43aa6b14788---4</link>
            <guid isPermaLink="false">https://medium.com/p/e3aec253d0b3</guid>
            <category><![CDATA[user-adoption]]></category>
            <category><![CDATA[automated-systems]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[Esther Hsu]]></dc:creator>
            <pubDate>Mon, 08 Apr 2019 17:55:07 GMT</pubDate>
            <atom:updated>2019-04-08T17:55:07.845Z</atom:updated>
            <content:encoded><![CDATA[<h4>10 Steps to Trustworthy Automation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PGwvtaLGdUb3pavH67FQTQ.png" /></figure><p>We all look forward to the day we can step into our cars and get to our destinations without touching the steering wheel. While there is no question that automation is the way of the future, there are plenty of obstacles to overcome before getting fully automated vehicles onto the road. A major obstacle is trust: how do you convince users to trust their lives with automation you’ve built?</p><p>Although not quite as perilous as highway driving, Quantcast has high stakes in the billion dollar programmatic advertising industry. Our clients trust us to make decisions on their behalf, with the expectation that their brand will be protected and their budget will be put to effective use. In building automated systems for our clients, we have found that we encounter a set of problems common to our fellow pioneers in this space.</p><h3>The Important of Trust</h3><p>Automation is a control system that tries to reach an optimal or ideal state by making automatic, data-driven decisions. However, conflicting objectives make it difficult to define, let alone reach, an optimal state. Every day, drivers on the road are making a series of complex decisions that involve conflicting objectives without even realizing it. As you step on the gas pedal, the amount of pressure you apply depends on how fast and safely you want to get to your destination. When developing an automated vehicle, optimizing purely for speed would be disastrous for safety and optimizing purely for safety would result in a really annoying travel experience.</p><p>Humans are (often subconsciously) aware of the dangers of these conflicting objectives and consequently are skeptical of automated systems. For example, if you’ve been driving since you were a teenager, it may be hard to trust a machine to understand every subtle technique you’ve picked up over time. Building a system that balances trust and transparency alongside accuracy is difficult; however it is absolutely critical to user adoption, and widespread adoption is the key to making an automated system realize all its intended benefits and maximize its impact.</p><h3><strong>The 10 Steps to Trustworthy Automation</strong></h3><ol><li><strong>Prepare to balance conflicting objectives</strong><br>Frame automation as building a system to solve an optimization problem. Assign each objective a cost function based on what is believed to be its value to the business. Build a system to minimize overall cost. Note, some things are trickier to quantify than others so you should…</li><li><strong>Create heuristics from talking to customers</strong><br>Customers don’t always quantify their needs but are willing to have a conversation about what is important to them. It’s your job to understand and calibrate how each of their objectives weighs against each other. At Quantcast, when a customer tells us that delivering the entire budget of their advertising campaign is their primary objective, we need to dig deeper to understand what that means. If we can’t deliver the budget exactly, is over-delivery or under-delivery more favorable? How much are they willing to spend, and are they okay with seeing drastic day-to-day changes in delivery levels to meet this goal?</li><li><strong>Model costs from available past data</strong><br>You will need to leverage historical data to understand how a given action will impact objectives, especially cost. At Quantcast, many of our campaigns have multiple objectives, and we rely on inferences from historical data to better understand how pulling a given lever will affect various objectives and predict the costs associated with these actions.</li><li><strong>Create and track the right metrics</strong><br>Track metrics for business impact early to understand the intended and actual benefits of the system and find out what went wrong if it deviates. Dashboards of these metrics can provide evidence of why customers should adopt.</li><li><strong>Align incentives</strong><br>Besides a general distrust of the system, a reason that customers may be reluctant to adopt might be that they have different goals. For example, the system may benefit the company as a whole but not the individual customer. Take a step back to understand why that could be- the problem could very likely lie somewhere outside of your system.</li><li><strong>Provide transparency into the system</strong><br>The greatest fear of many of our customers was that the system would get some unexpected input and jump off the rails. Implement alerts for these cases that provide clear instructions on what to fix and an explanation of the behavior that the system will fall back on.</li><li><strong>Phase roll out</strong><br>Release the beta to a small group of trusted, high-performing individuals who take on the responsibility of using the product and providing regular feedback as part of their role. Beta rollouts will help address the biggest issues first and make wider rollout much smoother.</li><li><strong>Communicate through a clear channel</strong><br>Provide a public forum (e-mail aliases, tickets, meetings) where people can go to with questions and feedback. This can help to build a higher level of understanding and nip any misinformation in the bud.</li><li><strong>Require feedback to opt out</strong><br>There are many reasons a customer may want to opt out of a system, but not all of them are valid. Set up a process for opting out that holds them accountable; only legitimate cases should be allowed. This will also help to track and understand current issues with the system.</li><li><strong>Know that you’re not done</strong><br>Allocate resources to development even after roll out so that unexpected issues can immediately be addressed. Customers need to see that problems will be fixed in a timely fashion. Losing steam on a new system could quickly lead to its downfall.</li></ol><h3>Hidden Lessons in Building Automation</h3><p>Our journey to full automation has taught us how to build systems that automate many existing processes, but more importantly, it has helped us to take a step back and understand the ultimate problem we are trying to solve. Misaligned incentives, procedural bottlenecks, and misinformation are all issues that have bubbled up and been addressed during the development and rollout of our systems. On the surface, automation simply replaces a process, but it forces us to look at the bigger picture and solve a higher-level problem.</p><p>If you’re interested in helping us on our journey, we’re always looking for people with an analytical mind, an ability to anticipate customer needs, and solid engineering skills. Check out open opportunities <a href="https://www.quantcast.com/careers/engineering/">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3aec253d0b3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quantcast-engineering/letting-go-of-the-wheel-e3aec253d0b3">Letting Go of the Wheel</a> was originally published in <a href="https://medium.com/quantcast-engineering">Quantcast Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Preventing Salesforce Regression:]]></title>
            <link>https://medium.com/quantcast-engineering/preventing-salesforce-regression-introducing-the-apex-linter-10df9622ce82?source=rss----c43aa6b14788---4</link>
            <guid isPermaLink="false">https://medium.com/p/10df9622ce82</guid>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[apex]]></category>
            <dc:creator><![CDATA[Scott Posey]]></dc:creator>
            <pubDate>Thu, 07 Mar 2019 17:19:14 GMT</pubDate>
            <atom:updated>2019-04-08T17:57:53.410Z</atom:updated>
            <content:encoded><![CDATA[<h3>Preventing Salesforce Regression</h3><h4>Introducing the Apex Linter</h4><p><em>TL;DR: We’re sharing some of our Salesforce learnings in the form of a linter (code checker). The linter flags things that have caused problems for us in Apex, the programming language used in Salesforce. It flags a tricky problem with </em><em>Map and </em><em>Set, the use of futures and </em><em>SeeAllData in unit tests, and the obsolete ‘</em><em>testMethod’ keyword. Because </em><em>Map and </em><em>Set are used a lot, that check can be suppressed on a line-by-line basis by putting a comment with a link on back to a document about it in the GitHub open source project. Now, back to our story…</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DdUuSnz-dRwAgEh7cJN0OA.png" /></figure><p>While investigating a fortunately rare bug that caused some headache for the business and had eluded several developers, my investigation led to code that was using Salesforce’s hash table, simply called Map. As I pored over documentation, one line on <a href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_collections_maps.htm#heading_2_1">this page</a> stopped me dead in my tracks:</p><blockquote><em>Uniqueness of map keys of user-defined types is determined by the equals and hashCode methods, which you provide in your classes. </em><strong><em>Uniqueness of keys of all other non-primitive types, such as </em></strong><strong><em>sObject keys, is determined by comparing the objects’ field values.</em></strong></blockquote><p>As it turns out, sObject hash code computation also uses field values, just like its implementation of equals. Two sObjects of the same type with the same field values that have not been inserted into the database have the same hash code and are equal.</p><p>Recall that hash table and set work on similar principles: the object’s hash code is used to locate a bucket, and then equals is used to match a key to a value within the bucket, since many keys may hash to the same bucket index in the underlying array.</p><p>This means that sObjects that have the same field values and have not been inserted into the database (id == null) look the same to Maps and Sets. Furthermore, changing the field values of an sObject will change its hash code.</p><p>If the sObject happens to be a Map key, its value will almost certainly become inaccessible because the change in hash code will direct the lookup to a different bucket. If it’s a Set member, contains will likely return false fo the same reason.</p><p>Here’s an example that you can run as Anonymous Apex:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/059232abdd0fe39efa1e1914c55eae77/href">https://medium.com/media/059232abdd0fe39efa1e1914c55eae77/href</a></iframe><p>Most programmers are accustomed to Java’s default implementations for hashCode and, more importantly, equals, both of which effectively use memory locations and therefore proxy object identity. Although it’s certainly possible to implement hashCode and equals to use field values, like sObject, it’s not expected.</p><p>The upshot of all this is that one has to be careful about Map keys and Set members that are non-base types. This is true for Java, but it’s especially true for Apex because of the special case of sObjects.</p><p>This led to the first production Apex Linter, which was a simple Bash script that used regular expressions to flag Maps using non-base types as keys. We created a Jenkins project for it and ran it using a GitHub Pull Request Builder. Of course we had to clean up a lot of code, but in most cases we found that the Map wasn’t needed at all, and that a List would could often replace a Set.</p><p>In cases where the Map or Set is used within one method, especially in tests, we wanted an easy way to override the linter’s warning on a line-by-line basis. You can do this by adding a link to the documentation in a comment on the same line:</p><p><a href="https://github.com/quantcast/apexlint/blob/master/MAPS-AND-SETS.md">https://github.com/quantcast/apexlint/blob/master/MAPS-AND-SETS.md</a></p><p>Often, we add “known risk” to the comment because everything is sweetened by risk. Except software development.</p><p>My colleague Simon Law got excited about making it even better, and ported my two scripts into a single Python module to make it easier to add new validators and test them. It even has color syntax highlighting! This is the version we’ve released as an open-source project:</p><p><a href="https://github.com/quantcast/apexlint">https://github.com/quantcast/apexlint</a></p><p>It flags the following cases:</p><h4><strong>Object types as Map keys or </strong><strong>Set members</strong></h4><ul><li>sObject hashes are computed from field values. Changes to field values of keys make Map values inaccessible. For Set, it causes Set.contains() to return false</li><li>Object hashes default to memory locations</li><li>These differences produce subtle bugs, so we recommend against the practice. However, we do allow it with a link to the issue documentation on the same line</li></ul><h4><strong>SeeAllData in tests</strong></h4><ul><li>Creates situations in which test execution can conflict with production data.</li><li>Encourages DML in tests, which slows them down.</li><li>Production systems that lock rows used by tests can cause them to fail, causing deployments to fail randomly. Conversely, tests that lock rows used by production systems can cause production processes to fail.</li><li>SeeAllData=false doesn’t do anything in classes annotated with SeeAllData=true!</li></ul><h4><strong>No </strong><strong>@future in test classes</strong></h4><ul><li>Futures are scheduled in a small finite queue shared across the org. As with SeeAllData<strong>,</strong> the contention can lead to bad behavior. It also makes your tests arbitrarily slow, leading to longer deployment times.</li><li>If “Disable Parallel Test Execution” is off, this queue can get full very quickly.</li><li>We recommend that you use @testSetup instead of @future to avoid “mixed DML” issues, and use Test.startTest() and Test.stopTest() to avoid “Too Many SOQL Queries”</li></ul><h4><strong>A check for the obsolete </strong><strong>testMethod keyword</strong></h4><ul><li>Use the @isTest annotation instead.</li></ul><p>Mercifully, we only found one bug caused by improper keys with Map in our code, and in general we’ve found that most uses of Map weren’t even necessary.</p><p>Although it was a lot of work to remove SeeAllData and @future from our tests, these changes cut our deployment time in half! We went from only being able to schedule only one deployment per day to as many as five!</p><p>We hope you’ll benefit from these suggestions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10df9622ce82" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quantcast-engineering/preventing-salesforce-regression-introducing-the-apex-linter-10df9622ce82">Preventing Salesforce Regression:</a> was originally published in <a href="https://medium.com/quantcast-engineering">Quantcast Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building on Puppeteer]]></title>
            <link>https://medium.com/quantcast-engineering/building-on-puppeteer-finding-a-way-beyond-phantomjs-8587468c23f7?source=rss----c43aa6b14788---4</link>
            <guid isPermaLink="false">https://medium.com/p/8587468c23f7</guid>
            <category><![CDATA[website-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Kevin Smith]]></dc:creator>
            <pubDate>Thu, 18 Jan 2018 19:29:43 GMT</pubDate>
            <atom:updated>2019-03-19T15:48:32.653Z</atom:updated>
            <content:encoded><![CDATA[<h4>Finding a way beyond PhantomJS</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hQAH6AGzwcYPCeMbAHN4kQ.jpeg" /></figure><p><strong>Why we finally need to move on</strong><br> Almost every full-stack or front-end engineer has some sort of experience with PhantomJS. PhantomJS is heavily used for integration tests, website monitoring, data scraping and a lot more. However, the last release of Phantom was back in January 2016 and it was starting to show its age. It could not reliably run sites using ES6 and other modern technologies. And while the few, hard working, contributors were trying hard to keep it up to date, it became too much. On August 2017, the repository was officially declared abandoned.</p><p>Here at Quantcast, we run the world’s largest AI-driven audience insights and measurement platform directly measuring over 100MM web destinations. The backbone of our platform is Quantcast Measure. The first steps to getting started with Measure is to register your site on quantcast.com and put the supplied javascript tag on your web pages. This javascript tag provides us with multidimensional information about the users who visit your site. Because of the importance of this tag, we need to be able to quickly verify that the tag has been properly placed on your site. Our original scanner written in 2006 just grabbed the page HTML and searched it for the tag. This started to fail with the advent of tag managers. About 2 years ago we built a second iteration of the scanner used PhantomJS and now once again we find ourselves in need of a new scanner due to more and more failing scans.</p><p><strong>Tooling options for a site scanner</strong><br> Having a service only last for under two years after a major rewrite is not ideal. Generally a product like this we would want to last 3–4 years before having to revisit it again. One of the main requirements for the next iteration would be the use of a well supported and maintained headless browser. We would also like it to be as lightweight and easy to use as possible. It would also need to be able to monitor all page resources. After a lot of searching around we came up with three options; Electron, Chromeless and Puppeteer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/0*jHebIZfYf_DPusHV.png" /></figure><p><strong>Electron</strong> is built on top of Chromium and NodeJS so we were hoping that they would abstract away most of the nitty gritty Chromium details. It looks to be well maintained and easy to install/use. However we found that it contains a whole lot more functionality than we actually need. There are a few tools people have written on top of it, like NightmareJS, that make the usage a lot simpler, but it doesn’t have resource monitoring we need. At this writing it also lacks a truly headless mode so we would need an additional graphics environment dependency such as xvfb.</p><p><strong>Chromeless</strong> is another popular automated browser tool. It is pretty new and so well maintained. It has a very simple API to that is very similar to that of the “headful” NightmareJS. However it is more geared toward crawling, automated testing, and screenshots. It doesn’t really give us the detailed resource level data we need for this project.</p><p>Finally we found <strong>Puppeteer</strong>. Puppeteer is what the PhantomJS maintainer recommend moving toward. It is also written on top of Chromium utilizing its new “headless” mode. It is maintained by Chrome DevTools team and used internally by Google. This gives us the confidence that it will be around for a long time. Plus its APIs are strikingly similar to that of PhantomJS so we know it will handle what we want. It depends on a rather large Chromium install, but all the configurations are abstracted away. This tool seems to fit our requirements almost perfectly.</p><p><strong>Build/Code</strong> We have a seemingly simple set of requirements. Given a URL, return any Quantcast tags firing on the page. Puppeteer’s APis have a very familiar pattern to normal web browsing. First you launch the browser and then open individual tabs, or pages as Puppeteer calls them. A browser can have multiple pages and each can be reused for multiple requests. Because they are being reused we want to prevent the browser from caching anything so it doesn’t affect future page loads. We have found that these options seem to do the trick.</p><p>Once we have that in place we can simply tell the page to goto the url we want to check. After a few trial scans we began to notice that our tag was not always being caught. We quickly realized that because our tag is asynchronous, so as not to slow down the load time of users’ pages, sometimes the page load event was fired before our tag was finished. Luckily, Puppeteer comes with a way to wait until the network becomes idle or semi-idle. To prevent pages that automatically update (such as Twitter) from never completing, we will use the semi-idle event. So let’s try again<br> page.goto(url, {waitUntil: [&#39;load&#39;, &#39;networkidle2&#39;]});</p><p>This turned out to be much better. Scans are succeeding on a regular basis, but the next thing issue we noticed is that some scans would be a little slow or take a large amount of memory. A quick fix we can implement is to not actually load any images (except our image tag). Puppeteer allows us to do this by intercepting any request before it happens and aborting it.<br> page.setRequestInterception(true); page.on(&#39;request&#39;, request =&gt; { if( request ) { if (request.resourceType === &#39;image&#39; &amp;&amp; request.url.indexOf(&#39;pixel.quantserve.com/pixel&#39;) === -1) { request.abort(); } else { request.continue(); } } });</p><p>The final issue we ran into was sometimes pages just don’t load in time. We are giving pages a full minute to load up, but time is money and we can’t just wait around forever. In that case we need to catch the case where the page throws a timeout and see if any of our tags have fired. If so we can just return them and if not then we should record the fact that the page timed out for further investigation.<br> try { const resp = await page.goto(url, {waitUntil: [&#39;load&#39;, &#39;networkidle2&#39;]}); result = {tags: tags, code: resp.status}; } catch (err) { // tags ended up loading, but page technically did not load successfully if(tags.length &gt; 0){ result = {tags: tags, code: -1}; }else { result = {error: err.message}; } }</p><p>If you would like to see the full scanning script we have posted it as a <a href="https://gist.github.com/SmithKevin/e0e3e3317bdbddae5ca08960e250182f">Github Gist here</a>.</p><p><strong>Outcomes</strong><br> The results of the new site scanner has been better than we had expected. Of the 300 outstanding scans, 25 previously missed tags were found immediately. Those were 25 potential customers that we would have missed and most likely would have resulted in them not getting the best use out of our product. Most scans also succeed in under 2 seconds compared to the 8 seconds from PhantomJS. The downside is that Puppeteer is a lot heavier in terms of CPU and more complicated to set up in the cloud than PhantomJS because of its dependency on Chromium. This was expected and it a small price to pay for a feature complete browser allowing us the most accurate scanning. Since its release we have drastically reduced the number of support emails related to site scanning. Once again our engineers don’t have to waste time on the tedious task of manually checking and adding missed sites. Lets hope Puppeteer continues to be maintained well into the future.</p><p><strong>Where we go from here</strong><br> As you can imagine there is still a lot of room for improvements. For one, we can look into re-using page objects to try to reduce CPU usage and squeeze a few more scans out of the box. Another step is to move the scanner to the serverless model using AWS Lambdas or similar technology. This would allow us to parallelize scans almost indefinitely without having to incur any cost of leaving hardware idle. Regardless of the direction we go, Puppeteer ended up being a great fit for our needs and very easy to use. Because its APIs were so similar to PhantomJS we could quickly replace our existing site scanning script with this one in a matter of days. On top of that it gives us the piece of mind that it will continue to work and be supported for years to come.</p><p><em>Originally published at </em><a href="https://www.quantcast.com/blog/building-on-puppeteer-finding-a-way-beyond-phantomjs/"><em>www.quantcast.com</em></a><em> on January 18, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8587468c23f7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quantcast-engineering/building-on-puppeteer-finding-a-way-beyond-phantomjs-8587468c23f7">Building on Puppeteer</a> was originally published in <a href="https://medium.com/quantcast-engineering">Quantcast Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[6 Reasons You Should Intern at Quantcast]]></title>
            <link>https://medium.com/quantcast-engineering/6-reasons-you-should-intern-at-quantcast-407db962c8bf?source=rss----c43aa6b14788---4</link>
            <guid isPermaLink="false">https://medium.com/p/407db962c8bf</guid>
            <category><![CDATA[internships]]></category>
            <dc:creator><![CDATA[Richard Leung]]></dc:creator>
            <pubDate>Tue, 17 Oct 2017 21:50:45 GMT</pubDate>
            <atom:updated>2019-03-19T14:56:09.309Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LmhdP0NMErIBAt6sn7-fIw.png" /></figure><p>The Quantcast Summer Internship Program is a great way to learn about the real-world applications of subjects you study in school, like map-reduce and machine learning. Our interns, spread across Quantcast’s four engineering offices in Singapore, Seattle, London, and San Francisco, spend their summers working alongside industry veterans to help make advertising better for advertisers, publishers, and consumers. Directly from our most recent group of summer interns, here are 6 reasons you should intern at Quantcast too!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C7Wq0LhMDSL6vzM3.jpg" /></figure><blockquote><strong><em>REASON 1</em></strong><em>: I was really impressed by the transparency and support from all the employees at Quantcast. People don’t mind taking 5 minutes out of their day to give you advice or help you overcome an issue.</em></blockquote><p>At Quantcast, we structure our internship program in a way that empowers and enables our interns to grow as engineers. From your first day to your last, everyone at Quantcast is here to help you with your project and find your niche within the company.</p><blockquote><strong><em>REASON 2</em></strong><em>: I was fortunate to participate in the Publisher Customer Hackathon during the first few weeks of my internship. For this event, Quantcast invited fourteen publishers (ranging from The Wall Street Journal to Buzzfeed) to present problems for our team to solve in 24 hours. I learned so much from working with customer specialists, product managers, and engineers and in the end, created a novel product solution.</em></blockquote><p>As an intern with Quantcast, you’re part of the team! Just like our engineers, you have the opportunity to work with people from various sectors of our business, including: the commercial side, product managers, and even our clients.This means you get the full and complete experience of what it’s like to work on and develop products for the market.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F224985288&amp;dntp=1&amp;url=https%3A%2F%2Fvimeo.com%2F224985288&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F644185005_1280.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1080" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c262a772b30b92ba1fbd52f1f215170/href">https://medium.com/media/2c262a772b30b92ba1fbd52f1f215170/href</a></iframe><blockquote><strong><em>REASON 3</em></strong><em>: The Intern Hackathon perhaps was the best event. Within a day long event, all interns were able to come together and solve real company problems, collaborate with mentors and brainstorm in a highly engaging manner.</em></blockquote><p>We love hackathons at Quantcast! From our client hackathons to our yearly company-wide hackathon, known as Quantathon, we promote innovation across the company. The same is true for our interns, who had their own hackathon this summer! Some of the projects from that hackathon are in production today, including an internal survey tool used to keep a pulse on employee engagement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tIX3sU72N9TAoKKl.jpg" /></figure><blockquote><strong><em>REASON 4</em></strong><em>: My manager was a helpful resource in introducing me to Quantcast’s products as well as getting me up to speed as a new engineer. We had honest and valuable one on one meetings every week.</em></blockquote><p>Interns are an incredible asset for Quantcast, so we take our jobs of aiding their development seriously. Our intern managers are responsible for guiding their interns through Quantcast and helping them find an attainable project. Many of the projects our interns work on eventually become products or features.</p><blockquote><strong><em>REASON 5</em></strong><em>: My team was super friendly and welcoming. We had lunch together every Wednesday and it was fun to talk about random things. We had a good balance of new grads, junior, and senior engineers who all offered different perspectives.</em></blockquote><p>When you intern at Quantcast, you don’t work in a silo, but with a team of engineers working on a product or service. These teammates are not just a resource to help you with your work, but are also fun to hang out with when the work is done. Our teams love having summer interns that bring fresh ideas and new perspectives!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-6lpgKYTEa3ddT5x.jpg" /></figure><blockquote><strong><em>REASON 6</em></strong><em>: My mentor was a tremendous help for me in the transition from school to industry. He was always happy to answer my questions. Mentorship is harder to come by at school, so I definitely appreciated getting personal feedback every step of the way.</em></blockquote><p>Rounding out our support system for interns, each and every intern is assigned a Quantcast mentor. The mentors act as advisors for their projects and as soundboards for general industry questions and career advice. Interns are constantly receiving feedback from their mentor, managers, and teams so they end the summer with a clear view of their work and an improved knowledge of software development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hdHxt37vYzMXI4w9.jpg" /></figure><p>Our Quantcast interns leave as better engineers and are more prepared for their future in technology! Some join our New Grad Program and kick-off their full-time careers with us, but all leave enjoying their time spent here.</p><p>Learn more about our summer internship opportunities around the world <a href="https://www.quantcast.com/careers/openings/#department%3D__team%3D__location%3D__commitment%3DIntern">here</a>.</p><p><em>Originally published at </em><a href="https://www.quantcast.com/blog/6-reasons-you-should-intern-at-quantcast/"><em>www.quantcast.com</em></a><em> on October 17, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=407db962c8bf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quantcast-engineering/6-reasons-you-should-intern-at-quantcast-407db962c8bf">6 Reasons You Should Intern at Quantcast</a> was originally published in <a href="https://medium.com/quantcast-engineering">Quantcast Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing Self-Serve Analytics]]></title>
            <link>https://medium.com/quantcast-engineering/implementing-self-serve-analytics-43fafd9e6f20?source=rss----c43aa6b14788---4</link>
            <guid isPermaLink="false">https://medium.com/p/43fafd9e6f20</guid>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[data-warehouse]]></category>
            <category><![CDATA[business-analytics]]></category>
            <dc:creator><![CDATA[Sathya V]]></dc:creator>
            <pubDate>Wed, 13 Sep 2017 18:09:29 GMT</pubDate>
            <atom:updated>2019-03-19T15:10:37.077Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Zp-4cM8HHTrHPYZFGJQ3Q.png" /></figure><p>Speed and agility in data analysis can be a big competitive advantage in business. We at Quantcast are always hungry for up-to-date information about key business metrics. So hungry, in fact, that we decided to take an aggressive step and empower our internal business users to work with their data faster and more efficiently via a custom self-serve analytics platform. This post covers how we pulled that off.</p><p>In thinking about our desired self-serve analytics platform, we came up with the following requirements:</p><ul><li>Remove dependency on engineering teams to enable custom data sets</li><li>Keep the solution code-free</li><li>Enable a Single Source of Truth for our key business metrics</li><li>Help users upload and act on data within minutes (rather than days)</li><li>Facilitate uploading of the data by means with which the users were already familiar (e.g., CSV/Excel)</li><li>No learning curve in terms of understanding syntax to create a table, alter a table, etc.</li></ul><p>Our analysis found most existing solutions to be either an overkill or overly complicated for non-engineering users, and more expensive than what our needs would dictate, so we decided to roll out our own.</p><h3>Examining Trade-offs</h3><p>In accordance with our requirements, we needed to keep our user interface relatively simple. We initially considered building our own UI, but after examination, we realized that the existing AWS console tools had a sufficiently gentle learning curve.</p><p>We also decided to restrict the size of data our users could upload on their own using this solution, primarily to protect our infrastructure.</p><h3>Our Solution</h3><p>The solution that we implemented was fairly simple:</p><ul><li>Require that data is in CSV files that fit three requirements:</li></ul><ol><li>File name should be of the format &lt;username&gt;_&lt;business_unit&gt;_&lt;dataset_name&gt;.csv</li><li>File should contain a header row (We used this to name the columns in the table)</li><li>File size should not exceed a set maximum number of GB selected in view of available computing resources and storage</li></ol><ul><li>Users upload the CSV file to a predetermined S3 location</li><li>A back-end process periodically grabs these files; determines the table structure, column names, and data types; and creates the table on a specific schema in our Data Warehouse (RedShift)</li><li>A notification is sent to the user that this data is now available for querying</li></ul><p>We implemented this using a combination of scripts and Pentaho PDI community edition. Scripts were primarily used as a wrapper for the PDI transformation.</p><p>The &lt;business_unit&gt;_&lt;dataset_name&gt; is used as the name of the table that we created. is used for sending out notifications when the upload succeeds or fails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*_CNLiqVTRyeGsXOn.jpg" /></figure><p>On the back end, the orchestration works as follows:</p><ul><li>Poll the S3 location for newly uploaded files</li><li>On detection of a new file, pull the file down to an EC2 instance</li><li>Validate that the structure meets the contract defined above</li><li>Sample the data set to identify data types such as varchar, boolean, int, etc.</li><li>Generate table definition SQL file</li><li>Connect to Data Warehouse, create the table, load rows using copy command</li><li>Email notify the user that uploaded the file on success or failure during any of the above</li></ul><h3>Experimentation vs. Production-Ready Data</h3><p>Though the primary use case for Bring Your Own Data (BYOD) was quick experimentation, our users also wanted a way to productionalize data that they deemed as ready for enterprise metrics. To do this, we implemented two flows:</p><ul><li><strong>Prototype flow</strong> — Default mechanism: allows users to change the structure of the tables created by adding or removing columns to the CSV file</li><li><strong>Production flow</strong> — Graduation flow: fine-tune the data structure to add distribution and sort keys, as well as standardize the structure of the table</li></ul><h3>Production Performance</h3><p>As part of our initial launch, we had less than 500 set uploads per month. Due to the ease of use and the amount of time this feature saved our users, we are currently at about 2500 uploads per month. In one of our recent DW user satisfaction surveys, BYOD was rated as one of the best features. Our analysts are now able to roll out/change metrics 3 to 4 times faster, and we now have some of our critical sales pipeline metrics populated through this pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*HqehlEsYCDvHfEip.jpg" /></figure><h3>Next Steps</h3><p>In the near future, we’ll provide a web app through which users can preview and upload files interactively, as well as schedule imports, provide webhooks to set up data pulls directly from APIs, and leverage Spectrum query service to allow querying large data sets directly from S3.</p><p>Sound fun? <a href="https://www.quantcast.com/careers/openings/#department%3DEngineering%20%26%20Modeling__team%3D__location%3D__commitment%3D">Join our team</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43fafd9e6f20" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quantcast-engineering/implementing-self-serve-analytics-43fafd9e6f20">Implementing Self-Serve Analytics</a> was originally published in <a href="https://medium.com/quantcast-engineering">Quantcast Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unblocking the Front End]]></title>
            <link>https://medium.com/quantcast-engineering/unblocking-the-front-end-using-design-systems-for-fast-and-easy-ui-development-fe6fc512965f?source=rss----c43aa6b14788---4</link>
            <guid isPermaLink="false">https://medium.com/p/fe6fc512965f</guid>
            <category><![CDATA[startup-lessons]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[bootstrap]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Nilkanth Patel]]></dc:creator>
            <pubDate>Wed, 19 Jul 2017 18:11:57 GMT</pubDate>
            <atom:updated>2019-03-19T15:15:57.947Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using Design Systems for Fast and Easy UI Development</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xzuGWErqAhXkzkVqmHcPuQ.png" /></figure><p>Solid user experiences are core to the product strategy of most customer/consumer facing digital companies, but asking design teams to be solely responsible for executing these experiences can create a potential bottleneck for innovation — especially if these teams are under-resourced.</p><h3>The Evolution of Design Systems</h3><p>Design systems help alleviate these bottlenecks by codifying the intersection between technology and design to serve as the manual for infusing a customer-centric, design-driven culture into the product development process.</p><p>For years, UX teams have endeavored to build and maintain custom styleguides for their products. What began as Photoshop files and large hex value tables has evolved into Sketch files that move between tools like InVision and Zepelin. But the newest challenge in building and maintaining these systems surrounds maintaining visual and technical consistency of these elements when multiple teams are working on multiple front-ends simultaneously.</p><p>The task of scaling front-ends to be both easy to build and highly performant is a fairly nascent field in software engineering. Front-ends are consistently being asked to do more — they are asked to apply business logic, to manage state and to animate seamlessly as the user interacts with them. Companies requiring a multitude of front-ends need to invest in scalable tools that modularize reusable design and business logic to make building them easier.</p><p>Twitter noticed this when the number of tools they were building were multiplying rapidly, with development resources failing to keep up. Designers were frustrated by the lack of cohesion between their interfaces. And from that chaos (<a href="https://blog.twitter.com/developer/en_us/a/2011/bootstrap-twitter.html">and a well-timed “hackweek”</a>) emerged Bootstrap. Mark Thornton, Jacob Otto, and their team of designers and developers stumbled upon a model that would define the next phase of modern web application design. Facebook, Salesforce, and Airbnb have invested in similar approaches, either centralizing their design system to a single team or investing into building reusable UI components across the organization.</p><h3>Scaling Design</h3><p>These approaches unblock product teams by reducing their reliance on dedicated product designers. Instead of architecting one-off solutions, why not build a service that lets you reuse modular microservices for a number of apps?</p><p>Design systems generate scalability by democratizing front-end development, and to some degree, design itself. Full-stack engineers no longer need to understand the intricacies of DOMs (let alone virtual DOMs) to be efficient front-end developers. It frees them from cumbersome red lines littered across design mockups, leaving more time to focus on fetching data quickly and accurately.</p><p>For our designers, it gives them the ability to quickly migrate from wireframing to high-fidelity, clickable prototypes — they spend less time crafting the perfect border radius, and more time building holistic experiences that differentiate our products.<strong> </strong>A common UI library allows our team of four designers to efficiently service nearly a dozen engineering teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wYZdDKFOvJWrRjuO.jpg" /><figcaption>Screenshot of Callahan, Quantcast’s Design System</figcaption></figure><h3>Challenges of Working with Design Systems</h3><p>It’s natural for designers to shudder at the idea of sacrificing their creative freedom in favor of a “one-size-fits-all” style guide. Designers love re-inventing the wheel: it’s in our DNA. And when it comes to products, visual design is always ripe for critique and evolution.</p><p>Design systems make that sort of “pie-in-the-sky” exploratory visual design difficult to execute (but certainly not impossible). Instead, we work hard to find ways to infuse creativity into our design process by taking a more structured approach to ideation.</p><p>When we’re designing a new product, we always stress-test the existing components we’re planning to use. We’ll ask ourselves, “If we had no component library in place, how would we want <em>this</em> thing<em> </em>to look?” In doing so, we’re able to challenge existing principles and debate previously established guidelines for stylistic elements like drop shadows, borders, fills, and so on. That constant, component-centered exploration allows us to evolve our system incrementally.</p><h3>Quantcast’s Design System</h3><p>Historically, Quantcast’s front-end capabilities have, ironically, been mired by our deeply-rooted backend proficiency. Superior modeling and data-processing capabilities serve as a key differentiator in our market. But in order to expose those superpowers, we need UIs that highlight the power and accuracy of our modeling. And we need to design and build those UIs with limited bandwidth on our teams.</p><p>It burns a designer’s soul to see the same button implemented into two different places with two different classes. The design team at Quantcast had enough soul-burning. We endeavored to build a CSS styleguide that would hammer out CSS bloat once and for all. We started with a simple stylesheet that let developers apply classes to their markup to create visually consistent buttons, flexible grid structures, and other common components.</p><p>This helped maintain consistency, but the approach fell apart when our CSS structure was too closely tied to its implementations in various products. Deeply nested selectors can do this to you. You’re forced to stick to a precise class hierarchy to get the styles you want, necessitating strict markup guidelines. And humans (read: engineers) have trouble following strict guidelines. We had simple hyphen-case versus camel-case miscues ruining entire design layouts.</p><p>We knew we had to revise our approach. We could have fixed this problem by simply migrating to a more scalable CSS organizational scheme, like BEM, but we decided to take it a step further: let’s just abstract our styleguide into reusable Javascript components built on top of the world’s most popular front-end frameworks.</p><p>We began this process by building a bunch of Angular directives, which our engineering teams preferred. We soon realized that literally every new front-end engineer we hired preferred React, and so we began to build a React component library in parallel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1WfaHx2lf7uVvUkb.jpg" /><figcaption>Some of the components in Callahan</figcaption></figure><p>Today, we have three repos maintained by a front-end team that sits within product design: first, a styles codebase that houses all the CSS for our components, written according to BEM specifications. Second, a library of Angular components that can take in data and spit out fully functional, interactive UI elements. And third, a library of React components which, much like their Angular counterparts, can take in props that translate into UI elements. Our React codebase is still very much in its infancy, but the lessons learned from developing our Angular components, and feedback from engineering teams using those components, has made our fledgling React library the most useful yet.</p><h3>Feedback and Response</h3><p>The response was tremendous — it had a huge impact on the velocity of teams that were having trouble knowing where to begin when it came to building their front-ends. We leveraged that momentum to begin productizing these frameworks by establishing a group of engineers within the Product Design team dedicated solely to building and evolving our CSS and Javascript frameworks. The team doubles as a consultancy by helping engineering teams without front-end resources get started on their apps. We bootstrap them with our tools, set up their directories, implement a build pipeline, and create a front-end deployment process that meets their needs while being closely aligned to the rest of the applications at the company.</p><h3>The Future of Our Design System</h3><p>Design systems — and, more broadly, design languages — have existed since the dawn of user interfaces. What sets our initiatives apart is the way we’re trying to marry design and development to produce a framework that is not only fully functional, but also allows our engineering teams to learn front-end development as they build our products. We want this framework to serve as a growth tool for our engineers to learn front-end development, and add that to their already impressive repertoire of back-end capabilities. That’s why we’re encouraging the use of TypeScript, so that Java veterans can more easily understand the nuances of a dynamically typed language like Javascript. And why we leverage our front-end team as consultants for the company at large. These initiatives remind engineering teams that they shouldn’t feel isolated when it comes to front-end development — there are resources available at the company to help.</p><p>Building a passion for beautiful and performant front-ends is undeniably a challenge for any company. Investing in the right infrastructure is key to communicating to the company at large that we care about crafting a superior user experience, grounded in solid front-ends and well-tested design principles.</p><p>If you’d like to learn more, or join us on our mission to reinvent front-end engineering at Quantcast, check out our <a href="https://www.quantcast.com/careers/openings/">job board</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe6fc512965f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/quantcast-engineering/unblocking-the-front-end-using-design-systems-for-fast-and-easy-ui-development-fe6fc512965f">Unblocking the Front End</a> was originally published in <a href="https://medium.com/quantcast-engineering">Quantcast Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>