<?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[Playamp-engineering - Medium]]></title>
        <description><![CDATA[Playamp’s Engineering blog: from full-stack design and development to cloud-based Big Data, machine learning and business applicative platforms in gaming - Medium]]></description>
        <link>https://medium.com/playamp?source=rss----c0d232df0cfa---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Playamp-engineering - Medium</title>
            <link>https://medium.com/playamp?source=rss----c0d232df0cfa---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 13:28:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/playamp" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Transitioning to Next.js T3 Stack with V0]]></title>
            <link>https://medium.com/playamp/transitioning-to-next-js-t3-stack-with-v0-24f710c03849?source=rss----c0d232df0cfa---4</link>
            <guid isPermaLink="false">https://medium.com/p/24f710c03849</guid>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[v0]]></category>
            <category><![CDATA[trpc]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Shaked Tayeb]]></dc:creator>
            <pubDate>Mon, 24 Feb 2025 13:48:59 GMT</pubDate>
            <atom:updated>2025-02-26T09:50:59.305Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>How We Slashed Frontend Development Time by 40%</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g59igKMGIzcmgswOQFgstQ.png" /></figure><p>At our department, the evolution of our frontend development process over the years has been nothing short of transformative. We began with Angular, migrated to React, and finally discovered the power of Next.js with the T3 stack — a combination of Next.js, React, TypeScript, and tRPC. Paired with backend systems in Go and Python on Google Cloud, this shift not only modernized our workflow but also paved the way for an unexpected ally: V0 by Vercel, an AI-assisted tool that accelerated our journey. Here’s how our small team of mostly backend experts and data scientists managed to cut design-to-development time by 40%.</p><h3>The Challenge: Juggling Expertise and Escalating Demands</h3><p>We learned that innovation in frontend development was less about having a large, specialized team and more about smart choices under pressure. Our team consisted primarily of data and backend engineers — with only one frontend specialist and two developers new to UI work. Design expertise was scarce, and we often had to rely on external contractors for even the smallest UI adjustments. Meanwhile, our products had user bases ranging from high-profile stakeholders to thousands of active users, demanding rapid feature updates and impeccable quality.</p><p>Adding to the complexity, our backend was built with Go and Python on Google Cloud. Any new frontend stack had to seamlessly integrate with these existing systems without throwing a wrench into our operations.</p><h3>The Turning Point: Embracing the Next.js T3 Stack</h3><p>Back in 2023, when we began searching for a more modern approach to our React projects, the need for server‑side rendering, caching, and even static rendering for some pages became clear. Our research led us to Next.js — and eventually to the T3 stack. What made it a perfect fit?</p><ul><li><strong>Rapid Development:</strong> Next.js and React provided a modern foundation that allowed us to build production-ready interfaces quickly.</li><li><strong>Type Safety:</strong> TypeScript helped us reduce runtime errors and simplified refactoring — a lifesaver for our team with limited frontend experience.</li><li><strong>tRPC Integration:</strong> With tRPC, communication between the frontend and our Go/Python backends became more straightforward and type-safe, cutting down on boilerplate code.</li><li><strong>Ease of Onboarding:</strong> By establishing clear coding standards (using tools like ESLint, Prettier, and pre-commit hooks) during an expert-led setup, even newcomers quickly found their footing.</li></ul><p>This stack gave us the confidence to tackle complex integrations while ensuring our frontend could evolve without friction.</p><h3>A New Ally Emerges: V0 by Vercel</h3><p>Just as we were mastering the T3 stack, V0 by Vercel entered the scene — revolutionizing our development workflow. V0’s AI-assisted design and development features meant that even developers without a strong frontend background could contribute meaningfully. Here are a few highlights of what V0 brought to the table:</p><ul><li><strong>Accelerated Development Cycles:</strong> A backend engineer with no prior frontend experience built a fully integrated UI (complete with forms, tables, and validations) in just four weeks.</li><li><strong>Streamlined UI/UX:</strong> Product managers could draft initial mockups directly in V0, reducing our dependency on external designers for simple &amp; effective UI work.</li><li><strong>Consistent Code Quality:</strong> With built-in suggestions and best practices, even junior developers maintained clean, consistent code — a crucial factor for a small team.</li><li><strong>Rapid Onboarding:</strong> New team members went from zero to contributing to production in a matter of days.</li></ul><p>In one striking instance, a project that traditionally would have taken three months was completed in only six weeks — all thanks to the AI-powered guidance from V0.</p><h3>How We Made It Work</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/0*8Cy436_PU2UAxXKn" /></figure><p>Our journey wasn’t a simple “flip a switch” moment. It took careful planning and collaboration:</p><ol><li><strong>Expert-Led Initial Setup:<br></strong> We started with a dedicated frontend/Next.js expert who configured the project with best practices in mind. Standardizing our coding style from the get-go was key to ensuring consistency as the rest of the team came on board.</li><li><strong>Team Onboarding &amp; Standardization:<br></strong> With the foundational work in place, the entire team was brought into the fold, adhering to strict coding rules and taking advantage of modern tooling. This not only smoothed out the learning curve but also fostered a culture of quality and rapid iteration.</li><li><strong>Seamless Integration with Backends:<br></strong> Thanks to tRPC’s minimal boilerplate and type safety, integrating with our existing Go and Python services on Google Cloud was far less daunting than expected.</li><li><strong>Automated Quality Assurance:<br></strong> We implemented Cypress as a standalone project for end-to-end testing. This allowed us to reuse existing test cases and catch integration issues early — keeping our development velocity high without sacrificing quality.</li></ol><h3>The Road Ahead: Embracing Future Challenges</h3><p>While our new stack and V0 have dramatically boosted our productivity, we’re not resting on our laurels. There remain challenges on the horizon:</p><ul><li><strong>Custom Logic &amp; Complex Integrations:<br></strong> V0 shines at speeding up basic UI/UX tasks, but advanced business logic and deep API integrations still require traditional development approaches.</li><li><strong>Advanced-Data Visualization:<br></strong> Although V0’s component library is based on shadcn/ui and is continuously improving, we’re eager for more advanced charting and visualization options in future updates.</li><li><strong>Continuous Updates:<br></strong> We’re keeping a close eye on upcoming enhancements — from future Next.js releases to new features in V0 — that will further streamline our workflow.</li></ul><h3>Conclusion: A New Era in Frontend Development</h3><p>Our journey — from Angular to React and finally to the Next.js T3 stack enhanced by V0 — has been a transformative leap. By embracing modern tooling and AI-driven assistance, we have:</p><ul><li><strong>Boosted Production Capabilities:</strong> Faster feature turnarounds and a more maintainable codebase.</li><li><strong>Cut UI/UX Development Time by 40%:</strong> Letting developers focus on business logic rather than mundane styling tasks.</li><li><strong>Enhanced Code Quality:</strong> Leveraging TypeScript, Zod, and tRPC to reduce errors and simplify refactoring.</li><li><strong>Accelerated Onboarding:</strong> Enabling new hires to become productive in days rather than weeks.</li></ul><p>For teams facing similar challenges — especially those with a predominantly backend or data-focused workforce — the combination of the Next.js T3 stack and AI-powered tools like V0 is a game-changer. Our experience shows that even with limited frontend expertise, it’s possible to deliver high-quality, user-focused applications faster than ever before.</p><blockquote>We’re excited about what the future holds and look forward to continuing our journey of innovation, one commit at a time.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24f710c03849" width="1" height="1" alt=""><hr><p><a href="https://medium.com/playamp/transitioning-to-next-js-t3-stack-with-v0-24f710c03849">Transitioning to Next.js T3 Stack with V0</a> was originally published in <a href="https://medium.com/playamp">Playamp-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Data Transformation from Firebase]]></title>
            <link>https://medium.com/playamp/automating-data-transformation-from-firebase-ae7cc4d49c8b?source=rss----c0d232df0cfa---4</link>
            <guid isPermaLink="false">https://medium.com/p/ae7cc4d49c8b</guid>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[firebase]]></category>
            <dc:creator><![CDATA[Yinon Eitan]]></dc:creator>
            <pubDate>Mon, 29 Jul 2024 13:07:22 GMT</pubDate>
            <atom:updated>2024-07-29T15:14:26.380Z</atom:updated>
            <content:encoded><![CDATA[<h4>-How we saved 90% of the effort invested in data integration-</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vqGkqGs8l7SMdlE2wEUYtg.png" /></figure><p>Plarium is a leading gaming company that creates some of the best mobile games in the industry with multiple studios worldwide.</p><p>The data engineering department develops the company’s centralized data platform, which provides data solutions and services.</p><p>Our high-scale, cloud-based platform has a complex data model that stores and organizes data from all the games, marketing systems, and external sources.</p><p><strong>The Challenge</strong></p><p>One of our challenges is consolidating data from a diverse range of games into the centralized data platform. Achieving this consolidation requires each studio to integrate its data with the platform to adhere to a unified data model, facilitating the creation of generic data services and enabling cross-game analysis. We strive to make this integration as smooth as possible and reduce the time spent on the task.</p><p><strong>The Solution</strong></p><p>Plarium’s games leverage Firebase as an app development platform and export native and custom events to <a href="https://support.google.com/analytics/answer/9358801?hl=en&amp;ref_topic=9359001&amp;sjid=3145432328665020044-EU">BigQuery</a> (BQ). A few of our studios already maintain a small internal database based on this export.</p><p>Leveraging Firebase’s permanent schema in BQ, we created a tool to automate the <strong>transformation of Firebase data into the company’s database conventions, using an SQL query (DDL) created based on source-to-target mapping</strong>. By doing that, we are able to point out the data and eliminate the need for studios to perform redundant data integration tasks.</p><p>Before jumping in to see what’s under the hood, let’s briefly overview the pros and cons of implementing such a tool:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/0*ZMn1rKt4IMi5pOqD" /></figure><p>The pros here are clear — no need to develop the same data integration twice, create one source of truth, the ability to partition the data differently than the default (day) Firebase export allows, and even flatten the data and not use Firebase array fields.</p><p>Another significant advantage is the fact we move the workload internally to our data platform and <strong>free up valuable time for the studio developer</strong>. Internally, the data owner (usually the data product manager) can integrate the data by themself.</p><p>The main drawback here is the one-day latency we experience since we are avoiding using the intraday table. But more on this later.</p><p><strong>Technical Implementation</strong></p><p>The process has several steps</p><ul><li>Based on the source-to-target mapping, the <strong>process created a BigQuery view</strong> that has the columns’ transformation and enrichments. It could be one-to-one column mapping (e.g. geo.country to db.country_id) or taking specific keys from a complex (to flat the complex data type).</li><li>Read the last 3 days (due to late data) from the events_YYYYMMDD tables, transform the data, and store it in a staging table.</li><li>Deduplicating using a given key.</li><li>Loading transformed data into a Kafka topic for continuous processing within the platform.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6sp5cj-y4m4asS21" /></figure><p>This process, written in GO, is deployed on Cloud Run and scheduled using Cloud Scheduler. Monitoring is a key part, constantly comparing the count of events, distinct users, and duplications.</p><p>The next phase will focus on supporting real-time events integration using the Firebase intraday table. However, in the past, we encountered the same issue described here on <a href="https://www.reddit.com/r/bigquery/comments/rxauzg/question_about_events_intraday_table_and/">Reddit</a>.</p><p><strong>Conclusion</strong></p><p>In an era defined by data-driven decision-making, a modern time of doing “more with less”, the ability to seamlessly integrate systems is paramount. This transformative tool bridges the gap between Firebase and internal data systems, revolutionizing data handling and reducing the burden on developers.</p><blockquote><strong>Disclaimer:</strong> This article is provided by the data engineers department for informational purposes only. The article doesn’t refer to private data. Data privacy regulations must be met on both ends. The views and processes described reflect the authors’ experiences and are not exhaustive. The company makes no warranties about the accuracy or completeness of the information. Readers are responsible for ensuring their activities comply with applicable data privacy laws and other relevant regulations. The company assumes no liability for any errors, omissions, or actions taken based on this information.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae7cc4d49c8b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/playamp/automating-data-transformation-from-firebase-ae7cc4d49c8b">Automating Data Transformation from Firebase</a> was originally published in <a href="https://medium.com/playamp">Playamp-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[4 Misconceptions About a DLP Solution]]></title>
            <link>https://medium.com/playamp/4-misconceptions-about-a-dlp-solution-56adeda22b2e?source=rss----c0d232df0cfa---4</link>
            <guid isPermaLink="false">https://medium.com/p/56adeda22b2e</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[dlp-policy]]></category>
            <category><![CDATA[dlp]]></category>
            <category><![CDATA[dlp-strategy]]></category>
            <category><![CDATA[dlp-solution]]></category>
            <dc:creator><![CDATA[Oren Zenescu]]></dc:creator>
            <pubDate>Wed, 10 Apr 2024 12:54:21 GMT</pubDate>
            <atom:updated>2024-04-17T10:13:22.641Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OI7NrePZA7r5dGHrIN0JBg.jpeg" /></figure><p>DLP is vital in protecting sensitive data from leaks and unauthorized access. However, misunderstandings about its capabilities and implementation can undermine its effectiveness. In this discussion, we will clarify these misconceptions, focusing on the scope of DLP’s detection and protection, the balance between technology and methodology, the role of endpoint agents, and the challenge of internal threats.</p><p><strong>1.DLP brings complete and comprehensive detection and protection against (sensitive) data leakage</strong> — Many CISOs explain to their senior management what DLP is, but don’t clarify what DLP isn’t. For a DLP solution to monitor, detect, and block <strong>ANY </strong>data leak attempt (whether by mistake or by malicious actor) it should have additional capabilities like IPS, DB Firewall, WAF, Configuration hardening, etc. Consider the following use case: You use a file transfer solution in your company (e.g. an SFTP-based app) to share files with external entities over the Internet. Once you expose your server and app to the internet, it immediately becomes a target for threat actors and bot scanners trying to find and exploit a vulnerability in the overlaying system infrastructure. If they find it, rest assured that they will use it and extract all sensitive data stored on it. The next step will be to threaten to expose it in the wild and extort your company to pay the ransom. Now — you are asking yourself what it has to do with a DLP solution. Well, if the CISO of the company “forgot” to mention that the top-notch DLP solution will not prevent such kinds of attacks, then the CEO will probably not like the fact that someone “bypassed” the Data Leak Prevention system and managed to steal sensitive data out of the company infrastructure.</p><p><strong>Tip #1 — Define a clear scope and expectations from your DLP solution. Basing your DLP plan on risk management and focusing on the core DLP capabilities will help non-technology stakeholders understand what risks your DLP system is going to mitigate (And what is not going to be covered under the DLP solution).</strong></p><p><strong>2. DLP is a pure technological solution</strong>. I’m sorry to burst your bubble. DLP is based on methodology and only then on technology. I might even say that it is a 50–50 split. Let’s assume that the CISO of a company clearly defined his problem and figured out that the best solution would be to implement a DLP system. Great — now what? He needs to define a data classification policy, identify where sensitive data is stored (e.g., Shared drives, SaaS, Workstations, File servers, DBs…), and map/tag all data types according to the classification policy. Now, can he implement the DLP system? Not even close! He first needs to understand the main business processes that involve data sharing (internally and externally), Discover any regulatory and legal requirements, assess the risks of the relevant threats to the sensitive data, and agree upon needed use cases and controls to mitigate them. You can move on to the DLP product implementation only now that you have worked on a solid DLP methodology.</p><p><strong>Tip #2: Before choosing and implementing your DLP solution, define your methodology: What are the most important data assets you want to protect? Who is using it and how? Map the business stakeholders who can decide if a DLP alert is a false positive or a real incident, and regularly validate your DLP policies and rules.</strong></p><p><strong>3. DLP solution is all about agent deployment on employee’s endpoints. </strong>As written above, to have a successful DLP plan, you must first understand where the sensitive data resides, who uses it legitimately, and how it should be shared with external parties. As you can probably imagine, data usage and sharing are not only done from the company’s employees’ workstations. Think about the next use case: your company is using Google Workspace and, of course, Gmail. Do you allow them to send emails from their mobile phones? Great, the DLP agent is useless in this case. Also — what happens when one of your employees wants to authenticate to Gmail from his private computer at home? Now multiply it with all of the company’s SaaS that could hold sensitive data/files (Gdrive, Google apps, Dropbox, Box, Salesforce, etc) and you have a DLP nightmare! When thinking about DLP, consider all “edge” use cases and work on a solution that will bring answers and value (and not more questions and Headache…).</p><p><strong>Tip #3: Map the technology stack you will connect to your DLP system: SaaS-based systems, Internal file servers, Local workstation activities, Mail transfer analysis, DM apps, etc. Then, make sure that the chosen DLP solution can answer your needs.</strong></p><p><strong>4. DLP is enough to stop “internal threats”</strong> — There is a general misconception about this one. From my experience working with several DLP vendors, there is no guaranteed way to stop internal employees with malicious intentions from exfiltrating sensitive data from the company network. All measures deployed by the DLP system can be bypassed by a skilled employee if he has the right motivation (You better hope he didn’t watch the Mr Robot TV show…). DLP addon for browsers? Anonymous browsing. DLP agent on the workstation? Ask Generative Chat AI how to disable it. DLP inspection for outbound emails? Zip the file with WinRAR and add a password, or use the Microsoft Word/Excel password option. And, in case you truly managed to prevent all those easy ways to bypass the DLP system, there is always the good old camera on every mobile phone on planet Earth.</p><p><strong>Tip #4: Be realistic. Your DLP tool will probably not stop advanced internal threats aiming to exfiltrate sensitive data. Try to map such use cases and design adequate compensating controls to deal with them.</strong></p><p>In conclusion — a DLP solution is essential for protecting sensitive data across the company. When starting your DLP journey make sure you are scoping and defining clear expectations, defining the right DLP methodology for your company, mapping essential technologies that will be integrated into your solution, and make sure to clarify to your senior management about residual risks and additional controls needed to mitigate them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56adeda22b2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/playamp/4-misconceptions-about-a-dlp-solution-56adeda22b2e">4 Misconceptions About a DLP Solution</a> was originally published in <a href="https://medium.com/playamp">Playamp-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enriching Streaming Game Events with Benthos and Apache Kafka: A Plarium Case Study]]></title>
            <link>https://medium.com/playamp/enriching-streaming-game-events-with-benthos-and-apache-kafka-a-plarium-case-study-e371417600bf?source=rss----c0d232df0cfa---4</link>
            <guid isPermaLink="false">https://medium.com/p/e371417600bf</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[benthos]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Tomer Harpaz]]></dc:creator>
            <pubDate>Wed, 20 Sep 2023 08:57:14 GMT</pubDate>
            <atom:updated>2023-09-20T08:57:15.870Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*usFyWdg68nPnqSIDlrmQcw.png" /></figure><h3>Introduction</h3><p>In the fast-paced world of online gaming, capturing and processing game events efficiently and in real-time is crucial. At <a href="https://plarium.com/">Plarium</a>, a leading game development company, we faced the challenge of high throughput events enrichment while decreasing the game events footprint sent by the game app. We wanted to send very slim events, containing only relevant data to the event itself, and still get in real-time an enriched event with additional attributes like session and player-level information.</p><p>To address this, we implemented a robust and scalable solution leveraging <a href="https://www.benthos.dev/">Benthos</a> and Apache Kafka, deployed on Google Kubernetes Engine (GKE). This article outlines the technical details and benefits of our solution.</p><h3>The Challenge</h3><p>Plarium’s gaming platforms generate a vast amount of events, including game logins, player actions, and in-game activities. The player login events contain player and session-related data, such as the game version and player registration date.</p><p>Other events such as battles should be kept as slim as possible. Having said that some of our streaming processes still require the extra player/session level data. So we had to enrich these events with the data from the login event. Sounds pretty simple right? But there are some additional considerations:</p><ul><li>Sequencing of events is not guaranteed — We might have a Late Login event, the rest of the session events can not be enriched at the time of their arrival and must be handled once we get the login event.</li><li>Missing events — In case we did not get the login event after X time we still need to send the slim event as is.</li><li>Configurable — The list of enrichment attributes should be configurable and easy to deploy (no new images)</li><li>High throughput — The enrichment process must have very low latency</li><li>Scalability — The solution must be scalable</li><li>High availability — The service should have minimum downtime.</li><li>Persistency — Zero data loss</li><li>Memory performance — Keep Memory consumption efficient, We need to keep only the relevant player and session cached data.</li></ul><h3>Solution Overview</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/0*jzET1VejLOZTIczt" /></figure><p>To meet the challenge, we devised a robust streaming solution that utilized Benthos as the data stream processor and Kafka as the message broker. Here’s a high-level overview of our solution:</p><ol><li><strong>Game Login Events Producer:<br></strong>The gaming platform generates game login events, which are sent to a Kafka topic as the entry point to the data streaming process.</li><li><strong>Game Events Producer:<br></strong>The gaming platform generates player actions, and in-game activities events, which are sent to a Kafka topic per event type which is marked as a slim topic (prior to enrichment).</li><li><strong>Benthos Deployment on GKE:<br></strong>We deployed Benthos on GKE, allowing for easy scalability and management of the stream processing pipeline. Benthos acted as the intermediary between the slim game topic and the enriched Kafka topic.</li><li><strong>Enrichment Process:<br></strong>Benthos was configured to extract game login events from the Kafka topic and cache them in Redis (GCP Memorystore) with a defined TTL, they will be deleted once the session timeout is over. A second input was configured for all “slim” topics to be processed by the enrichment processor. For each “slim” event this processor fetched additional data from Redis cache, In case a relevant key was not found in the cache the event is sent to a retry topic with an additional retry counter attribute. The third input would be the retry topics which will be read from every defined interval. Once the events were enriched, Benthos forwarded the enriched events to another enriched events topic (per event type), ensuring the real-time flow of data to downstream systems.</li><li><strong>Consumers:<br></strong>Downstream applications and systems consumed the enriched events from the Kafka topic. These systems utilized the enriched data for various purposes, such as personalized in-game content, analytics, and reporting.</li><li><strong>Enrichment configuration:<br></strong>A deployment process using cloud build was created to read the configured enrichment attributes from a DB and dynamically create the Benthos configuration file.</li><li><strong>Monitoring and Alerting:<br></strong>Using Prometheus® and Grafana®</li></ol><h3>Benothos Configuration sample:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/0*wSfwd9xgsrM9JwqD" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/0*9L9CRxku1LZYD4DV" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/0*Y5ucOx8O708F9dJG" /></figure><h3>Advantages of the Solution</h3><p>Our chosen approach offered several significant advantages:</p><ol><li><strong>Real-Time Data Processing<br></strong>By leveraging Benthos and Kafka, we achieved real-time processing of game events.</li><li><strong>Scalability<br></strong>The deployment of Benthos on GKE ensured horizontal scalability, meaning we could effortlessly handle fluctuations in event data volumes during peak gaming hours. This ensured a smooth and uninterrupted gaming experience for players without concerns about data bottlenecks.</li><li><strong>Fault Tolerance<br></strong>Both Benthos and Kafka are designed to be fault-tolerant, ensuring that the game events processing pipeline remains highly available. In the event of component failures, the system would gracefully recover, preventing data loss and maintaining overall system stability.</li><li><strong>Data Enrichment Flexibility<br></strong>Benthos provided flexibility in implementing the enrichment processor. We could easily modify or add new enrichment logic as per evolving business requirements without impacting the overall streaming process.</li><li><strong>Simplified Management<br></strong>Using GKE to host Benthos reduced the operational overhead associated with managing infrastructure. This allowed our engineering teams to focus on developing game features and improving player experiences rather than managing infrastructure.</li></ol><h3>Conclusion</h3><p>Plarium’s implementation of a game event enrichment solution using Benthos and Kafka on GKE proved to be a success. By augmenting game events with relevant information, we were able to deliver a more engaging and personalized gaming experience to our players and real-time information to our internal customers. The scalability, fault tolerance, and real-time capabilities of our solution ensured that our gaming platform could handle significant data volumes without compromising performance.</p><p>As Plarium continues to innovate and develop new games, this streaming solution lays a solid foundation for handling event data efficiently and opens doors to further enhancing our players’ gaming experiences.</p><h3>References</h3><ol><li>Benthos documentations:<a href="https://www.benthos.dev/"> https://www.benthos.dev/</a></li><li>Benthos enrichment example by Benthos: <a href="https://www.benthos.dev/cookbooks/enrichments/">https://www.benthos.dev/cookbooks/enrichments/</a></li><li>More about our use of Benthos by our Benthos Master Almog Almado:<br><a href="https://medium.com/plarium-engineering/how-we-reduce-our-streaming-cost-by-90-using-benthos-fe04fcdffea7">https://medium.com/plarium-engineering/how-we-reduce-our-streaming-cost-by-90-using-benthos-fe04fcdffea7</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e371417600bf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/playamp/enriching-streaming-game-events-with-benthos-and-apache-kafka-a-plarium-case-study-e371417600bf">Enriching Streaming Game Events with Benthos and Apache Kafka: A Plarium Case Study</a> was originally published in <a href="https://medium.com/playamp">Playamp-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we implemented Metabase in our cloud data platform]]></title>
            <link>https://medium.com/playamp/how-we-implemented-metabase-in-our-cloud-data-platform-bdadebdf64b7?source=rss----c0d232df0cfa---4</link>
            <guid isPermaLink="false">https://medium.com/p/bdadebdf64b7</guid>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Yinon Eitan]]></dc:creator>
            <pubDate>Mon, 20 Feb 2023 07:58:02 GMT</pubDate>
            <atom:updated>2023-02-20T07:58:02.654Z</atom:updated>
            <content:encoded><![CDATA[<p>This article describes why and how we implemented Metabase as a self-service BI tool for business users.</p><h3>Background</h3><p>The data engineering department in Plarium develops the company’s centralized data platform, which provides data solutions and services.</p><p>Our high-scale, cloud-based platform has a complex data model that stores and organizes data from all the games, marketing systems, and external sources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*W51BJYQaDo5NQ33b7HFYZg.png" /></figure><h3>BI Tool For Everyone</h3><p>Business users across Plarium’s departments (finance, marketing, game designers), are usually not experts in our data model, don’t know SQL but they’re very data-oriented that want to support their decisions with data and gain insight from it.</p><p>Whenever these users want to do that, they need assistance from a data analyst or request a dashboard development from our visualization team.</p><p>That’s where Metabase comes into the game. As soon as the data is ready, the user can work with it in Metabase by asking ad-hoc questions, building dashboards, and getting alerts without depending on anyone.</p><p>💡 We don&#39;t skip the phase of preparing the data according to the user requirements. However, it usually comes to creating a view on top of existing tables.</p><blockquote>“<em>Self-service BI tool helps business users to visualize and gain insights from the data.</em>“</blockquote><h3>Under The Hood</h3><p>We use Metabase open-source version on top of Google’s BigQuery, Using MB docker image installed on Kubernetes VMs. Each time a significant version is released, we manually update it.</p><p>Using a service account with access to only one data set in BQ, we manage which tables are available in Metabase. Via the permissions section in the admin setting, we manage user-to-table permissions.</p><p>💡 Since Metabase is live-querying the DB each time a chart is refreshed it’s critical to monitor the queries’ cost, count, and duration.</p><p>Metabase has several APIs you can use to extract metadata, create/delete objects and execute actions in the system. Our primary use case using the APIs is to improve our audit abilities by getting the user details and <a href="https://www.metabase.com/docs/latest/api/activity">activities</a> they do in Metabase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0jDu_jJxd8g-jX8dme8WtA.png" /><figcaption>Monitor on queries cost (per Metabase user)</figcaption></figure><h3>Worth-Notice Features</h3><p>After using Metabase for a while, we gather a few “advance” features that are worth noticing-</p><h4>Charts alerts:</h4><p>With <a href="https://www.metabase.com/docs/latest/questions/sharing/alerts">chart alerts</a>, you can let the data work for you and alert you when the value crosses a threshold.</p><h4>Dashboard subscription:</h4><p>Similar to alerts, subscriptions send you a snapshot of your dashboard every H/D/W/M.</p><h4>Timelines events-Annotations:</h4><p>With <a href="https://www.metabase.com/docs/latest/exploration-and-organization/events-and-timelines">timelines </a>events, you can mark specific dates to capture chronological knowledge and make it available when you need it</p><h4>Overlaying two-time series on the same chart:</h4><p>Presenting the same metric over <a href="https://www.metabase.com/learn/dashboards/compare-times">two-time series</a> on the same chart can help you simplify the comparison.</p><h4>Markdown:</h4><p><a href="https://www.metabase.com/learn/dashboards/markdown">Markdown </a>allows you to enrich your dashboard with text, headlines, links, pictures, and GIFs.</p><h4>Community</h4><p>🤝Metabase has a wide <a href="https://discourse.metabase.com/">community</a> (with a very quick response time) where you can read about best practices, get help and suggest features.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdadebdf64b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/playamp/how-we-implemented-metabase-in-our-cloud-data-platform-bdadebdf64b7">How we implemented Metabase in our cloud data platform</a> was originally published in <a href="https://medium.com/playamp">Playamp-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we reduce our Streaming cost by 90% using Benthos]]></title>
            <link>https://medium.com/playamp/how-we-reduce-our-streaming-cost-by-90-using-benthos-fe04fcdffea7?source=rss----c0d232df0cfa---4</link>
            <guid isPermaLink="false">https://medium.com/p/fe04fcdffea7</guid>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[streaming]]></category>
            <dc:creator><![CDATA[Almog Almado]]></dc:creator>
            <pubDate>Tue, 29 Nov 2022 09:08:30 GMT</pubDate>
            <atom:updated>2022-11-29T09:08:30.847Z</atom:updated>
            <content:encoded><![CDATA[<p>Benthos Streaming on K8S infrastructure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mp2mYoZgQkMgY33LSct9Zw.jpeg" /><figcaption>Benthos Logo</figcaption></figure><h4>A little bit about us:</h4><p><a href="http://www.plarium.com/"><strong><em>Plarium</em></strong></a> is a leading gaming company in the industry — Plarium’s games aren’t just <em>play-for-fun</em> it’s totally <em>a way of life</em> — with millions of active players every day, our games have already ranked Plarium 1# in RPG &amp; Strategy game charts.</p><h4>The challenge:</h4><p>As data engineers, our challenge is to provide a pipeline that can Streams these enormous amounts (billions) of incoming events from our Players without compromising on performance, resilience, scalability, or cost.</p><h4>High-level Pipeline:</h4><p><strong>Streaming</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*AcCoHN2SHEw234MnHXz43A.jpeg" /></figure><p><strong>Batch</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*X-u5jWpCmOoZWRy2pWIj8w.jpeg" /></figure><h4>Legacy pipeline — Apache Flume:</h4><p>For the last 7 years, our main streaming system was Apache Flume, which had been serving us well. However, it required a lot of human intervention, tweaking, constant monitoring, and planning ahead before a high spike.</p><p>The main problem that we encountered with Flume was the lack of scalability. We deployed it as a static VMs, so on low traffic, we pay extra for compute resources which isn’t required. On the other hand, in very high traffic there is a risk of a significant lag due to a lack of VMs. Human intervention was required to launch more VMs and delete them afterward.</p><p>Moreover, Flume isn’t fully compatible with GCS so it forced us to use a Google Hadoop connector which isn’t ideal.</p><h4>Benthos to the rescue:</h4><p>So what exactly is Benthos? Benthos is a brand new open-source data streaming service that is written in GO, has excellent performance, a super light image size of 25MB (COMPRESSED), and is fully compatible with K8S.</p><p>Moreover, it has an enormous amount of connectors/sinks(Kafka, GCS, S3, BQ, etc.) out of the box, not to mention its super easy configuration with a simple Yaml.</p><p><a href="https://www.benthos.dev/">Benthos | Benthos</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NGl-E36tCD1MqgDT67rb7w.jpeg" /></figure><p>On the one side, our Kafka cluster receives billions of events from different producers, but on the other side — our goal is to stream this data to the Datalake(GCS) ASAP in order to reduce pipeline latency.</p><p>After a long POC of many solutions Like Spark structured streaming, Kafka streams, etc., We’ve consolidated on Benthos due to its superior in every aspect.</p><p>Benthos has a super easy configuration compared to its competitor (almost plug&amp;play). It’s based on GO instead of JVM, which gives it outstanding performance, native support for K8S, and all the connectors/sinks you can think of.</p><h3>So how do you set up Benthos?</h3><h3>1)Configuration:</h3><p>Benthos has a very simple config via a Yaml file. Another option is to use the Benthos studio which is a UI solution. The configuration is pretty basic and super easy.</p><p>Example:</p><pre>input:<br>  kafka:<br>    addresses: kafka_cluster:9092<br>    topics: [ foo, bar ]<br>    consumer_group: foogroup<br>    start_from_oldest: true<br>          batching:<br>            count: ${batching_count_random} # 20000-45000<br>            period: ${batching_period_random} # 30s-100s<br><br>pipeline:<br>   processors:<br>      - archive:<br>          format: lines<br>      - compress:<br>          algorithm: gzip<br><br>output:<br>  gcp_cloud_storage:<br>    bucket: TODO<br>    path: &#39;${! meta(&quot;kafka_topic&quot;) }/${!now().format_timestamp_strftime(&quot;%Y-%m-%d-%H-%M-%S&quot;, &quot;UTC&quot;)}.gz&#39;<br>    content_type: application/octet-stream<br>    collision_mode: error-if-exists</pre><p>Benthos is fully compatible with K8S, and there is an official image on docker-hub which can be used out of the box (<a href="https://hub.docker.com/r/jeffail/benthos">hub.docker.com/r/jeffail/benthos</a>). All that is required is to pass the YAML configuration file. There are several methods to do so. For us, the simple one is to use a K8S ConfigMap and mount it to the pod(rollout restart is required on updates but it is pretty rare)</p><h3><strong>2)Deployment(K8S):</strong></h3><p>The deployment is standard and uses the official image of Benthos. In order to provide access to the cloud(GCP) components just attach Service-Account with correspondent permissions. Cpu &amp; Memory should be allocated with caution according to the specific processing. We use an ENV variable to pass batch config, and finally, we mount the YAML file to the pods.</p><p>The deployment is fully scalable and will scale up &amp; down according to the amount of the current events pulled from Kafka which reflects in the CPU &amp; Memory load.</p><p>*It is important to emphasize that it’s highly recommended to correctly config the Benthos batch size, buffer,(etc..) according to Pod resources (CPU &amp; Memory) in order to avoid OOM(Out Of Memory) and other problems. This can be a painful scenario where due to an unexpected high spike or node loss, the pod will try to “bite off more than it can chew” and will crash.</p><p><strong>HorizontalPodAutoscaler(HPA):</strong></p><p>Because our inputs from Kafka are dynamic (for example, once a studio does a promotion — the number of events can skyrocket), we need a smart way to adjust the pod’s amount. In addition to that, we need to do this elegantly without harming the streaming on the one hand, and not pay extra for pods that are not required on the other hand.</p><p>Firstly(on trial) we used the default HPA settings but it was too agile, it scales pods up and down almost every minute. In order to avoid it, plus improve resilience — we set the HPA averageUtilization to 75% for both CPU &amp; memory(buffer) plus use behavior scaleUp &amp; scaleDown with period &amp; stabilizationWindow to do it much more smoothly and reliably.</p><p>*On scaleUp we aspire to be quick(avoid lags) while on scaleDown we can wait for a reasonable period of time to keep it as smooth as possible.</p><p>Example:</p><pre>metrics:<br> - type: Resource<br>   resource:<br>     name: cpu<br>     target:<br>       type: Utilization<br>       averageUtilization: 75 <br> - type: Resource<br>   resource:<br>     name: memory<br>     target:<br>       type: Utilization<br>       averageUtilization: 75 <br> behavior:<br>   scaleDown:<br>     policies:<br>     - type: Pods<br>       value: 1<br>       periodSeconds: 600 <br>     - type: Percent<br>       value: 5 <br>       periodSeconds: 600 <br>     selectPolicy: Max <br>     stabilizationWindowSeconds: 280 <br>   scaleUp:<br>     policies:<br>     - type: Pods<br>       value: 3<br>       periodSeconds: 60<br>     - type: Percent<br>       value: 15 <br>       periodSeconds: 60<br>     selectPolicy: Max<br>     stabilizationWindowSeconds: 60</pre><h3>3)Dynamic batch configuration:</h3><p>A huge challenge that we had while launching the trial is a Cpu &amp; Memory usage spike&amp;low cross-system, which put us at a big risk. But what caused it? due to the fact that all the pods share the same config(YAML) with the same static batch threshold, plus the (Kafka)consumer group sets the rhythm for all pods like on add/remove of a member. This combination creates cross-system synchronization which is super problematic and must be leveled down to average in order to use the compute resources in the most efficient way. Moreover, it prevents us from lowering the pod amount(big money loss).</p><p>When does it occur? Our pick of the processing is on the group&amp;compression of all the batch events (once hitting the threshold) to JSON-gzip(will be upgraded to Zstd in the near future). The main problem is that all the batches/threads inside the pod have the same static config(threshold), as well as all the pods are the same config-wise. So on the compression phase — the CPU usage cross pods spike up, and once finished — it dives down. This “pendulum” may end in unwanted risks like node memory pressure, node Eviction, etc.</p><p><strong>The solution:</strong></p><p>In order to solve this situation, we use a dynamic batch configuration for each pod.</p><p>How did we do it? We decide on a range(min/max) of a batch(count &amp; period). Once we launch a pod we randomize it from the range and pass it to the benthos config as an env variable. This way, each pod has a slightly different batch config and we are able to level down to average the spikes for good.</p><h3>4)Cost Reduction:</h3><h4>100% Spots:</h4><p>From a cost point of view, the main advantage of Benthos, which saves a lot of money, is to use a node-pool of spots only. How can we use it with almost no downsides?</p><p>Each pod consumption status from Kafka is fully handled by the (Kafka) consumer group, plus Benthos acknowledges that data is written only after finished writing, so there’s no way data loss would occur. Moreover, pod spin-up takes seconds. So even if a node is taken(spot), a new node will be launched immediately and in a few seconds to minutes, a fresh node(with pods) will be available to consume the lag (if it exists). Most of the time Due to the HPA buffer(75%), the rest of the pods will overcome this — and the lag will be negligible (if at all existent).</p><h4><strong>The right node type:</strong></h4><p>From our investigation, the best value-for-money machine type for our streaming task in GCP is N2D(AMD). It’s very cheap, and it saves us a lot of money while delivering excellent performance. T2A(ARM) can also be an interesting choice, but unfortunately — it wasn’t available in our GCP region while launching our solution(it is possible we will decide to adopt it in the near future).</p><h4>K8S Autoscaling profile:</h4><p>We set the Autoscaling profile of the cluster to “Optimize utilization”. This makes the cluster more aggressive with scales down resources. Just to remind you — it’s not problematic because Benthos is super resilient, which allows us to save more money.</p><h3>5)Monitoring</h3><p>Benthos supports Prometheus (among many others), which is our favorite option. You can deploy a small pod that scraps all the cluster pod&#39;s metadata and forward it (like we do) or use the built-in push gateway support via config.</p><p>Our Prometheus is connected to Grafana, which gives us full visibility of the pipeline alongside the ability to set alerts and be notified in the second that something is going south.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1ysbvZis3-Jd778DF_NOA.png" /></figure><h3>Conclusion:</h3><p>This journey from Flume to K8S-Benthos gave us a state-of-the-art solution: No more human intervention, super resilient, and super low latency, plus the cherry on top, it reduced our costs by 90% which is more than we could have asked for. If in the old Flume deployment we spined regular VMs, now we usually use 30%~ node/VMs compared to the old deployment plus it is 100% spots.</p><h3>Acknowledgments:</h3><p>I would like to express my appreciation to <a href="https://medium.com/u/7bdd4ddb9fb">Ashley Jeffs</a>(Benthos Founder) and his team for this amazing product :)</p><p>Thanks for reading,</p><p><strong>Almog Almado</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe04fcdffea7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/playamp/how-we-reduce-our-streaming-cost-by-90-using-benthos-fe04fcdffea7">How we reduce our Streaming cost by 90% using Benthos</a> was originally published in <a href="https://medium.com/playamp">Playamp-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ETL as a service]]></title>
            <link>https://medium.com/playamp/etl-as-a-service-95fa84f74f42?source=rss----c0d232df0cfa---4</link>
            <guid isPermaLink="false">https://medium.com/p/95fa84f74f42</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Yinon Eitan]]></dc:creator>
            <pubDate>Thu, 11 Aug 2022 06:59:19 GMT</pubDate>
            <atom:updated>2022-08-11T07:26:31.413Z</atom:updated>
            <content:encoded><![CDATA[<p>This article describes why and how we created a lean ETL solution that can be easily set up and reused in many use cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/0*sczZO3zQl3i_aIte" /></figure><p><strong>Background</strong></p><p>At Plarium, the data engineering department develops the company’s centralized data platform that provides data solutions and services.</p><p>Alongside the main data pipeline, which handles billions of events every day, we developed a side solution for data transformation for different use cases. The purpose is to allow us to give a fast way to ETL data without the need for complex design, development, and tests.</p><p>In many cases, the data is sent to our GCP bucket in its original structure (game server logs or third-party data) and at the end of the process, it will be available to query in BigQuery.</p><blockquote><strong>ETL as a service will allow generic and simple ETL without the need for development and tests</strong></blockquote><p><strong>So how did we do it?</strong></p><p>Using Jupyter notebooks, which can easily be scheduled, the user input all the relevant parameters-</p><blockquote>Source and target path</blockquote><blockquote>Enrich columns</blockquote><blockquote>Deduplication based on a key</blockquote><blockquote>Data partitions- based on existing or enriched columns</blockquote><blockquote>Slack channel for alerts- further details can be found in this<a href="https://medium.com/plarium-engineering/proactive-monitoring-via-slackbot-d53660c9dc70"> article</a>.</blockquote><p>After that, the user just clicks run and can query the data he just transformed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Jaz9FoWer8Oye_KM" /><figcaption>Input params, the user sets it up and is ready to go</figcaption></figure><p>In the background, the process written in Python reads the files in the source path, moves the files to a pending folder (using gsutil), and starts to transform and enrich according to the input parameters. The process handles parquet, ORC, CSV, NDJSON, and in order to support multiline JSONs, we use Spark to write them in ORC format.</p><p>Duplication is checked in each batch load and against the target table, and if exists moved to a maintenance table for further investigation. In case of failure, we can copy back the pending files and reprocess them after fixing the issue. If the process succeeded, the files moved to an archive folder.</p><p><strong>One of the use cases-</strong></p><p>Plarium runs marketing campaigns to publish and distribute our games.</p><p>The data for the cost of these campaigns are sent to us alongside our main pipeline(different source) and need to be processed in order to present this data in our KPI and in order to calculate different metrics such as ROAS.</p><p>We ETL this data using ETL as a service because the data can be loaded as-is (with small adjustments) and then continue to process and join it inside BigQuery.</p><p><strong>Thanks for reading!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95fa84f74f42" width="1" height="1" alt=""><hr><p><a href="https://medium.com/playamp/etl-as-a-service-95fa84f74f42">ETL as a service</a> was originally published in <a href="https://medium.com/playamp">Playamp-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ML models deployments]]></title>
            <link>https://medium.com/playamp/ml-models-deployments-850d5beae01e?source=rss----c0d232df0cfa---4</link>
            <guid isPermaLink="false">https://medium.com/p/850d5beae01e</guid>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[infrastructure]]></category>
            <dc:creator><![CDATA[Tomer Harpaz]]></dc:creator>
            <pubDate>Tue, 09 Aug 2022 15:16:52 GMT</pubDate>
            <atom:updated>2022-08-09T15:18:59.905Z</atom:updated>
            <content:encoded><![CDATA[<p>At Plarium, our data engineering team and data scientist team work closely together to apply ML pipelines in various areas. It could be used for improving marketing effectiveness or enhancing games’ experience. ML models have become a necessity for any data-driven organization in the past few years, but how do you integrate them into your business?</p><p>Without covering the ML models - I’ll explain the flow, architecture, and implementation we used in some cases.</p><h3>Our ecosystem</h3><p>Some background about our ecosystem: Since we are hosted on Google Cloud Platform our services are deployed on GKE, we prefer to use containers and Kubernetes wherever it is possible. Most of the data is loaded to BigQuery (and some are files saved to buckets). Complex heavy-duty ETLs or Streaming processes are written in scala using Apache Spark and deployed to Dataproc, but simpler data processes, data scientists, or analysts processes are written in Jupyter notebooks. These notebooks can either be written in Python or scala, with or without Spark and are also run over GKE. Tap the link to read more about our <a href="https://medium.com/plarium-engineering/tech-story-spark-jupyter-on-k8s-64b9d43a37ba">Jupyter &amp; Spark environment </a>from our Chief Architect. Any ETL process is scheduled to run using AirFlow. Our monitoring is done using Prometheus with Garfana.</p><h3>Example Use Case</h3><ul><li>ML model is scheduled to run once every few hours to analyze players’ behavior and output games recommendation.</li><li>The game adjusts player experience based on the recommendation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/0*4Arv321ZWuvTexKP" /></figure><h3>ML Process</h3><p>In this use case, processing a large number of data points and historical data made us select offline predictions. So our ML models are a python code that runs over Jupyter notebooks triggered by Airflow. We have a JupyterHub deployed over Google Kubernetes Engine pods. The process reads its input from BigQuery, where all our games data resides, and saves the results back to BigQuery.</p><h3>Loading results to cache</h3><p>Serving the results to the game app requires very low latency, which led us to cache the results in Redis. Here we used another Jupyter notebook triggered by Airflow. We use scala code with Spark to load the dataframe that we load from BigQuery to Redis (using spark-redis package). The Redis table will be based on the specific model and version, and the key is based on some of the model params or business use cases.</p><p>The division to tables allows us the use several versions of the same model for AB testing and control a new model’s gradual rollout.</p><h3>Serving the results — Requirements</h3><p>This is the tricky part. Serving the ML results back to the game app has the following technical and business requirements:</p><ul><li>Request Authentication — this will also determine the relevant model for the recommendation</li><li>SSL connection — for obvious security reasons</li><li>Low latency — the mobile game needs to get the model recommendation but it can’t wait for it</li><li>High Throughput — the solution must be scalable, and support a (very) large number of concurrent requests</li><li>Monitoring the service is up and alerting on service failure</li><li>Business Monitoring of requests count and Alerts on a low number of requests or high amount of error responses</li><li>Reduced response size — for mobile performance consideration, in case the player is using an old device this could be crucial, and also network traffic should be minimized.</li><li>Model balancing according to model versions weights — a new model version is usually tested first with a sample population. Then, using weight configuration, we can adjust the amount of population using a specific model.</li><li>High Availability — even though our game studios use robust code that will not crash or get hung in case the service is not available — we still need to make sure it is always available (to the extent of some nines :-) )</li><li>Multitenancy — the service can be used by several studios and support different Models per studio</li></ul><h3>Serving the results — The Solution</h3><p>For this Rest service, we used scala with Akka actors deployed on GKE pods.</p><p>The GKE deployment answers several of the requirements:</p><ul><li>It enables us to easily scale up to as many pods as needed</li><li>Deploy ingress with SSL connection and load balancing</li><li>Service is highly available since there are multi pods</li></ul><p>For authentication, we used JWT token which also allows us to know the requester, and use it to get the relevant model products.</p><p>To support monitoring, the service exposes metrics endpoint for Prometheus with counters for different responses and requests which is then called by Grafana.</p><p>In Grafana dashboard we defined alerts on either the number of requests that are below the threshold, or if the amount of error responses is higher than expected.</p><p>We implemented model balancing logic so the requests can be balanced between different model versions according to configured weights.</p><p>As already mentioned above - to enable low latency, the ML products are stored in Memorystore (a GCP managed Redis).</p><p>The actual response can either be JSON (to enable easier analysis of the response) or Bit packet data (using bitwise manipulation) to enable the smallest response size possible.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=850d5beae01e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/playamp/ml-models-deployments-850d5beae01e">ML models deployments</a> was originally published in <a href="https://medium.com/playamp">Playamp-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proactive Monitoring via SlackBot]]></title>
            <link>https://medium.com/playamp/proactive-monitoring-via-slackbot-d53660c9dc70?source=rss----c0d232df0cfa---4</link>
            <guid isPermaLink="false">https://medium.com/p/d53660c9dc70</guid>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[slackbot]]></category>
            <category><![CDATA[slack]]></category>
            <dc:creator><![CDATA[Dotandaya]]></dc:creator>
            <pubDate>Wed, 20 Jul 2022 12:45:22 GMT</pubDate>
            <atom:updated>2022-07-20T12:45:22.529Z</atom:updated>
            <content:encoded><![CDATA[<p>As the infrastructure team at Plarium, we serve several teams: data engineers, data scientists and data analysts. In the past year, all of those teams started to work with our interactive platform, which we described in our <a href="https://medium.com/plarium-engineering/tech-story-spark-jupyter-on-k8s-64b9d43a37ba">previous article</a>.</p><p>Process automation was an essential factor for the ongoing work of a growing number of teams, as well as automatic monitoring which allows the teams’ members to monitor their processes and get alerts when they failed.</p><p>As distributed teams, a significant fraction of our communication is performed in Slack. The solution of slack bots is useful for sending notifications to team members and make day-to-day work more efficient by automating workflow tasks and information sharing. Therefore, we decided to investigate this possibility to provide proactive monitoring of the process’ alerts and take action accordingly. In addition to that, the users will be able to get information about the processes, check last runs statuses and logs and trigger them.</p><p>A bot is a type of a Slack app designed to interact with users via conversation. For that, we used <a href="https://github.com/SlackAPI/bolt-js">Bolt</a> — “A JavaScript framework to build Slack apps in a flash with the latest platform features”. Our app is deployed on K8S, *defines a costume receiver (handling and parsing any incoming requests from Slack and then sending them to the app) *listens and sends messages and *listens and responds to actions/ events.</p><p>Our processes run on Jupyter notebooks that are scheduled by Google Composer (managed Airflow). In the deafault_args of each DAG we defined an on_failure_callback that sends the information about the failed DAG to our Slack app. Moreover, we defined slash commands that return information about the last DAG runs, logs of the runs, and the ability to run a DAG.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/321/0*pNRg41RNtJAbCnhG" /></figure><p>Our Slack bot takes monitoring one step ahead, which allows our team members to manage their processes anywhere and to update the team about the processes’ status.</p><p>This is what it looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/0*EKt7mCGJhsLtKifq" /></figure><p>The alert includes the process and task names of the failed DAG and opens a thread that includes a button to rerun the process and a follow-up message that update the process status. Inside the message, the user can choose the task that one wants to see its logs, and check the 10 last status runs of this process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/0*dRmRnu9Q3vJsbYdT" /></figure><p>After the process owner finished to handle the failure — one can close the thread and this will update the group about it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/0*xg1QZKKJ8V1bpXsA" /></figure><p>The slash command we defined:</p><p>*/air-dags — return a dropdown with our DAGs in airflow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*lRh4lYAa2_WuGgNV" /></figure><p>and a click on one of them returns the information about the chosen DAG and allows to trigger it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/0*j7gs9yxDzwI7PzSj" /></figure><p>*/air-dag-tasks dev-develop-survey-provider-full-int — return a dropdown with the tasks of the last run of the DAG</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/0*5D3qxHL7PLfHTjQa" /></figure><p>A click on one of the tasks will return the logs of the tasks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2vYDEAjjcphEqoCJ" /></figure><p>*/air-dag-runs dev-develop-survey-provider-full-int — return dropdown with the last 10 runs statuses of the DAG.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/0*U6Kmnd1TqtIRj4QE" /></figure><p>And a click on one of the runs will return information about the specific run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/0*Oy1efEH0VRGF2L9y" /></figure><p>*/air-dags-running dev-develop-survey-provider-full-int — return dropdown with the current runs of the DAG</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/0*5rs9b1-9_QGBynV2" /></figure><p>And a click on one of the runs will return information about the current run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/0*LHf4hha2luf31acK" /></figure><p>*/air-run dev-develop-survey-provider-full-int — trigger the DAG.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d53660c9dc70" width="1" height="1" alt=""><hr><p><a href="https://medium.com/playamp/proactive-monitoring-via-slackbot-d53660c9dc70">Proactive Monitoring via SlackBot</a> was originally published in <a href="https://medium.com/playamp">Playamp-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Update BigQuery columns description from Google Spreadsheet]]></title>
            <link>https://medium.com/playamp/update-bigquery-columns-description-from-google-spreadsheet-45a6bc82b87?source=rss----c0d232df0cfa---4</link>
            <guid isPermaLink="false">https://medium.com/p/45a6bc82b87</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[metadata]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[bigquery]]></category>
            <dc:creator><![CDATA[Alan Vainsencher]]></dc:creator>
            <pubDate>Sun, 26 Jun 2022 10:07:31 GMT</pubDate>
            <atom:updated>2022-06-28T11:18:03.245Z</atom:updated>
            <content:encoded><![CDATA[<p>At my company, we heavily rely on Google Cloud. Specifically for datawarehousing we use BigQuery. With thousands of tables in it, we need to do a good job in keeping metadata tidy and clean.</p><p>In order to do this, our product data team has different Google spreadsheets so they can manage the column description for every field of every table. Product don’t have direct access or permissions to edit directly on BigQuery, so they do it in a spreadsheet like this one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*C5mAjy9Le0ZpKPMtYpQntQ.png" /><figcaption>The schema is completely made up for this article. Don’t try to find any logic in it :)</figcaption></figure><p>With this spreadsheet, we have processes working in the background that update BigQuery columns description with the data we have in the spreadsheets. These processes use many python libraries Google provides in order to communicate with their products and some other open source libraries as well.</p><p>First, we need some methods to talk to the Google spreadsheet and retrieve the fields and their descriptions. We use the library <a href="https://gspread.readthedocs.io/en/latest/">gspread</a>.</p><pre>import gspread<br>from oauth2client.service_account import ServiceAccountCredentials</pre><pre>class GoogleSheetHandler():<br>    def __init__(self): <br>        self.gc = gspread.authorize(ServiceAccountCredentials.from_json_keyfile_name(&quot;c://PATH_TO_YOUR_SECRET/credentials.json&quot;,  [&#39;<a href="https://spreadsheets.google.com/feeds&#39;">https://spreadsheets.google.com/feeds&#39;</a>,<br>             &#39;<a href="https://www.googleapis.com/auth/drive&#39;">https://www.googleapis.com/auth/drive&#39;</a>]))</pre><pre>    def get_spread_sheet(self,spread_sheet_id,worksheet):<br>        self.spread_sheet = self.gc.open_by_key(spread_sheet_id)<br>        self.worksheet = self.spread_sheet.worksheet(worksheet)</pre><pre>    def get_all_values_by_col(self,col_id):<br>        return self.worksheet.col_values(col_id)</pre><p>Make sure you give read permissions in the spreadsheet to the user that is on your credentials.json.</p><p>Then we have two helper functions and a main one to update the fields. The tricky and fun part here is that this main function is recursive, so it supports any level of nested Record types BigQuery provides.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93fdebe176765b379b9f585848d0405b/href">https://medium.com/media/93fdebe176765b379b9f585848d0405b/href</a></iframe><p>We have a BigQuery table like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WcD61oNARAPd2OaYtpkAQg.png" /></figure><p>and calling this function:</p><pre>update_description_columns_bqtable_from_gsheet(project, dataset,table_name,&quot;YOUR_SPREADSHEET_ID&quot;,&quot;YOUR_WORKSHEEET_NAME&quot;,1,4)</pre><p>then we get this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7s43mlhw9HSfBuuv26DBvQ.png" /></figure><p>Please make sure your fields in the spreadsheet are with the same case as of the columns in BigQuery. While writing this article, I had done the mistake of putting different cases, and of course it didn’t work :)</p><p>Happy bigquerying :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45a6bc82b87" width="1" height="1" alt=""><hr><p><a href="https://medium.com/playamp/update-bigquery-columns-description-from-google-spreadsheet-45a6bc82b87">Update BigQuery columns description from Google Spreadsheet</a> was originally published in <a href="https://medium.com/playamp">Playamp-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>