<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Antonio Di Turi on Medium]]></title>
        <description><![CDATA[Stories by Antonio Di Turi on Medium]]></description>
        <link>https://medium.com/@anto.dituri?source=rss-ac1c5199a468------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jjpEoKLmWwcwAZjNq_hKkQ.png</url>
            <title>Stories by Antonio Di Turi on Medium</title>
            <link>https://medium.com/@anto.dituri?source=rss-ac1c5199a468------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:51:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anto.dituri/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Monolith to micro-services, reshaping FinTech with Confluent]]></title>
            <link>https://medium.com/datareply/monolith-to-micro-services-reshaping-fintech-with-confluent-7ff595c52929?source=rss-ac1c5199a468------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ff595c52929</guid>
            <category><![CDATA[innovation]]></category>
            <category><![CDATA[streaming]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[confluent]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Antonio Di Turi]]></dc:creator>
            <pubDate>Wed, 31 Jan 2024 11:43:21 GMT</pubDate>
            <atom:updated>2025-08-14T11:27:51.721Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Setting the Scene</strong></h3><p>In the dynamic world of FinTech, innovation is not just a buzzword; it’s the lifeline that drives companies ahead of the curve. This is a story about a startup that from now on we will call <strong>Y </strong>(<em>X was already taken</em>) that has made significant improvements in the realms of cryptocurrency exchange, commodities trading, securities, and Exchange-Traded Funds (ETFs).</p><p>Originally built on a monolithic architecture, <strong>Y </strong>rapidly ascended in the FinTech market, but with growth came new challenges and opportunities. As the limitations of their initial system architecture became limiting, they started looking for a future where agility, scalability, and innovation were everyday realities.</p><p>Thus, <strong>Y </strong>contacted <a href="https://www.reply.com/data-reply/de/">Data Reply</a> to begin an ambitious project to migrate from a monolithic to a micro-services architecture, a move that promised to revolutionize their data handling capabilities and set new standards.</p><blockquote>Y aimed to develop a <em>modern version of data architecture</em> that would not only support their current operations, but also provide a robust framework for future growth and innovation.</blockquote><p>Their journey, however, was paved with complexities typical of such technological transitions. The need to modernize their data platforms and pipelines was evident, and the challenges were multifaceted.</p><p>In the following sections, we will deep dive in the specific challenges <strong>Y </strong>encountered, the technical and business impacts of these challenges, and how Confluent’s solutions played a crucial role in the journey towards a more flexible, scalable, and efficient data architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qCAymhH34eeihbRXgdXGkw.png" /><figcaption>A creative representation of the stressed databases</figcaption></figure><h3><strong>Technical Pain Points — Navigating the Complexity of Architectural Transformation</strong></h3><p>The transition from a monolithic to a micro-services architecture presented a series of technical challenges that needed to be meticulously addressed to realize the desired business benefits.</p><p><strong>Shared Database Access: A Bottleneck to Efficiency</strong></p><p>The central MySQL RDS database <em>had become a significant bottleneck</em>. As the sole data repository for various teams and services, it led to significant issues in scalability and performance.</p><blockquote>The database’s capacity to handle concurrent requests from different departments was being stretched to its limits, resulting in frequent downtimes and latency issues, particularly affecting applications requiring real-time access.</blockquote><p><strong>The Struggle for Performance in a Shared Environment</strong></p><p>In a shared database environment, the startup faced the challenge of managing heavy and sometimes conflicting data queries. Without a way to efficiently allocate resources, the performance of critical applications was compromised. <em>This situation was further exacerbated during peak trading</em> times when <strong>rapid</strong> data processing was crucial.</p><p>Additionally, it led to point-to-point data pipelines where each team independently partially copied source database to a target system. The downside of this architecture was that building lineage of data consumption became close to impossible.</p><p><strong>The Balancing Act: Access versus Control</strong></p><p>Granting access to the central database also posed a significant risk. Every new access point potentially introduced performance degradation and security vulnerabilities. The startup needed a solution that could balance the need for data access with the need for control and security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kLj2eRonJ0l04dQuOMtL1A.png" /><figcaption>Data pipelines serving the database in a more organized way</figcaption></figure><h3><strong>Point-to-Point Data Pipelines — Paving the Way for Scalable Architecture</strong></h3><p>As <strong>Y</strong> grappled with the challenges of its monolithic architecture, the need for a scalable, efficient solution became clear.</p><p><em>The answer lay in implementing point-to-point data pipelines</em>, which would fundamentally alter how data was managed, accessed, and utilized across the organization.</p><p><strong>Transitioning to Asynchronous Communication</strong></p><p>The adoption of point-to-point data pipelines marked a significant shift towards asynchronous communication.</p><blockquote>This method allowed for the decoupling of services, enabling each to operate independently, such an approach was instrumental in improving overall system latency, as it eliminated the need for services to wait for responses from the central database.</blockquote><p><strong>Leveraging Confluent’s Data Streaming Technology</strong></p><p>Confluent’s data streaming technology emerged as a key component in this architectural transformation. By implementing Confluent’s solutions, the startup could establish real-time data pipelines that connected various micro-services and applications directly to the data they needed, without the bottleneck of a centralized database.</p><p>More specifically, <strong><em>stream lineage</em></strong> offering helped the client to establish a solid foundation to govern data consumption.</p><p>This system provided a more robust and flexible infrastructure, where data could flow seamlessly between services, ensuring that each component had access to the most current and relevant data. It also allowed for a more granular level of control over data access and usage, aligning with the startup’s goal for improved data governance.</p><h3><strong>Integrating a Diverse Ecosystem with Confluent</strong></h3><p>In Y’s journey to build and define its new data architecture, the integration of a diverse array of systems with Confluent was critical.</p><p><strong>Debezium: The Heartbeat of Change Data Capture</strong></p><p>Debezium, an open-source distributed platform for change data capture, was at the forefront of this integration. Serving as the bridge between the startup’s databases and Kafka MSK clusters, Debezium enabled the real-time capture and streaming of database changes. This ensured that all microservices and applications had access to the latest data, essential for the fast-paced decision-making required in financial trading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O7juCGpd1vWthwEK26cGyA.png" /></figure><p><strong>KsqlDB and Kstream: Streamlining Data Processing</strong></p><p>ksqlDB, a database purpose-built for stream processing applications, played a vital role in processing the streams of data within the Kafka MSK ecosystem. It allowed to do some needed cleanup on the CDC topics so that they could be ready to consume in Confluent Cloud for the microservices that needed those data in input.</p><p><strong>Microservices Architecture: A Synergistic Relationship with Kafka</strong></p><p>The shift to a microservices architecture brought with it the need for a robust messaging system. Kafka, as a distributed event streaming platform, was perfectly suited to meet this need. It facilitated efficient communication between the various microservices, allowing for a decoupled, scalable, and resilient system architecture.</p><p><strong>S3 and Snowflake Sinks: Facilitating Data Storage and Analysis</strong></p><p>The integration of S3 and Snowflake sinks was another critical aspect of the system. S3 sinks enabled the efficient routing of data into Amazon S3 for storage and archival, while Snowflake sinks facilitated the seamless transfer of data to the Snowflake Data Warehouse for more complex analysis and reporting. This setup provided a versatile and scalable solution for managing the large volumes of financial data the startup dealt with daily.</p><p><strong>A Comprehensive Data Ecosystem</strong></p><p>Through these integrations, the startup established a comprehensive data ecosystem that was not only more efficient but also more adaptable to their rapidly evolving business needs. The use of Debezium, coupled with the power of Kafka, ksqlDB, and the strategic use of S3 and Snowflake sinks, created a robust infrastructure capable of handling the complexities of modern data processing.</p><h3><strong>Navigating the Transition from Monolith to Microservices</strong></h3><p>Transitioning from a monolithic architecture to a microservices-based system is like reengineering the DNA of a company’s IT infrastructure. For <strong>Y</strong>, this journey was both necessary and challenging. As we mentioned already (the Latin’s used to say “repetita iuvant” — literally repeating helps) the core of this challenge was to decouple consumer services and various internal applications from their central MySQL Relational Database Service (RDS), a critical move for enhancing scalability and flexibility.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jTNf75WRC8TiqEeh3Z54vw.png" /><figcaption>Data Reply’s proposed architecture</figcaption></figure><p><strong>A first view of the Architecture</strong></p><p>The first hurdle in this transition was the technical complexity of setting up real-time data pipelines. Key to this was the implementation of Debezium for change data capture (CDC), which would enable the startup to stream database changes into Kafka in real-time. This was a two-step process:</p><blockquote>1. From RDS to Kafka MSK through Debezium</blockquote><blockquote>2. From MSK to Confluent cloud after necessary cleanup of the topic using kstream and ksql</blockquote><p>Another significant component was establishing S3 and Snowflake <strong>sinks</strong> within the Confluent ecosystem. You can imagine that 90% of the data was landing on s3 and some minor use cases were directly landing on Snowflake through a specific Kafka Connector.</p><p>These sinks were crucial for efficiently routing data into appropriate storage and analysis platforms (e.g. Jupyter notebooks hosted on Data Bricks), ensuring that data was not just moved but also made ready for immediate use. The focus was on leveraging Confluent’s robust capabilities to set up a snow pipeline, integrating S3 events, Simple Queue Service (SQS), and listeners to create a seamless flow of data.</p><p><strong>Governance, Scalability and lineage: Redefining Data Access</strong></p><p>With multiple services and teams needing access to various data streams, governance became a critical concern. <strong>Y</strong> needed a system that could solve critical questions like:</p><ul><li>Who owns what data?</li><li>Who can access, discover, and use a data stream?</li></ul><p>Confluent Cloud emerged as a key player in this aspect, offering robust <strong>governance capabilities</strong>. Its out-of-the-box data lineage feature was not just about managing connections but also about providing clear visibility and control over data flows.</p><p>The transition also raised questions about scalability and performance. The existing centralized RDS database was a bottleneck, limiting the ability to scale services independently. Teams experienced downtime and latency issues, as the database had to juggle diverse and sometimes conflicting demands from different departments. Applications requiring real-time database access were particularly affected, slowed down by heavy analytics requests.</p><p><strong>Handling Significant Data Volumes and Throughput</strong></p><blockquote>In the fast-paced world of financial transactions, the startup dealt with substantial data volumes, characterized by peaks of 2000 transactions per second. This high throughput demanded a robust infrastructure capable of handling such intensive data flow without any lag or downtime.</blockquote><p>The source databases, which contained multiple terabytes of financial data, were a testament to the sheer scale of information the startup managed daily. This data included a myriad of transaction records, market trends, and customer information, all critical to their operations</p><h3><strong>Evaluating Alternatives — The Decision for Confluent over Traditional Tools</strong></h3><p>In their pursuit of a robust data architecture, <strong>Y</strong> carefully evaluated various technologies before deciding on Confluent’s data streaming solutions.</p><p><strong>Considering Traditional Messaging and Pipeline Tools</strong></p><p>Initially, the startup explored several traditional messaging and data pipeline tools. One such tool was Apache Spark with its PySpark interface, commonly used for big data processing.</p><p>While Spark offered powerful batch processing capabilities, it fell short in providing the real-time processing speed essential for the startup’s high-frequency trading environment.</p><p>Another technology under consideration was AWS Glue, a serverless data integration service that simplifies ETL (Extract, Transform, Load) workloads. While AWS Glue was adept at handling snapshot mechanisms and batch processing, it lacked the capability for efficient change data capture (CDC), crucial for real-time data synchronization.</p><p><strong>Comparing with Other Message Brokers</strong></p><p>Other message brokers like RabbitMQ and Amazon Kinesis were also considered.</p><p>However, the ecosystem around Kafka, particularly in terms of maturity, community support, and integration capabilities, stood out as more advanced and complete.</p><p>Kafka’s robust performance in high-throughput environments and its scalability were key factors in its favor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*lglBhYEZnCEzsx0W.png" /></figure><p><strong>Why Confluent Emerged as the Optimal Choice</strong></p><p>After a thorough evaluation, Confluent emerged as the clear winner for several reasons:</p><ul><li><strong>Real-Time Processing:</strong> Confluent’s Kafka-based platform excelled in handling real-time data streams, which was a game-changer for the startup’s need to process financial transactions instantaneously.</li><li><strong>Scalability and Reliability:</strong> Kafka’s proven scalability and reliability were crucial for handling the high volumes of data generated in the financial sector.</li><li><strong>Comprehensive Ecosystem:</strong> Confluent provided a rich ecosystem, including ksqlDB for stream processing, and connectors for integrating with various data sources and sinks, offering a one-stop solution for the startup’s diverse needs.</li><li><strong>Advanced Governance and Monitoring:</strong> Confluent’s advanced governance tools and monitoring capabilities ensured better data management and compliance, a must-have in the heavily regulated financial industry.</li></ul><p><strong>Realizing Transformation — The Business Impact of Data Streaming with Confluent</strong></p><p>The adoption of Confluent’s data streaming technology marked a significant turning point for the FinTech startup. This section explores the tangible impacts that data streaming had on the startup’s operations, highlighting the profound changes in efficiency, cost, and scalability.</p><p><strong>Reduced Database Size and Instance Costs</strong></p><p>One of the immediate benefits was the reduction in the size and cost of database instances. By moving away from a centralized database system and adopting data streaming, the startup significantly reduced the load on its primary database. This shift not only improved performance but also lowered the costs associated with maintaining large database instances.</p><p><strong>Minimizing Production Downtime</strong></p><p>The previous architecture’s frequent downtimes, caused by the overburdened central database, were dramatically reduced. CDC combined with stream lineage solution enabled a more distributed data handling approach, which effectively eliminated the single point of failure that the monolithic database represented. This improvement was crucial for maintaining continuous operations in the high stakes trading environment.</p><p>Additionally, it helped discovering redundant data loads (due to point-to-point pipelines) and eliminate them.</p><p><strong>Speeding Up Data Processing and Analytics</strong></p><p>The transformation also had a profound impact on the startup’s data processing capabilities. Daily data snapshots, which previously took a day to complete, were now accomplished in less than 10 minutes. The end-to-end latency from event capture to business dashboard availability was reduced to under 30 seconds, a significant enhancement over batch pipelines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*xWbweVPWJyLZORQC.png" /></figure><p><strong>Operational Maintenance, Data Lineage and Visibility</strong></p><p>By providing a single point of entry for all data sources, Confluent Cloud has significantly reduced the complexity that typically surrounds the management of varied data streams.</p><p>This streamlined approach not only eases the process of tracking, updating, and troubleshooting but also leads to a considerable reduction in time and resources expended on routine maintenance tasks. Furthermore, the unified platform enhances coordination among different teams, leading to more effective and efficient operational processes.</p><p>When it comes to data lineage and visibility, Confluent Cloud offers an unrivaled solution. Its capability to trace each dataset from its origin; through various transformations; to its ultimate destination offers a comprehensive view of the data journey. This visibility is vital in understanding how data is manipulated and utilized across different stages, providing valuable insights into the overall lifecycle of the data. Such clear data flow mapping is critical when identifying and resolving issues, ensuring the integrity and reliability of the data.</p><p>Improving data quality is another significant advantage offered by Confluent Cloud. With a detailed understanding of data origins and transformations, it becomes easier to identify and correct inconsistencies and errors. This improvement in data quality leads to more accurate analytics and decision-making processes, thereby enhancing the overall business outcomes.</p><p>Root cause analysis is also greatly enhanced by Confluent Cloud. The ability to track data back to its source enables teams to efficiently diagnose and understand the origins of various issues, whether they are technical glitches, data corruption, or process inefficiencies. This proactive approach to problem-solving helps minimize downtime and improves the reliability of systems.</p><p>Lastly, Confluent Cloud plays a crucial role in enhancing governance. The platform’s robust data lineage capabilities support stronger data governance practices. With improved visibility and control over data flows, organizations can more effectively enforce compliance with regulatory requirements and internal data policies.</p><p><strong>Cost Reductions in Data Warehousing</strong></p><p>By moving some of the pre-transformation ETL jobs from Snowflake to Kafka, the startup managed to reduce the consumption costs on the data warehousing side by 20%. This optimization resulted in direct cost savings and enhanced data warehousing operations performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nhF8My-_w2-lYFUlTzx8Zw.png" /></figure><h3><strong>A New Chapter in Data-Driven Innovation</strong></h3><p>As we reflect on the journey of this pioneering FinTech startup, it’s evident that their bold decision to transition from a monolithic to a microservices architecture, underpinned by Confluent’s data streaming technology, has not just resolved their immediate challenges but has set them on a path of continuous innovation and growth.</p><p><strong>A Leap into the Future of Financial Technology</strong></p><p>The startup’s transformation is proof of the power of strategic technological advancement in the financial sector. By embracing real-time data processing and analytics, the company has positioned itself at the forefront of the FinTech revolution. They have shown that with the right tools and vision, it is possible to turn data into one of the most valuable assets in the fast-paced world of financial trading.</p><p><strong>Empowering Business with Data Streaming</strong></p><p>Confluent’s role in this transformation was critical. It provided the technological backbone necessary for the startup to achieve its ambitious goals. The benefits realized — from reduced database costs and minimized downtimes to improved data processing speeds and operational efficiencies — underscore the impact of a well-executed data strategy.</p><p><strong>A Blueprint for Success</strong></p><p>This story serves as a blueprint for other companies facing similar challenges. It demonstrates that with the right approach and technology, such as that offered by Confluent, businesses can not only overcome their data architecture challenges but also unlock new potentials and opportunities.</p><p><strong>Looking Ahead: Continuous Innovation and Growth</strong></p><p>As the startup continues its journey, the scalability and flexibility of their new architecture ensure that they are well-prepared to adapt to future market demands and technological advancements. The successful integration of Confluent’s data streaming technology has not just solved immediate operational issues but has laid the foundation for a data-driven future.</p><p>In conclusion, this narrative is more than a success story; it is an inspiration and a guide for businesses looking to harness the power of data in the digital age. The FinTech startup’s journey with Confluent reminds us that in the world of technology, the willingness to innovate and adapt is the key to staying relevant and competitive.</p><p>If you want to get in contact, or have any feedback, feel free to drop me an email at a.dituri@reply.de or <a href="https://www.linkedin.com/in/antonio-d-299781171/">contact me on LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ff595c52929" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datareply/monolith-to-micro-services-reshaping-fintech-with-confluent-7ff595c52929">Monolith to micro-services, reshaping FinTech with Confluent</a> was originally published in <a href="https://medium.com/datareply">DataReply</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Trino (ex Presto)? — for dummies]]></title>
            <link>https://medium.com/@anto.dituri/what-is-trino-ex-presto-for-dummies-72e1119006e?source=rss-ac1c5199a468------2</link>
            <guid isPermaLink="false">https://medium.com/p/72e1119006e</guid>
            <category><![CDATA[innovation]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Antonio Di Turi]]></dc:creator>
            <pubDate>Sat, 19 Nov 2022 06:42:34 GMT</pubDate>
            <atom:updated>2022-11-19T06:44:16.294Z</atom:updated>
            <content:encoded><![CDATA[<p>Often, I find it difficult to understand what a tool does when I have no background on what is a real case scenario for its use. In this article I wanted to give a gentle introduction both on the big data world and on how to store data effectively.</p><p>After that it will be easier what Trino does.</p><p><strong>TL; DR:</strong></p><blockquote>Trino (or Presto if you prefer the old name) is a technology providing a reading interface to different database technology. If you need to read the content of your system information in a unified way and with a single SQL like query engine Trino might be the right tool for you.</blockquote><h3>Introduction</h3><p>Every day an individual is producing an incredible amount of data.</p><p>We have literally never produced so much and the Metaverse has not become popular yet.</p><p>I always read sentences like the afore mentioned but lately I felt the need to crunch some numbers and I have decided to do some research.</p><p>One of the most interesting article I have read is written by Bernard Marr on Forbes with the title <a href="https://www.forbes.com/sites/bernardmarr/2018/05/21/how-much-data-do-we-create-every-day-the-mind-blowing-stats-everyone-should-read/?sh=31ef7b9460ba">“How much Data do we create every day? The Mind-Blowing Stats Everyone should read”.</a> We are producing 2.5 quintillion bytes of data every day and the pace is still growing, the “gradient” is still positive and quite big.</p><blockquote>Over the last two years 90 percent of the data in the world was generated.</blockquote><p>This one was hard to digest.</p><p>Talking big number is not always easy to internalize but I think this sentence alone give us a good idea of how much Big Data is Big.</p><p>Feel free to scroll the article for some other interesting stats:</p><ul><li>Google: 40.000 searches per second</li><li>Social Media: 456.000 tweets every minute</li><li>YouTube: 4.146.600 users watch videos every minute</li><li>Telecom: 16.000.000 messages sent every minute</li><li>IoT: from 2 billion to 200billion in 16 years (if you are interested on this surprising number check the <a href="https://medium.com/datareply/what-is-edge-intelligence-97d63a8f2ece">article</a> on Edge Intelligence)</li></ul><p>If those data are not enough check the <a href="https://www.domo.com/learn/infographic/data-never-sleeps-8">infographic</a> from Domo’s Resource Center about Data Never Sleep 8.0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M-HodulYk_LevUOEiVbt4Q.png" /><figcaption><a href="https://www.domo.com/learn/infographic/data-never-sleeps-8">infographic</a> from Domo’s Resource Center about Data Never Sleep 8.0.</figcaption></figure><p>You might have this question floating around in your mind:</p><p><em>What are we even doing with those Zettabytes of data?</em></p><p>One simple answer is that we store those data for real time or batch analysis.</p><p>To put it simpler we want to extract the juice from this row data: the information we need.</p><p>The increase in the amount of data produced leads to an increase in the complexity of the system needed to analyze it. Nowadays architectures are not an easy topic to grasp; we have Data lakes, Datawarehouse, <a href="https://medium.com/datareply/moving-from-data-lakes-to-data-mesh-why-companies-will-continue-to-decentralize-their-data-d7d1385b4861">Data Mesh</a> and the list might grow even longer.</p><p>What you need to take away is that, at some point, we have a database.</p><h3>How to store data effectively?</h3><p>Databases are like little atomic components in complex data platforms.</p><p>Some twenty to thirty years back it was way easier: the choice was very limited.</p><p>But now? You could spend a year trying to benchmark and understand what database suits better your use case and even with that time frame you could end up choosing the wrong one.</p><p>Why is it so difficult to choose a database?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*GpuKUmvsde00DDxJtgpipA.jpeg" /></figure><p>To be honest with you I think this is a wrong question you are asking to yourself.</p><p>Let’s try and dig a bit deeper in this data journey.</p><p>Let’s pretend that data could be stored in a physical place: let’s say you are storing data in wine barrels. You have produced our first petabyte of data; you are very pride of your organization making it to produce enough data to call it BIG (we will see if in 5 years we can still call a Petabyte this way). However, you want to save space in the warehouse: wine barrels are becoming too expensive to maintain and you would like to store data somewhere else.</p><p>You care about your data, you don’t want to change its place again, because you know that is a complex process, so you start wondering:</p><p>“How should I store my data?”</p><p>This is an interesting question.</p><p>You come up with a great intuition: storing also involve using.</p><p>Like a chef in his/her kitchen you would like to have your most useful tools close to the action.</p><p>Storing data highly depends on what you want to do with this data. Now you are left with a more difficult question to answer:</p><p>“What do you want do with your data?”</p><p>Different use case, different use, different storage.</p><p>I know it’s complicated, but do you remember the stats?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*ddLWk_iMFMJY2Jf4bbX58Q.jpeg" /></figure><p>It’s just the way it is, nowadays we are solving problems from domains we did not even know they would exist.</p><p><a href="https://medium.com/u/df4b39a6f082">Md Kamaruzzaman</a> reports:</p><p><em>There are </em><a href="https://towardsdatascience.com/top-10-databases-to-use-in-2021-d7e6a85402ba"><em>343 database technologies.</em></a></p><p>In the list we see MySQL, Postgres, MongoDB, Redis (if you want to try Redis out in an cloud-native serverless environment without effort take a look to this other <a href="https://medium.com/datareply/redis-streaming-playground-a-free-ticket-4af5d7f7f9b0">article</a> I wrote) and many others. I have asked the author where the 343 number comes from, but he has not answered yet, I will keep you posted.</p><p>Anyway, your organization needs an answer, the wine barrels are expensive, and you want to empty them so that you can get rid of it.</p><p>You don’t have one year to carefully benchmark the different options so what you do is simply choosing the most popular. With the time passing and with more experienced in the field you will realize that one DB is not enough, and your company will purchase another two or three different technologies in the following 5 years.</p><p>There is no one to blame for it, such things simply happen:</p><ul><li>You could be victim of very skilled salespeople</li><li>The use case might change and evolve over time</li><li>The CTO changes and so does his personal preference on how to handle data flow</li><li>Different tech teams may have different development preferences</li><li>The tech market is also exposed to fashion, so you decide to try the new holy grail of database</li></ul><p>It does not matter how but you have different techs, different API, different query languages. You wish you kept those wine barrels.</p><p>You have no idea about how to read all the data sources with a single tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/335/1*2ZNLWwY69dvJh9pmKuMMTA.png" /></figure><h3>Trino</h3><p>In this context you maybe have heard about Apache Presto or Trino.</p><p>Apache Software Foundation is a nonprofit open-source foundation whose mission is to let the open-source software service even if the contributors may change in time, if you are curious about the different product they are currently managing take a look <a href="https://www.apache.org/index.html#projects-list">here</a>.</p><p>From the website we get the first definition of Presto:</p><p><a href="https://prestodb.io/what-is-presto.html#why_presto"><strong>Fast and reliable SQL </strong></a><strong>query engine for data analytics and the open lakehouse</strong></p><p>Let’s break it down into different pieces:</p><ol><li>Data analytics: The core idea is to have a single layer and a single tool for data reads.</li><li>Fast and Reliable: the ability of reading should be performant and reliable since in production the load can be very heavy. Scalability and flexibility are a must in IT.</li><li>SQL query engine: were you asking for a single query engine? SQL available for you</li><li>Open Lakehouse: this is just a new hybrid term that bounds together the concept of Data Lake and Datawarehouse, most probable a catchy hot word in data marketing.</li></ol><p>Thanks to Presto you have unique interface and a unique language to extract your data, in this way you could easily achieve data analytics when different techs are used by your organization.</p><p>The same tool offers reporting and dashboarding features that could serve BI business intelligence.</p><p>If you are curios and you want to give it a try you can import it as a maven dependency in your IDE following the official <a href="https://github.com/prestodb/presto">documentation</a> hosted in GitHub.</p><p>If you already have a k8s cluster and you would like to benefit from the ready-made containerized version, take a look to the <a href="https://github.com/prestodb/presto-kubernetes-operator">operator</a>.</p><p>If you have any question, feel free to reach out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72e1119006e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Edge Intelligence?]]></title>
            <link>https://medium.com/datareply/what-is-edge-intelligence-97d63a8f2ece?source=rss-ac1c5199a468------2</link>
            <guid isPermaLink="false">https://medium.com/p/97d63a8f2ece</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[edge-computing]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[edge-ai]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Antonio Di Turi]]></dc:creator>
            <pubDate>Mon, 07 Nov 2022 07:55:19 GMT</pubDate>
            <atom:updated>2022-11-23T13:57:16.388Z</atom:updated>
            <content:encoded><![CDATA[<p>Post co-author: <a href="https://medium.com/u/625dd8c01987">Zanita Rahimi</a></p><p>What is Edge Intelligence? This sounds like an easy question but it’s not easy to answer when some of the conceptual requisites are not clear.</p><blockquote>The TL; DR is the following:</blockquote><blockquote>Edge intelligence = Edge computing + Artificial Intelligence.</blockquote><p>In this article, we will try to give a detailed answer on how the state of the art has reached such practice, together with some use cases directly from the field.</p><h3>Introduction</h3><p>The data world is continuously changing. Back in the days when we needed a whole room to process 10–20 MB of data, nobody had an idea of what the tech industry was about to become.</p><p>Over the years computers have become more and more powerful and engineers have done a great job in both decreasing the amount of energy needed and increasing memory and disk size.</p><p>It is still debated whether the famous Moore’s Law will last in the current century or not, but this gives us a great opportunity to introduce today’s topic.</p><p>Since the number of transistors in a chip has doubled roughly every two years in the last 60 years, whereas the cost has been halved at the same time, we understand how good humans have been in designing good hardware and therefore how cheap and easy is to run workloads on a mini server.</p><p>Having these developments in mind, it’s not so surprising that smartphones nowadays have more RAM than some of the laptops in the market 10 years ago. Installing small computing hardware equipped with internet connections has become more and more affordable and that’s why different companies have invested in this new technology called Edge Computing.</p><p>In order to understand Edge Computing, we should know how computing works in a centralized environment, and what problems are related to such architecture.</p><p>Centralized topologies gather data from different sources, you can think of them as different sensors. Nowadays you can find such sensors everywhere: in a smart home, in a smart car, or in an industry storing and computing data in a single location, often being the cloud.</p><p>This architecture, however, faces some challenges:</p><ul><li>Increased latency — since the network traffic is going in a single direction</li><li>Lack of resources</li><li>Difficulties in architecting a data platform that is efficient enough to organize data coming from different sources.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*-e8Ppae7CVIL0VIA8LZ0tg.png" /><figcaption>Centralized architecture — Image by Author</figcaption></figure><p>Let us walk you through an example that emphasizes the importance of edge computing. Consider an application that provides <strong>face recognition</strong> services. Before the edge computing era, the image of the person that the application is trying to recognize must travel to a hidden main server, where the algorithm is executed, and the response travels back as soon as the processing is done.</p><p>All this process can also happen <strong>closer</strong> to where the data is generated — <em>your phone</em>, thanks to edge computing.</p><p>With the concept of Cloud Computing clearer, it should not be too difficult to understand what Edge intelligence means. An example has been already provided: that facial recognition algorithm running on your smartphone is an example of an <strong>Edge intelligence application</strong>. The phone is an <strong>edge device</strong>, namely a piece of computing hardware close to the action (the face of the person whose identity is needed), which is running an AI algorithm.</p><blockquote>Edge computing + Artificial Intelligence = Edge Intelligence</blockquote><p>As an end to this introduction section, we would like to clarify that there are different names in the literature addressing the same technology: ML Edge Computing, Edge AI, AI at the Edge, etc.</p><p>Luckily in this case changing the order of the operands does not change the result, the concept stays the same. In this article, the term <strong>Edge Intelligence</strong> will be used.</p><h3>Fog computing, Cloudlet Computing, Edge computing</h3><p>In computing history, a lot of shifts in the paradigms have been seen. It all started with a single big main frame in the 60/70s, then slowly those monoliths were connected thanks to the internet and then we realized that in order to perform more complex workloads, we needed more computing power.</p><p>The <strong>cloud computing</strong> era was starting. We started building, designing and optimizing data centers. We came back to big rooms full of hardware but this time the amount of data processed increased enormously. With the rising popularity of artificial intelligence in technologies such as machine learning, deep learning, and <strong>AI</strong>-related applications, the need for computation power kept increasing so much that the network resources proved to be a bottleneck. The <strong>low latency</strong> communication requirement of smart vehicles or smart industries pushed the research over its own limits. As mentioned in the introduction, the aim of edge computing is to overcome these challenges.</p><p>The way that the different layers of IoT devices are organized, the different communication protocols they use, and the network used, leads to <em>different types of architectures</em>. In the literature we can find three main categories:</p><ul><li>Fog Computing</li><li>Cloudlet computing</li><li>Edge Computing</li></ul><h4>Fog Computing</h4><p>Fog computing introduces a middle layer between the edge devices in the cloud.</p><p>The objective is to <strong>reduce</strong> the amount of information reaching the cloud at the same time. The middle layer is composed of different nodes, devices, and gateways closer to the edge but not necessarily on the sensor itself.</p><p>The role of such a layer is to store and <strong>precompute</strong> part of the data easing the Cloud job.</p><p>Less data would reach the main server, less network resources would be used and therefore the latency should be reduced.</p><p>Fog nodes compose a distributed architecture and usually sit closer to the sensors: this reduces both the response time of the application and offers better privacy since part of the data can be analyzed separately before sending them into the cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*BH2DM9N3c1howBs6e1iRsw.png" /><figcaption>Fog computing architecture — Image by Author</figcaption></figure><h4>Cloudlet computing</h4><p>The cloudlet concept is like fog computing but not quite the same.</p><p>We always have a three-tier architecture with the cloud at the top and the edge devices at the bottom, just the middle layer changes.</p><p>We don’t have nodes but a scaled-down version of a data center.</p><p>Similarly to fog computing, better performances are achieved by introducing intermediate computing layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*vIBz4Xi2TBpjvPqO1LaYRw.png" /><figcaption>Cloudlet computing architecture — Image by Author</figcaption></figure><h4>Edge Computing</h4><p>Edge computing can be considered as a subset of fog computing where the computation happens on the edge devices themselves. With this technology, the data is first processed in place and sent instantly to the cloud, with a tremendous performance gain in real-time scenarios.</p><h3>Edge Intelligence</h3><p>Now that edge computing as a concept is clear, understanding edge intelligence is straightforward. The edge computing architecture uses edge devices to perform computations, if the algorithm belongs to the AI family, we can talk about edge intelligence. Federated learning, embedded AI, and coordination mechanism are just a few keywords around this topic but till now we have made enough abstract examples, let’s deep dive into some real use cases.</p><h3>Edge Computing Use Cases</h3><h4>Video Analysis</h4><p>Video analysis is about understanding the scenes that are captured by multiple cameras, and often this process must be efficient, low-latency, and real-time. As mentioned in the previous section, video feeds cannot be efficiently analyzed in a cloud computing architecture. These challenges can be easily met by using an edge architecture, and we will see use cases from different domains in the following paragraphs.</p><h4>Data Reply’s Demo — Object detection in real-time data on edge devices</h4><p>There are specific workloads that can be run on Cloud and others on Edge, and we will discuss more of this in the next article of this mini-series. But we can also benefit from something called a hybrid solution.</p><p>Hybrid cloud and edge solutions offer unmatched flexibility, value, and security for enterprise computing applications; therefore, we treated Edge Computing as an extension of the Cloud while exploiting the benefits of both worlds, for building a demo that performs video analysis.</p><p>We built an image recognition system that predicts certain categories of objects in a video stream with low latency. The Edge Cluster consists of 4 Raspberry Pi nodes where the video stream is read and sampled into images for our image recognition system, which returns the prediction results, while the analytics and long-term storage are offloaded to the Cloud.</p><p>This is an end-to-end product that includes:</p><ul><li>Object detection in video streams,</li><li>The discarding of similar frames (stateful stream processing),</li><li>Long-term storage for backup and compliance purposes,</li><li>Ad-hoc Real-Time, and Hybrid Queries</li></ul><p>Such a solution can be used for different use cases which are elaborated on in the following sections. One of the use cases can be seen in manufacturing, where edge-enabled smart cameras can scan the barcodes of each pallet to keep track of what stock has been processed in each micro-location, thus speeding up warehouse processes.</p><p>If you are interested in the technical details of the system’s architecture that has been developed, you can read more in the <a href="https://medium.com/datareply/machine-learning-on-streaming-data-run-on-the-edge-using-k3s-seldon-core-kafka-and-fluxcd-c191e0a08a26">dedicated blog post written</a> by <a href="https://medium.com/u/13ec24049567">Tayfun Wiechert</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*ctxflf1FOPUy9b-nrnAJig.jpeg" /><figcaption>Our edge cluster connected to the 4G router</figcaption></figure><h4>Transportation Logistics</h4><p>With a similar setup, a wide variety of use cases in transportation logistics can be covered. Examples include:</p><ul><li>Predictive maintenance — if an issue is detected, a notification can be sent to the responsible parties, who can then ensure that the issues will be resolved.</li><li>Driver performance &amp; traceability — to identify the total kilometers driven, and the number of stops.</li><li>Tracking of objects — by using CNN (Convolutional Neural Networks) logistics objects can be identified and localized.</li></ul><h4>Autonomous Driving</h4><p>How do you tell an autonomous car where to go? Autonomous vehicles use sensors to determine exactly where they are on the planet and where they want to go. When an obstacle is encountered, the vehicle starts sending its lidar and cameras data waiting for clearance. The amount of data generated is enormous.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*hN8uhF4rhS1GzMedKgt3og.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@isthatbrock?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Brock Wegner</a> on <a href="https://unsplash.com/s/photos/self-driving-car?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>A Stanford seminar published data from an autonomous vehicle at Nissan consisting of 15 cameras, 2 lidars, 1 radar, 1 GPS, and 1 CAN. The total data output was 140,235 MB /s. With simple calculations we get:</p><ul><li>1 Minute -&gt; 10 GB</li><li>10 Minutes -&gt; 100 GB</li><li>1 Hour -&gt; 500 GB</li><li>24 Hour -&gt; 12TB</li></ul><p>A huge amount of the generated data is transient, so we do not have to save them in cloud data centers. Also, we do not have the commodity of doing that both in the speed and storage space aspects. This use case is not possible without edge capabilities because of the low latency needed to analyze data and return instructions immediately to function safely.</p><p>Some researchers proposed a methodology where they cache the content needed in self-driving cars.</p><p>And why do we need to cache the content in such setups? Well, edge devices might need to upload video/image content to edge servers for further processing. By making use of caching, they can upload only different pixels or frames, and for repeated scenes, they can reuse the results thus avoiding unnecessary computations.</p><p>With 97.82% accuracy in predicting what needs to be cached, this approach can minimize latency brought on by a multi-edge architecture for autonomous vehicles.</p><h4>Manufacturing</h4><p>The low latency enables immediate response to problems on assembly lines, improving quality &amp; efficiency, detecting production errors, improving communication and interaction between machines, reducing energy consumption, planning manufacturing processes, allocating resources, etc.</p><p>One other application of edge computing that our clients seem to be interested in is the ability to track the inventory, by monitoring the stock, where the inventory is located, and what quantities are available. Real-time inventory tracking, which is a crucial component of the supply chain, can be tackled with an edge-computing solution and the low latency offered by it.</p><h4>Smart Grid</h4><p>Smart Grid uses a broad range of resources to deliver electricity to millions of households, thus reducing energy wastage and cost. Processing and analyzing the edge servers and their power consumption let us have a real-time system that can prevent transmission line faults.</p><p>The use cases would include smart monitoring of the grid status &amp; predictive maintenance, load forecasting (demand management and prediction) &amp; production optimization.</p><h4>Cloud Offloading</h4><p>Network-connected technologies such as portable devices, PCs, smartphones, etc., must have low-latency and real-time processing capabilities.</p><p>To improve the request-response time, we can utilize edge devices to offload the workload by caching either the data or the operations that are to be performed, which is exactly what we at Data Reply did in our demo. Object detection logic is running on our edge cluster, while the real-time dashboard presenting the recognized items runs in the cloud.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97d63a8f2ece" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datareply/what-is-edge-intelligence-97d63a8f2ece">What is Edge Intelligence?</a> was originally published in <a href="https://medium.com/datareply">DataReply</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redis streaming playground: A free ticket]]></title>
            <link>https://medium.com/datareply/redis-streaming-playground-a-free-ticket-4af5d7f7f9b0?source=rss-ac1c5199a468------2</link>
            <guid isPermaLink="false">https://medium.com/p/4af5d7f7f9b0</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[streaming]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Antonio Di Turi]]></dc:creator>
            <pubDate>Fri, 21 Oct 2022 13:34:31 GMT</pubDate>
            <atom:updated>2022-10-24T10:49:29.133Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we are going to explain and publish an AWS-based, quasi-serverless Redis playground. It all started as an internal project, and we thought in collaboration with Redis that it was worth sharing it. At Data Reply innovation and sharing are part of our core values, and we truly hope you will find our work interesting and useful. Feel free to contact us with any questions/requests to collaborate.</p><h3>What we do at Data Reply DE</h3><p>At <a href="https://www.reply.com/data-reply/de/">Data Reply DE</a> our job is to find innovative solutions to the technologically demanding requirements of some of the biggest industries in Germany. Some of the biggest players in the automotive, manufacturing &amp; retail, and telecommunications industries have a huge Tech stack and it is our pleasure to propose the best practices applied in the Big Data World.</p><p><strong>Best practices, however, are not static</strong>.</p><p>New technologies are developed every day and being informed on every paradigm or framework is a challenge that nobody can face alone.</p><p>That’s why here at Data Reply, each employee is allowed to take out 10 working days per year to learn about new technologies. During my first year, I had the opportunity of learning and achieve different tech certifications: K8s (<a href="https://www.cncf.io/certification/cka/">CKA</a> and <a href="https://www.cncf.io/certification/ckad/">CKAD</a>), <a href="https://www.confluent.io/certification/">Confluent for Apache Kafka</a> (CCDAK and CCAAK), AWS (<a href="https://aws.amazon.com/certification/certified-solutions-architect-associate/">Solution architect Associate</a>), and <a href="https://university.redis.com/certification/">Redis Developer</a>.</p><p>Saving some working time to stay up to date is not always easy and I truly hope those few pages may help you to get started in the Redis Streaming world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*5X9w3xkd7k3NRrGUGQbDcA.png" /></figure><h3>Discover Redis</h3><p>Nowadays every Big Data Engineer has heard about Redis: its efficiency and availability may be some of the reasons why this name can be found under large companies’ tech stack, however, the reasons are many more and we were interested in discovering them.</p><p>But what is Redis in the first place? What does this name even mean?</p><p>Redis = ReDiS = Remote Dictionary Server</p><p>So, we have a dictionary.</p><p>This dictionary is an abstraction for a key-value database.</p><p>The dictionary is also remote, which means it may run on a different server, or on a different instance. What you already may know is that Redis is running on memory to guarantee faster lookups and updates. But Redis is not just that. The in memory-database company offers a wide variety of services including <a href="https://redis.com/redis-enterprise-cloud/overview/">Redis Cloud</a> an enterprise tool that helps you to build Redis-based apps faster across different cloud providers.</p><p>Amongst other features, it offers an intuitive data structure that does not require you to invest hours in studying the documentation: easy to install, easy to use, and lightweight.</p><p>The list of pros is already long and that’s why we were so curious about it.</p><p>None of my words would beat your own experience so let’s try something together. Visit one of the pages about the command line documentation: let’s say we want to know how the <a href="https://redis.io/commands/append/">append</a> command works.</p><p>At the bottom of the page, you would find an embedded Redis server ready for you to experiment with the command: if you have any doubt about a corner case jumping out in your head just try it out there on the online doc page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*gaK-GZppNe1NEf-i8IjpvA.png" /></figure><h3>Redis Streaming</h3><p>Data Reply is subdivided into BU (business unit): you can think of a business unit as a team of 20 people with a layer of managers. Our BU focuses on <strong>Streaming</strong>: 90% of our projects use Apache Kafka and it has been a while since we wanted to try out some new frameworks.</p><p>The in-memory database’s promising Streaming features described in the <a href="https://university.redis.com/courses/ru202/">RU202</a> course at Redis University attracted us and we decided to put the newly acquired knowledge into practice in an internal project.</p><p>The first idea was to build a playground ready to be used by our colleagues.</p><p>Our wish was that whoever wanted to experiment with Redis in a real scenario could do it <strong>without wasting time</strong> in the setup.</p><p>In a tech world more and more oriented to Platform Engineering, it was very clear that this could have been the first milestone in our discovery journey.</p><p>Using <strong>infrastructure as code</strong> our goals could be easily achieved, and I was so excited about building something that could save a lot of time for my colleagues.</p><p>Even if you are super interested in the topic, when the client deadline approaches and the project must be delivered, it is hard to think about how to wrap your head around how to set up the right AWS policies to access the s3 bucket or the Redis instance using Lambda.</p><p>In the following paragraphs, we are going to describe how we automated all those solutions in a ready-to-be-used Redis Streaming playground. In our project we often work with Terraform and being an explorative journey, we decided to try out <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacks.html">Stack Formation</a> from AWS.</p><p>I know it is not the most popular tool for infrastructure as code, but we just wanted to have an insight. It is indeed tough to judge what you don’t know, and you cannot take your tech decision based on review only.</p><p>Maybe in the future, we will publish a detailed comparison between the different infrastructures as code tools but that would be out of the scope of today’s article.</p><h3>Infrastructure</h3><p>In Germany, there is a proverb saying “Lange Rede, kurzer Sinn”: the translation would sound something like “long speech, shorter meaning”, so enough <em>Bla-Bla </em>and<em> </em>let’s see the details of the <a href="https://github.com/DataReply/redis-streaming-playground">project</a>.</p><p>To download the playground just execute the following command</p><pre>git clone <a href="https://github.com/DataReply/redis-streaming-playground.git">https://github.com/DataReply/redis-streaming-playground.git</a></pre><p>The general idea is to build a <strong>consumer-producer</strong> scenario: something simple that could be used as a building block for further development.</p><p>On top of that, we provided a couple of use cases just to give an overview of Redis&#39;s capabilities.</p><p>Below you can find a picture of the architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*rFbKXYmD7BEnFZ1mwAMDJA.jpeg" /><figcaption>high-level architecture</figcaption></figure><p>As a source, we loaded the datasets in an S3 bucket.</p><p>The consumer and producer code can be found in two different Lambdas using a python client.</p><p>Python clients often need libraries and we decided to zip those as described in the AWS <a href="https://docs.aws.amazon.com/lambda/latest/dg/python-package.html">documentation</a>. A future version will substitute zipped files with a Docker image.</p><p><strong>The objective here</strong> <strong>is not to reproduce a production-like scenario</strong> but to give our consultants the chance to play with the tech and see how it works: a Lambda seemed to be an interesting solution.</p><p>Between the two we have our streaming engine: a Redis instance.</p><p>As a final step, we wanted some visualization tool that could be used in a flexible and extendible way, therefore we decided to use <a href="https://opensearch.org/">OpenSearch</a>.</p><p>Since the infrastructure and the application are meant to be <strong>decoupled</strong> by the need of building different use cases (different consumers and producers) we decided to split the CloudFormation files in two.</p><p>The first file I am going to show is the one building the infrastructure side, no surprises, it is called infrastructure.yaml.</p><p>In this <a href="https://github.com/DataReply/redis-streaming-playground/blob/main/cloud-formation/infrastructure/infrastructure.yaml">file</a> we are going to tell the AWS CloudFormation tool to build the main components:</p><ul><li>Network: Main subnet, Public subnets, Private subnets, Public, private route table, NetGateway, Route table associations, and everything that is needed for connectivity. Just little modifications were made with respect to the <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/cloudformation-vpc-template.html">template</a> gently published by AWS, no need to reinvent the wheel, let’s sit on giants’ shoulders</li><li>Elasticache Redis: security group, subnet group, cluster</li><li>OpenSearch:Access policies,Cluster</li><li>Lambda Role: access to the s3, access to the VPC, access to Redis, access to Open Search</li></ul><p>One of the main pros of CloudFormation is that the documentation and the naming convention used to define the properties are <strong>intuitive</strong> and are capturing well what is going to be created by the infra-as-software tool.</p><p>Anyway, once again, if some doubts/suggestions come up while reading the code or if something is not clear <strong>don’t hesitate to reach out</strong> and we will be happy to clarify the questions or modify the template according to your proposals.</p><p>The code gives all the details needed to instantiate the components and allow communication between the involved parts. In the picture below you can find a more detailed overview of the architecture used for this project comprehensive of VPC and subnets in AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*bOYdk9ytDxN1QgSUUPDgbA.png" /><figcaption>Architecture and network design</figcaption></figure><p><strong>We did not follow all the best security practices</strong> in this use case since the objective is not to create a prod-like environment but to ease the life of the developers willing to try out the streaming feature. However, we still wanted to use private subnets for the lambdas to reach the internet connection through the public subnets.</p><p>For the same demo reason we opted for the smallest instance available in the AWS catalog, this allows everybody to make his trial with the cheapest possible price. For being precise the instance selected is the cache.t2.micro</p><p>If you want to save even more money, we advise deleting the OpenSearch section from the YAML file. In this way, you will not have a fancy UI, but sometimes pure logs are more than enough.</p><p>In the output section of the infrastructure.yaml we declared:</p><ul><li>the OpenSearch domain</li><li>the Redis endpoints</li><li>The VPC id and the subnets ids</li></ul><p>Most of the output is needed for the Lambdas setup.</p><h3>Use case — Prerequisites</h3><p>We will assume that you have an AWS account setup.</p><ol><li>Download the dataset from the GitHub repo and load the dataset into s3</li><li>Download the producer/consumer zips from the repo and put them into the same bucket</li><li>Follow the README.md in the <a href="https://github.com/DataReply/redis-streaming-playground">GitHub repo</a> to set up the stack</li></ol><p>The reason why we used zips and not Dockerfile was to save you some time. This way you should only download the zip with the python libraries and upload it in the s3 bucket whereas with the Dockerfile you would have needed to build a tag and push the image to the ECR registry. This way we have saved you the trouble of creating the ECR repo and pushing the image there.</p><p>Our advice is to pull the repo and upload the YAML defining the infrastructure (infrastructure.yaml) into CloudFormation (detailed instructions on how to do it in the repo’s README) so that it’s easier to apply any modification (like deleting the OpenSearch component).</p><p>The other option would be to load the definition file in the s3 bucket but that is suggested for more static scenarios and not dynamic demos.</p><h3>Use case</h3><p>In our first use case, we used a Smart Home dataset that we found for an online challenge (<a href="https://debs.org/grand-challenges/2014/">here</a> you find a detailed description and schema).</p><p>The dataset contains measurements for different plugs installed in 40 houses.</p><p>Events with the same timestamp are ordered randomly with respect to each other.</p><p>At this point it should be clear that it’s not our priority to work with a huge dataset, we just want some data to play with.</p><p>In the first use case, the objective is to visualize the houses’ energy consumption at different hours of the day. The schema has one attribute called property: this property is called 0 for the “work” data, the cumulative one in KWh, and 1 for the “load” data better for capturing smaller amounts of used energy.</p><p>Below you can find the code for python’s “producer” script which does the following:</p><ul><li>Reads data from the s3 bucket</li><li>Produce all the data into Redis</li></ul><p>The command used to add the data into Redis is called <a href="https://redis.io/commands/xadd/">XADD</a>.</p><p>All the commands with an “X” prefix are related to streaming.</p><p>The command takes inputs a key and a message.</p><p>As we stated in the introduction, Redis is a key-value datastore, that’s why every command that is producing or consuming a data structure uses a key.</p><p>Consider the key as the “address” of the data we want to find.</p><p>The XADD command appends the message to the stream entry at the specified key, when a new key is provided a new stream is generated but stream auto-creation can also be simply disabled using the NOMKSTREAM option.</p><p>For more deep details about how the command works, it is to check the doc.</p><p>In the same YAML template, you can find the consumer code.</p><p>The consumer does the following:</p><ul><li>Reads the data from Redis one message at a time</li><li>Filters for the load data</li><li>Produce the data into Open Search</li></ul><p>Please note that neither the producer nor the consumer is meant to be professional, they are just a ready-to-go code meant for you as a starting point. Feel free to modify it.</p><p>In OpenSearch, we aggregate data by the hour and display the average Watt Usage into a bar graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*DNejGvnALrHCh0AIKqZYCg.png" /><figcaption>Average Watt usage per hour</figcaption></figure><h3>Next Steps</h3><p>With the example above we just wanted to show what is possible with this architecture.</p><p>In the <a href="https://github.com/DataReply/redis-streaming-playground">GitHub repo</a>, you will find instructions on <strong>how to reproduce</strong> the same use case step by step. You will also find code related to different use cases. Feel free to try them out.</p><p>In our project, we used building blocks from different sources and we bound them together: <strong>we strongly hope that this project could be another of those blocks for one of you</strong>.</p><blockquote>Our final take about our Redis journey is overall very positive.</blockquote><p>The architecture can be the first step to designing a solution for different use cases we have already implemented like event handling, data augmentation, real-time processing, and so on.</p><p>As an example by substituting the Open Search block with another s3 bucket some real-time processing or data augmentation can be done with lambdas. If more hardware and computing time are needed the lambdas can be substituted with EC2.</p><p>It’s clear that Redis is trying to play the “Kafka role” in this setup.</p><p>Redis offers streaming features like consumer groups in an intuitive way, it may be also already present in the tech stack of a company so it may be easier for a developer to use it as a streaming hub.</p><p>It will be our pleasure to deepen the analysis and understand better which tool is best suited for which use case.</p><p>Some of the next steps could be the following:</p><ul><li>Handling data with an external Schema using <a href="https://redis.io/docs/stack/json/">RedisJSON</a></li><li>New production-like infrastructure with k8s configuration</li><li>New infrastructure optimized from the security best practices</li><li>Stretch and test read/write Redis performances with some heavier use cases</li><li>Add other use cases</li></ul><p>Let us know what may interest you most.</p><p>This post is in collaboration with Redis.</p><p><strong>Learn more:</strong></p><p>· <a href="https://redis.info/3NBGJRT">Try Redis Cloud for free</a></p><p>· <a href="https://redis.info/3Ga9YII">Watch this video on the benefits of Redis Cloud over other Redis providers</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FvyxdC1qK4NE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DvyxdC1qK4NE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FvyxdC1qK4NE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d54ea5168b7adc525bf75acc5c9a9cf9/href">https://medium.com/media/d54ea5168b7adc525bf75acc5c9a9cf9/href</a></iframe><p>· <a href="https://redis.info/3LC4GqB">Redis Developer Hub — tools, guides, and tutorials about Redis</a></p><p>· <a href="https://redis.info/3wMR7PR">RedisInsight Desktop GUI</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4af5d7f7f9b0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datareply/redis-streaming-playground-a-free-ticket-4af5d7f7f9b0">Redis streaming playground: A free ticket</a> was originally published in <a href="https://medium.com/datareply">DataReply</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>