<?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 abhishek gaddhyan on Medium]]></title>
        <description><![CDATA[Stories by abhishek gaddhyan on Medium]]></description>
        <link>https://medium.com/@abhishekgadhyan?source=rss-1b0657f5a44e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*XfK0MLK_F7PkGVdJ.jpeg</url>
            <title>Stories by abhishek gaddhyan on Medium</title>
            <link>https://medium.com/@abhishekgadhyan?source=rss-1b0657f5a44e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 13:42:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhishekgadhyan/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[reparing for a Kafka interview?]]></title>
            <link>https://medium.com/@abhishekgadhyan/reparing-for-a-kafka-interview-2ea1c696543b?source=rss-1b0657f5a44e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ea1c696543b</guid>
            <dc:creator><![CDATA[abhishek gaddhyan]]></dc:creator>
            <pubDate>Sat, 11 Jan 2025 11:42:28 GMT</pubDate>
            <atom:updated>2025-01-11T11:42:28.518Z</atom:updated>
            <content:encoded><![CDATA[<p>Preparing for a Kafka interview?</p><p>A comprehensive list of important questions to sharpen your knowledge:</p><p>1. What is Apache Kafka, and what are its main components?<br>2. Explain Kafka’s architecture briefly.<br>3. What is a Kafka broker?<br>4. What is a topic in Kafka?<br>5. What is the purpose of partitions in Kafka?<br>6. Explain the role of ZooKeeper in Kafka.<br>7. What are producers and consumers in Kafka?<br>8. Describe a Kafka cluster.<br>9. What are consumer groups?<br>10. How does Kafka ensure message ordering?<br>11. What is an offset in Kafka?<br>12. How does Kafka handle data retention?<br>13. Explain “at least once” and “exactly once” delivery in Kafka.<br>14. What is Kafka Streams?<br>15. How does Kafka ensure fault tolerance?<br>16. What is log compaction?<br>17. Explain replication in Kafka.<br>18. What is an ISR (In-Sync Replica)?<br>19. How does leader election work in Kafka?<br>20. How do partitions help in Kafka scaling?<br>21. What is Kafka Connect?<br>22. How does Kafka ensure message durability?<br>23. What’s Kafka’s role in stream processing?<br>24. How is Kafka different from traditional messaging systems?<br>25. What is the replication factor?<br>26. How do leaders and followers work in Kafka replication?<br>27. How do consumers read data in Kafka?<br>28. What are producer acknowledgments?<br>29. What is the transaction API in Kafka?<br>30. Explain Kafka’s “exactly once” semantics.<br>31. How does Kafka manage backpressure?<br>32. What is <a href="http://linger.ms/">linger.ms</a> in Kafka producers?<br>33. How does Kafka handle message compression?<br>34. What is batch.size in producers?<br>35. How does Kafka handle consumer offsets?<br>36. What is auto.offset.reset in Kafka consumers?<br>37. How do rebalances work in consumer groups?<br>38. What is the purpose of the Schema Registry?<br>39. How does Kafka handle topic deletion?<br>40. Explain commitSync() vs commitAsync() in Kafka consumers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ea1c696543b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Data Pipelines with Kafka and Stream Processing Tools]]></title>
            <link>https://medium.com/@abhishekgadhyan/building-data-pipelines-with-kafka-and-stream-processing-tools-cbac9bd87e3f?source=rss-1b0657f5a44e------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbac9bd87e3f</guid>
            <dc:creator><![CDATA[abhishek gaddhyan]]></dc:creator>
            <pubDate>Sat, 11 Jan 2025 11:35:39 GMT</pubDate>
            <atom:updated>2025-01-11T11:35:39.943Z</atom:updated>
            <content:encoded><![CDATA[<p>Data pipelines are the backbone of real-time data processing, enabling organizations to move, transform, and analyze data quickly. <a href="https://kafka.apache.org/">Apache Kafka</a>, a popular distributed streaming platform, plays a pivotal role in building robust, scalable, and fault-tolerant data pipelines. In this post, we’ll explore how to use Kafka and various stream processing tools to build effective data pipelines. Our focus will cover everything from data ingestion to processing and storage, catering to users with beginner to intermediate knowledge and some insights for advanced readers.</p><p>Table of Contents</p><h3>What is a Data Pipeline?</h3><p>A data pipeline is a sequence of data processing stages that automate the movement and transformation of data from one place to another. Data pipelines typically include stages like ingestion, processing, and storage. Let’s break these down in terms of Kafka and other stream processing tools.</p><h3>Key Stages of a Data Pipeline</h3><ol><li>Ingestion: Collecting raw data from various sources.</li><li>Processing: Transforming and analyzing data.</li><li>Storage: Storing processed data for further analysis or consumption.</li></ol><p>Kafka excels as the data ingestion layer but can also play a role in the processing and storage stages, thanks to additional components like Kafka Streams and Kafka Connect.</p><blockquote><em>💡 Did You Know? Kafka’s distributed design allows it to handle millions of events per second, making it ideal for real-time data pipelines in large-scale applications!</em></blockquote><h3>Setting Up Kafka for Data Pipelines</h3><p>Before diving into data pipeline building, let’s set up Kafka as our backbone for data movement. Kafka’s distributed, durable nature provides a reliable foundation for capturing and transferring data in real-time.</p><h3>Kafka Configuration for High-Throughput Pipelines</h3><p>Kafka’s configuration plays a huge role in determining the performance and scalability of your data pipeline. Let’s focus on some essential settings.</p><pre>// Kafka server properties<br>broker.id=1<br>log.dirs=/var/lib/kafka-logs<br>num.partitions=6<br>log.retention.hours=72<br>log.segment.bytes=1073741824</pre><p>In this configuration:</p><ul><li>num.partitions optimizes parallelism by partitioning topics, essential for high-throughput pipelines.</li><li>log.retention.hours controls how long logs are kept, allowing storage management.</li><li>log.segment.bytes sets the size of each log segment to enhance read/write performance.</li></ul><h3>Stream Processing: Transforming Data with Kafka Streams</h3><p>Kafka Streams is a lightweight library that allows you to build real-time applications that react to, transform, and aggregate data within Kafka. Unlike traditional ETL (Extract, Transform, Load) tools, Kafka Streams processes data as it arrives, reducing latency.</p><h3>Example: Filtering Data Streams</h3><p>Imagine a data pipeline that filters out transactions based on a minimum threshold.</p><pre>// Define a filter for transactions over $1000<br>KStream&lt;String, Transaction&gt; transactions = builder.stream(&quot;transactions&quot;);<br>KStream&lt;String, Transaction&gt; largeTransactions = transactions.filter(<br>    (key, transaction) -&gt; transaction.getAmount() &gt; 1000<br>);</pre><pre>largeTransactions.to(&quot;large-transactions&quot;);</pre><p>This snippet reads from a Kafka topic transactions, filters transactions over $1000, and writes to a new topic, large-transactions. This transformation is useful in fraud detection and financial monitoring applications.</p><blockquote><em>💡 Fun fact: Kafka Streams is stateless by default, meaning transformations are applied to each record independently. However, it can also maintain state with tables for more complex operations like aggregations.</em></blockquote><h3>Using Kafka Connect for Data Ingestion and Export</h3><p>Kafka Connect simplifies integration with various systems, such as databases, cloud services, and analytics tools. It uses a plugin architecture where connectors handle data import (source connectors) or export (sink connectors).</p><h3>Example: Importing Data from MySQL with Kafka Connect</h3><p>Let’s walk through a common use case: streaming data from MySQL into Kafka for further processing.</p><ol><li>Install the MySQL source connector for Kafka Connect.</li><li>Configure the connector to pull data from a MySQL database.</li></ol><pre>{<br>  &quot;name&quot;: &quot;mysql-source-connector&quot;,<br>  &quot;config&quot;: {<br>    &quot;connector.class&quot;: &quot;io.confluent.connect.jdbc.JdbcSourceConnector&quot;,<br>    &quot;connection.url&quot;: &quot;jdbc:mysql://localhost:3306/my_database&quot;,<br>    &quot;connection.user&quot;: &quot;user&quot;,<br>    &quot;connection.password&quot;: &quot;password&quot;,<br>    &quot;mode&quot;: &quot;incrementing&quot;,<br>    &quot;incrementing.column.name&quot;: &quot;id&quot;,<br>    &quot;topic.prefix&quot;: &quot;mysql-&quot;,<br>    &quot;poll.interval.ms&quot;: 1000<br>  }<br>}</pre><p>In this configuration:</p><ul><li>connector.class specifies the JDBC source connector.</li><li>mode is set to incrementing, meaning data is pulled incrementally based on the column id.</li><li>topic.prefix ensures data from MySQL tables flows into Kafka topics prefixed with mysql-.</li></ul><blockquote><em>💡 Note: Kafka Connect is highly extensible, allowing you to build custom connectors for proprietary systems or rare data sources.</em></blockquote><h3>Enriching Data Streams with Stream Processing Frameworks</h3><p>While Kafka Streams handles lightweight transformations, other frameworks like Apache Flink and Spark Streaming bring advanced capabilities, such as complex event processing, windowed aggregations, and machine learning.</p><h3>Example: Real-time Data Enrichment with Apache Flink</h3><p>Suppose you have a stream of transaction data, and you want to enrich it with customer information from a database.</p><pre>val env = StreamExecutionEnvironment.getExecutionEnvironment<br>val transactions = env.addSource(new FlinkKafkaConsumer[String](&quot;transactions&quot;, new SimpleStringSchema(), props))<br>val customerData = env.addSource(new JdbcSourceFunction)</pre><pre>val enrichedTransactions = transactions<br>  .keyBy(_.customerId)<br>  .connect(customerData.keyBy(_.customerId))<br>  .flatMap(new EnrichmentFunction)</pre><pre>enrichedTransactions.addSink(new FlinkKafkaProducer(&quot;enriched-transactions&quot;))</pre><p>In this example:</p><ul><li>transactions stream is joined with customerData based on customerId.</li><li>The EnrichmentFunction adds customer details to each transaction, outputting enriched data to a new Kafka topic.</li></ul><blockquote><em>💡 Did you know? Flink’s unique stateful architecture makes it ideal for complex transformations where data needs to be enriched or aggregated across long time windows!</em></blockquote><h3>Monitoring and Scaling Data Pipelines</h3><p>Monitoring a Kafka-based data pipeline is essential for ensuring high performance and reliability. Kafka provides JMX metrics for monitoring various components like brokers, producers, and consumers.</p><h3>Key Metrics to Monitor</h3><ol><li>Consumer Lag: Indicates the delay in processing data.</li><li>Broker Throughput: Measures data flow rates to identify bottlenecks.</li><li>Error Rates: Helps detect issues in data ingestion and processing.</li></ol><h3>Scaling Kafka Pipelines</h3><p>Scaling Kafka pipelines typically involves adding partitions, adjusting configurations, and scaling consumer applications.</p><pre>// Adjusting consumer configurations for scalability<br>Properties props = new Properties();<br>props.put(&quot;bootstrap.servers&quot;, &quot;localhost:9092&quot;);<br>props.put(&quot;group.id&quot;, &quot;data-pipeline-group&quot;);<br>props.put(&quot;enable.auto.commit&quot;, &quot;true&quot;);<br>props.put(&quot;auto.offset.reset&quot;, &quot;earliest&quot;);</pre><pre>KafkaConsumer&lt;String, String&gt; consumer = new KafkaConsumer&lt;&gt;(props);<br>consumer.subscribe(Arrays.asList(&quot;transactions&quot;));</pre><p>In this setup:</p><ul><li>auto.offset.reset ensures the consumer starts from the beginning for new consumers.</li><li>group.id allows scaling by adding consumers to the same group, distributing data partitions among them.</li></ul><h3>Conclusion</h3><p>Building data pipelines with Kafka and stream processing tools like Kafka Streams, Flink, and Spark opens up numerous possibilities for real-time data processing. Whether you’re aggregating sensor data, processing financial transactions, or enriching data for machine learning models, Kafka-based pipelines offer scalability, fault tolerance, and near real-time capabilities.</p><p>In this post, we explored the components and techniques essential for building efficient data pipelines, from data ingestion to transformation and monitoring. By mastering these tools, you’ll be well-equipped to design and maintain data pipelines that can meet the demands of modern data-driven applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbac9bd87e3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>