<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mwirigi Eric</title>
    <description>The latest articles on Forem by Mwirigi Eric (@emwirigi).</description>
    <link>https://forem.com/emwirigi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3239782%2F299fa1e4-2f4a-4a29-97e3-29fdb85e8149.png</url>
      <title>Forem: Mwirigi Eric</title>
      <link>https://forem.com/emwirigi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/emwirigi"/>
    <language>en</language>
    <item>
      <title>Change Data Capture (CDC) in Data Engineering: Concepts, Tools and Real-world Implementation Strategies</title>
      <dc:creator>Mwirigi Eric</dc:creator>
      <pubDate>Thu, 18 Sep 2025 13:12:08 +0000</pubDate>
      <link>https://forem.com/emwirigi/change-data-capture-cdc-in-data-engineering-concepts-tools-and-real-world-implementation-feg</link>
      <guid>https://forem.com/emwirigi/change-data-capture-cdc-in-data-engineering-concepts-tools-and-real-world-implementation-feg</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is Change Data Capture?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;According to  &lt;a href="https://www.confluent.io/learn/change-data-capture/" rel="noopener noreferrer"&gt;Confluent&lt;/a&gt;, Change Data Capture is a process of tracking all changes occurring in data sources (such as databases, data warehouses, etc.),  and capturing them in destination systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why CDC Matters in Data Engineering?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;CDC eliminates Bulk Load Updates by enabling incremental loading/real-time streaming of data changes to target destinations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It enables Log-based Efficiency by capturing changes directly from transaction logs, thus reducing system resource usage and ensures performance efficiency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Facilitates real-time data movement, ensuring zero-downtime database migrations. This ensures that up-to-date data is available for real-time analytics and reporting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CDC enables seamless synchronization of data across systems, which is crucial for time-sensitive decisions in high-velocity data environments.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How Does CDC Work?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that we have a grasp of what CDC is and why it matters, it's crucial to explore how it essentially works so as to have an even better understanding.&lt;/p&gt;

&lt;p&gt;Firstly, CDC can be initiated in two approaches i.e &lt;strong&gt;Push&lt;/strong&gt; and &lt;strong&gt;Pull&lt;/strong&gt;. In the &lt;strong&gt;Push&lt;/strong&gt; approach, a source system sends/pushes data changes into a target system(s), whereas, in the &lt;strong&gt;Pull&lt;/strong&gt; approach, the target system regularly polls a source system and "pulls" all identified changes.&lt;/p&gt;

&lt;p&gt;Therefore, CDC works by identifying and recording change events happening in various data sources (such as databases), and transferring these changes from the source system in real-time/near real-time to a target system such as a data warehouse or a streaming platform e.g. Kafka.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CDC Implementation Methods/Patterns&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CDC implementations can be accomplished through the following methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Log-based CDC:&lt;/strong&gt; In this method, a CDC application processes the changes recorded in the database transaction logs, and shares the updates with other systems. This method is suitable for real-time data synchronization since it offers low latency and high accuracy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Trigger-based CDC:&lt;/strong&gt; In this method, triggers are executed once specific modifications occur in a database, and  the changed data is then stored in a change/shadow table. The method is simple to implement, however, it burdens source systems since triggers are activated each time a transaction happens in the source table.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Time-based CDC:&lt;/strong&gt; Changes are identified by polling a timestamp column in the source database, and the updates delivered to target system(s). Time-based CDC is easier to implement, however, it puts additional load on a system timestamp polling occurs frequently.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;CDC Tools&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Basically, a CDC tool automates the tracking and replication of changes across systems, by detecting data modification (&lt;em&gt;updates, deletion or addition&lt;/em&gt;)  and replicating them to a target database or system.&lt;/p&gt;

&lt;p&gt;There are several tools that can be adopted for CDC implementation, such as Rivery, Hevodata, Debezium and Oracle, each with different capabilities. This article will focus on &lt;strong&gt;Debezium&lt;/strong&gt;, and how it can be used for CDC integrations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; &lt;strong&gt;Understanding Debezium&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;From the official documentation, &lt;a href="https://debezium.io/documentation/reference/stable/index.html" rel="noopener noreferrer"&gt;Debezium&lt;/a&gt; is a set of distributed services to capture changes in databases so that applications can see those changes and respond to them. It records all row-level changes within each database table in a &lt;em&gt;change event stream&lt;/em&gt;, and applications simply read these streams to see the change events in the same order in which they occurred. &lt;/p&gt;

&lt;p&gt;Debezium is built on top of &lt;strong&gt;Apache Kafka&lt;/strong&gt;, and provides a set of &lt;strong&gt;Kafka Connect&lt;/strong&gt; compatible connectors, which record the history of data changes in a Database Management System (DBMS) by detecting the changes as they occur, and streaming a record of each change event into a kafka topic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; &lt;strong&gt;CDC Architecture with Kafka and Debezium&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Debezium is commonly deployed by means of Apache Kafka Connect, which is a framework and runtime for implementing and operating:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Source connectors e.g. debezium that send records to kafka.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sink connectors that propagate records from kafka topics to other systems.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The CDC Architecture is illustrated in the following figure:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Felx2vfnfzct5kauab7zt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Felx2vfnfzct5kauab7zt.png" alt="CDC architecture" width="800" height="181"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the above, when a new record is added to a database, the debezium source connector detects and records the change, and pushes it to a kafka topic. The sink connector then streams this record to a target system like a data warehouse, where it can be consumed by an application or service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; &lt;strong&gt;How CDC is Implemented Using Debezium and Apache Kafka&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When debezium captures changes from a database, it follows the following workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Connection Establishment:&lt;/strong&gt; Debezium connects to the database and positions itself in the transaction log.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Initial Snapshot:&lt;/strong&gt; For new connectors, debezium typically performs an initial snapshot of the database to capture the current state before processing incremental changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Change Capture:&lt;/strong&gt; As database transactions occur, debezium reads the transaction log and converts changes into events.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Event publishing:&lt;/strong&gt; Change events are published to Kafka topics, typically one topic per table by default.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Schema Management:&lt;/strong&gt; If used with Schema Registry, event schemas are registered and validated.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Consumption:&lt;/strong&gt; Applications or sink connectors consume the change events from Kafka topics.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt; &lt;strong&gt;How to Implement PostgreSQL CDC Using the Debezium PostgreSQL Connector&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Considered Architecture:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;PostgreSQL database with logical replication enabled.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Apache Kafka for message streaming.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kafka connect with the Debezium PostgreSQL connector.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Enable Logical Replication in PostgreSQL:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In PostgreSQL configuration file, update the following settings to appropriate values, and restart PostgreSQL to apply the changes.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wal_level = logical
max_wal_senders = 1
max_replication_slots = 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Thereafter, grant  necessary replication permissions to the database user as follows:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;psql -U postgres -c "ALTER USER myuser WITH REPLICATION;"&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Install Debezium PostgreSQL Connector:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download and install the &lt;a href="https://repo1.maven.org/maven2/io/debezium/debezium-connector-postgres/2.7.0.Final/" rel="noopener noreferrer"&gt;Debezium PostgreSQL connector plugin&lt;/a&gt; in your Kafka Connect setup. Ensure Kafka Connect is properly configured and running.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Configuring the Connector:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a JSON configuration file for the Debezium PostgreSQL connector, specifying connection details, replication settings, and the databases and tables to monitor, as follows:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    {
    "name": "postgres-connector",
    "config": {
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "database.hostname": "localhost",
    "database.port": "5432",
    "database.user": "myuser",
    "database.password": "mypassword",
    "database.dbname": "mydb",
    "database.server.name": "server1",
    "table.include.list": "public.users",
    "plugin.name": "pgoutput"
      }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Register/Deploy the Connector to Start Monitoring the Database:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Kafka Connect’s REST API running on port 8083 to deploy the connector configuration, as follows:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST -H "Content-Type: application/json" --data @connector-config.json http://localhost:8083/connectors
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step5: Generating and Observing Change Events:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create table 'customers' in the database and insert values
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   psql -U myuser -d mydb -c "CREATE TABLE customers (id SERIAL PRIMARY KEY, name            VARCHAR(255), email VARCHAR(255));"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Insert customer details in the table&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;psql -U myuser -d mydb -c "INSERT INTO customers(name,email) VALUES ('Tyler', 'tyler@example.com');"
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;View the change event using Kafka's console consumer by running the following command:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic server1.public.customers --from-beginning
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;The change event structure will appear as follows:&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "schema":{...},
    "payload":{
        "before":null,
        "after":{"id":1, "name":"Tyler", "email":"tyler@example.com"},
        "op":"c",//'c'indcates create(insert)
        "ts_ms":1620000000001
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The event includes both "before" and "after" states. For an insert, "before" is null since the row didn't exist previously. The "op" field indicates the operation type, and "ts_ms" provides a timestamp.&lt;/p&gt;

&lt;p&gt;Updates and Deletion of rows can be executed and the events viewed in a similar manner.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenges and Solutions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whilst the adoption of CDC plays a crucial role in an organization's data management process, it comes with several challenges, which necessitates careful consideration during implementation. Some of these challenges include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; &lt;strong&gt;Schema Evolution:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Overtime, databases undergo changes such as column additions, deletions and renaming, which can disrupt CDC workflows if not handled properly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In production, this challenge can be mitigated by adopting schema registries, which validates schemas for compatibility when changes occur.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; &lt;strong&gt;Late Data:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In CDC, late data represents data that arrives after a batch or time window has passed. To handle this, several measures are adopted:

&lt;ul&gt;
&lt;li&gt;Adding source-based commit timestamps to messages;&lt;/li&gt;
&lt;li&gt;Defining a cut-off timestamp;&lt;/li&gt;
&lt;li&gt;Using a holding table for delayed messages.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; &lt;strong&gt;Fault Tolerance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In CDC fault tolerance can be ensured through the adoption of tools that support retries and error handling for failed events. Additionally, enabling persistence in message brokers like Kafka ensures durability, thus ensuring that no events are lost during system outages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt; &lt;strong&gt;Event Ordering:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Without proper event handling mechanisms in CDC, data inconsistencies and inaccuracies are bound to happen in target systems, since the events are split and processed in a distributed manner.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To address this the following measures can be adopted:&lt;/li&gt;
&lt;li&gt;Use of partitioned messaging system like Kafka which guarantee per-partition ordering.&lt;/li&gt;
&lt;li&gt;Implementing merge logic in the target system that is both sorted and idempotent.&lt;/li&gt;
&lt;li&gt;Processing data in partition-aware batches in the target system.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

</description>
      <category>cdc</category>
      <category>debezium</category>
      <category>kafka</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Apache Kafka Deep Dive: Core Concepts, Data Engineering Applications, and Real-World Production Practices</title>
      <dc:creator>Mwirigi Eric</dc:creator>
      <pubDate>Mon, 08 Sep 2025 15:16:03 +0000</pubDate>
      <link>https://forem.com/emwirigi/apache-kafka-deep-dive-core-concepts-data-engineering-applications-and-real-world-production-c5j</link>
      <guid>https://forem.com/emwirigi/apache-kafka-deep-dive-core-concepts-data-engineering-applications-and-real-world-production-c5j</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Apache Kafka is a crucial component in modern data engineering, and a good understanding of its core concepts, architecture and applications is essential for any data engineer in todays data-driven world.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Apache Kafka?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;According to the   &lt;a href="https://https://kafka.apache.org/#" rel="noopener noreferrer"&gt;Official Kafka website&lt;/a&gt;, Apache Kafka is defined as a distributed event streaming platform. But what is event streaming? From the &lt;a href="https://kafka.apache.org/documentation/" rel="noopener noreferrer"&gt;Kafka documentation&lt;/a&gt;, &lt;strong&gt;event streaming&lt;/strong&gt; is the practice of capturing data in real-time from various sources such as databases, sensors and cloud services.&lt;/p&gt;

&lt;p&gt;Thus, simply put, apache kafka provides a platform that handles and processes real-time data, whereby the platform works as a cluster of one or more nodes, making it scalable and fault-tolerant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apache Kafka Core Concepts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; &lt;strong&gt;Kafka Architecture:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Brokers&lt;/strong&gt; - Are set of servers that run kafka and form the storage layer. They store and serve requested data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zookeeper&lt;/strong&gt; - Can be defined as a centralized service for managing and coordinating kafka brokers. In a cluster, it tracks broker membership, topic configuration, leader selection and meta data related to kafka topics, brokers and consumers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kraft&lt;/strong&gt; - kraft is a protocol that replaces zookeeper-based metadata management system.  With this protocol, kafka brokers manage metadata internally without the need of an external system like zookeeper.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; &lt;strong&gt;Topics, Partitions and Offsets&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Topics:&lt;/strong&gt; These are logical channels to which events are published, similar to a database table. Topics are multi-producer, and multi-subscriber, and for scalability purposes are split into partitions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Partitions:&lt;/strong&gt; When a kafka topic is created, it is divided into one or more partitions, each functioning as an independent, ordered log file that holds aa subset of the topic's data. Hence allowing for efficient parallel data processing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offset:&lt;/strong&gt; In Kafka, each record in a partition is assigned a unique identifier (offset). During writing, each new message written to topic is appended to the log and kafka assigns it the next sequential offset. when reading, consumers can specify an offset to start reading a particular message.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; &lt;strong&gt;Producers:&lt;/strong&gt; Kafka producers are client applications that publish (write) data to kafka topics, whereby the data is sent to the appropriate topic and partition based on either the &lt;strong&gt;key-based partitioning&lt;/strong&gt; (&lt;em&gt;involves using  consistent hashing mechanism on the key of the message, which ensures that all messages with the same key go to the same partition&lt;/em&gt;) or the &lt;strong&gt;round-robin partitioning&lt;/strong&gt; (&lt;em&gt;in which kaka distributes messages across partitions in a rotating manner&lt;/em&gt;).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Acknowledgement Modes(Acks)&lt;/strong&gt; -A kafka producer can choose to receive acknowledgement/confirmation of data writes in 3 modes, namely:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;acks=0:&lt;/strong&gt; Producer sends data without waiting for an acknowledgement, hence prone to possible data loss in the event of sending data to a broker which is down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;acks=1:&lt;/strong&gt; Producer sends data and the the leader confirms receipt. If the ack is not received, the producer retries sending the data again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;acks=all:&lt;/strong&gt; In this scenario, both the leader and replica are requested to acknowledge receipt of messages.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt; &lt;strong&gt;Consumers:&lt;/strong&gt; Kafka consumers are client applications that subscribe to kafka topics and processes the data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Consumer groups:&lt;/strong&gt; consist of client applications (consumers) responsible for reading messages from a topic across multiple partitions through polling, allowing consumers to process events from a topic in parallel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consumer group offset:&lt;/strong&gt; For each topic and partition, the consumer group has a number that represents the latest consumed record from kafka. Hence, a consumer can keep track of where it is in a topic. Consumer offsets can be managed by the following strategies:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Auto-commit&lt;/strong&gt; - the

&lt;code&gt;enable.auto.commit = true&lt;/code&gt;

property  enables kafka to commit the consumer offset to the kafka cluster periodically as defined by &lt;code&gt;auto.commit.interval.ms&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manual commit&lt;/strong&gt; - Manual offset commit defined by

&lt;code&gt;enable.auto.commit = false&lt;/code&gt;

allows control over when offsets are recorded.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5.&lt;/strong&gt; &lt;strong&gt;Kafka Message Delivery and Processing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Message delivery semantics:&lt;/strong&gt; Kafka semantic guarantees refers to how the broker, producer and consumer agree to share messages. According to the &lt;a href="https://docs.confluent.io/kafka/design/delivery-semantics" rel="noopener noreferrer"&gt;Kafka documentation&lt;/a&gt;, messages can be shared in the following ways:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;At-most-once&lt;/strong&gt; - Messages are delivered once, and if there is a system failure, the messages are lost and are not re-delivered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;At-least-once&lt;/strong&gt; - Messages are delivered one or more times, and incase of a failure there is no loss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exactly-once&lt;/strong&gt; - This is the preferred mode in that each message is delivered once, and there is no loss or reading a message twice even if some part of the system fails.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6.&lt;/strong&gt; &lt;strong&gt;Retention Policies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In kafka, retention refer to the policy that determines how long kafka keeps data/records in a topic before they are eligible for deletion. The following retention policies are provided by kafka:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Time-based Retention:&lt;/strong&gt; Records are retained for a specified duration e.g. 7 days, after which upon expiry, the oldest records are deleted. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Size-based Retention:&lt;/strong&gt; Records are retained until the total size of log segments reaches a specified limit e.g. 1GB, after which the oldest records are deleted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log Compaction:&lt;/strong&gt; In log compaction, kafka retains only the latest value for each key in a topic, discarding older updates. This mode is useful for use cases where a complete and up-to-date view of a dataset is needed, for example when maintaining the latest state of  user profile.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7.&lt;/strong&gt; &lt;strong&gt;Back Pressure and Flow Control&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In distributed systems, back pressure is a mechanism for regulating data flow in order to prevent overloads to parts of the system. Simply put, back pressure acts like a traffic control system, regulating the speed and volume of data flow to maintain optimal performance and reliability across the entire system.&lt;/p&gt;

&lt;p&gt;During operations, a system sometimes experiences &lt;strong&gt;consumer lags&lt;/strong&gt; &lt;em&gt;(delay in time it takes a message to move from a producer to a consumer)&lt;/em&gt;, therefore it is essential to perform &lt;strong&gt;Consumer Lag monitoring&lt;/strong&gt;, so that slow consumers can be identified quickly and remedial action taken.&lt;/p&gt;

&lt;p&gt;To undertake consumer lag monitoring, several methods can be used, among them the &lt;strong&gt;Offset explorer tool&lt;/strong&gt; and &lt;strong&gt;proprietary kafka monitoring services&lt;/strong&gt; such as Amazon's.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8.&lt;/strong&gt; &lt;strong&gt;Serialization and Deserialization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Serialization converts data objects to binary format suitable for transmission or storage. Deserialization involves converting the binary data back to its original object form. The following schema formats are adopted:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;JSON Schema:&lt;/strong&gt; JSON schema converts an application's data object into a JSON string then serializes it into bytes before sending. On receiving, the consumer retrieves the JSON Schema using the extracted schema ID and deserializes the data back to the application's data object.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Avro Schema:&lt;/strong&gt; - Avro schema uses the &lt;strong&gt;kafkaAvroSerializer&lt;/strong&gt;  to convert data into binary format. On receiving, the consumer uses the kafka Avro deserializer to extract schema ID, queries the schema registry to retrieve the Avro schema which then converts the binary data back to the data object.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Protobuf Schema:&lt;/strong&gt; The producer application first creates a Protobuf message, and then the &lt;strong&gt;KafkaProtobufSerializer&lt;/strong&gt; converts the message into a binary format. On receiving the binary message, a consumer uses the &lt;strong&gt;kafkaProtobufSerializer&lt;/strong&gt; which converts it back into a protobuf message, extracts schema ID, retrieves the schema and uses it to deserialize the binary data into a structured protobuf message object. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;9.&lt;/strong&gt; &lt;strong&gt;Replication and Fault Tolerance&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Basically, replication involves maintaining a copy of every topic in multiple brokers, ensuring that the data is accessible even in the event of broker failure, thus ensuring fault tolerance.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Leader replica:&lt;/strong&gt; A leader replica receives all write requests for a partition. All produce and consume requests go through the leader, for consistency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Follower replica:&lt;/strong&gt; They replicate data from the leader by fetching log segments and applying the to their local logs. If current leader fails, the can take over as leader.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;In-Sync replicas (ISR):&lt;/strong&gt; These are a subset of replicas synchronized with the leader and kafka guarantees durability by ensuring that messages are only committed when they are replicated to all ISR replicas.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;10.&lt;/strong&gt; &lt;strong&gt;Kafka Connect&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Kafka connect serves as a centralized data hub for simple data integration between databases, key-value stores, file systems etcetera.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Source Connectors:&lt;/strong&gt; Pull/ingest data from external sources such as databases and message queues into kafka topics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sink Connectors:&lt;/strong&gt; Deliver data from kafka topics to external systems.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;11.&lt;/strong&gt; &lt;strong&gt;Kafka Streams&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Kafka Streams API:&lt;/strong&gt; This is a powerful, lightweight library for building real-time, scalable and fault-tolerant stream processing applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stateless versus Stateful Operations:&lt;/strong&gt; Stateless operations transform individual records in the input streams independently, whereas Stateful operations maintain and update state based on the records processed so far, enabling operations like aggregations and joins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Windowing:&lt;/strong&gt; The windowing concept involves processing and aggregating data streams in pre-determined time frames, making windowed joins and aggregations possible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;12.&lt;/strong&gt; &lt;strong&gt;ksqlDB&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;ksqlDB enables the querying, reading, writing and processing of data in real-time and at a scale using SQL-lie syntax.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;13.&lt;/strong&gt; &lt;strong&gt;Transactions and Idempotency&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kafka transactions ensure atomicity by allowing producers to group multiple write operations into single transaction. If the transaction commits successfully, all the writes are visible to consumers, and if aborted, none of the write is visible.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Exactly-Once Semantics:&lt;/strong&gt; Ensures that each message is processed exactly once , even in the event of failure. This is achieved through idempotent producers and transactional consumers configured with isolation levels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolation Levels:&lt;/strong&gt; &lt;strong&gt;read-uncommitted&lt;/strong&gt; allows consumers to see all records including aborted transactions, whereas &lt;strong&gt;read-committed&lt;/strong&gt; allows consumers to only see records from committed transactions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;14.&lt;/strong&gt; &lt;strong&gt;Security in Kafka&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SSL/TLS authentication protocol:&lt;/strong&gt; The secure socket layer (SSL) and transport layer security (TLS) protocols provide encryption and authentication for data in transit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SASL protocol:&lt;/strong&gt; The Simple authentication and security layer (SASL) provides a framework for adding authentication and data security services to connection-based protocols.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;15&lt;/strong&gt; &lt;strong&gt;Operations and Monitoring&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Consumer Lag Monitoring:&lt;/strong&gt; Consumer lags can be monitored by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Consumer group script&lt;/strong&gt; - exposes key details about the consumer group performance by detailing partition's current offsets, log end offset and lag.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Using Burrow&lt;/strong&gt; - Burrow is an open-source monitoring tool that monitors committed consumer offsets and generates reports.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Under-replicated Partitions:&lt;/strong&gt; This is a kafka broker metric that can reveal various problems, from broker failures to resource exhaustion and suggests responding to fluctuations by running preferred replica elections.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Throughput and Latency:&lt;/strong&gt; Throughput indicates the number of messages that can be processed in a given amount of time, whereas Latency describes how fast messages can be processed.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;16.&lt;/strong&gt; &lt;strong&gt;Scaling Kafka&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Partition Count Tuning:&lt;/strong&gt; Involves determining and adjusting optimal number of partitions for a given kafka topic, while considering throughput + parallelism, resource utilization and broker limitations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adding Brokers:&lt;/strong&gt; Kafka architecture allows addition of broker nodes to a cluster as data processing needs grow. The horizontal scalability offers increased throughput, fault tolerance and ability to handle large data volumes. The guidelines for adding brokers can be found here &lt;a href="https://docs.confluent.io/platform/current/get-started/tutorial-multi-broker.html" rel="noopener noreferrer"&gt;setting up a multi-broker kafka cluster&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rebalancing Partitions:&lt;/strong&gt; When a consumer joins or leaves a consumer group, kafka automatically reassigns partitions among the consumers in that group to ensure an even distribution of workload.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;17.&lt;/strong&gt; &lt;strong&gt;Performance Optimization&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Batching:&lt;/strong&gt; In batching, kafka producers groups multiple messages from the same partition into a single batch. &lt;strong&gt;batch size&lt;/strong&gt; defines the maximum size in bytes of a batch whereas &lt;strong&gt;linger.ms&lt;/strong&gt; specifies the maximum time in milliseconds the producer will wait to accumulate messages for a batch before sending it, even if the batch-size has not been reached.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Compression:&lt;/strong&gt; Prior to sending messages within a batch to kafka brokers, compression can be done by configuring as &lt;strong&gt;compression.type&lt;/strong&gt; which specifies the compression algorithm to adopt e.g. gzip, zstd, and Snappy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Page Cache Usage:&lt;/strong&gt; Page cache is a transparent buffer maintained by the OS that keeps recently accessed file data in memory.  During writes, data is to the page cache first and the OS flushes these page to disk synchronously. During reads, consumer requests are served from the page cache with the OS handling the prefetching of data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Disk and Network Considerations:&lt;/strong&gt; This is achieved by considering SSDs and NVMe (non-volatile memory express) which offer faster read/write speeds. For network considerations, ensuring high-bandwidth low-latency network infrastructure and distributing partitions and topics across multiple brokers is essential.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Apache Kafka Real-world Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; &lt;strong&gt;Netflix&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Real-time Data streaming:&lt;/strong&gt; Netflix leverages the apache kafka capabilities to handle real-time data streaming that include user interactions, content consumption, system logs and operational metrics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Microservices communication:&lt;/strong&gt; In Netflix’s microservices architecture, Kafka is used to enable asynchronous communication between services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log aggregation and Monitoring:&lt;/strong&gt; Kafka is instrumental in aggregating logs from different microservices and components within Netflix’s architecture such as centralized logging and real-time monitoring.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; &lt;strong&gt;Uber&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Real-time Pricing:&lt;/strong&gt; Uber adopts Kafka in its pricing pipeline which adjusts models based on dynamic factors like driver availability, location, and weather to manage supply and demand.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>apachekafka</category>
      <category>dataengineerig</category>
    </item>
    <item>
      <title>Docker and Docker Compose : A Beginner's Guide</title>
      <dc:creator>Mwirigi Eric</dc:creator>
      <pubDate>Mon, 25 Aug 2025 13:49:43 +0000</pubDate>
      <link>https://forem.com/emwirigi/docker-and-docker-compose-a-beginners-guide-1lgd</link>
      <guid>https://forem.com/emwirigi/docker-and-docker-compose-a-beginners-guide-1lgd</guid>
      <description>&lt;p&gt;This guide tries to simplify the intricacies of docker and docker compose with the aim of enabling a solid grasp of the fundamentals for beginners.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Docker?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basically docker is a platform/tool that simplifies the development, running and shipping of applications.&lt;/li&gt;
&lt;li&gt;Docker achieves this by virtualizing the operating system of the computer on which it is installed and running.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What does Docker actually do?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker provides the ability to package and run an application in an isolated environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why do we need Docker in Developing Applications?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker allows you to separate your applications from your infrastructure, thus enabling fast deployment of the applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before diving deeper into docker, you can download docker from the following link, which provides guidelines for installation and running of docker on various operating systems: &lt;a href="https://www.docker.com/get-started" rel="noopener noreferrer"&gt;Download Docker&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Docker Key Words/Components&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Docker Engine/Daemon&lt;/strong&gt; - Listens for requests from docker client(s), manages containers and coordinates docker operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Docker Client&lt;/strong&gt; - Is a command line interface (CLI) through which users execute commands to manage their images and containers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Docker Registry&lt;/strong&gt; - Stores container images. An example is the  &lt;a href="https://hub.ocker.com" rel="noopener noreferrer"&gt;Docker Hub&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dockerfile&lt;/strong&gt; - A text that contains instructions describing how to build a docker image. Typically, a docker file contains the following instructions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;FROM&lt;/em&gt;&lt;/strong&gt; &amp;lt;&lt;strong&gt;&lt;em&gt;image&lt;/em&gt;&lt;/strong&gt;&amp;gt; : specifies the base image from which to build from.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;WORKDIR&lt;/em&gt;&lt;/strong&gt; &amp;lt;&lt;strong&gt;&lt;em&gt;path&lt;/em&gt;&lt;/strong&gt;&amp;gt;: specifies the working directory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;COPY&lt;/em&gt;&lt;/strong&gt;&amp;lt;&lt;strong&gt;&lt;em&gt;host-path&lt;/em&gt;&lt;/strong&gt;&amp;gt;&amp;lt;&lt;strong&gt;&lt;em&gt;image-path&lt;/em&gt;&lt;/strong&gt;&amp;gt;: Instructs the builder to copy files from host and place them into the container image.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;RUN&lt;/em&gt;&lt;/strong&gt;&amp;lt;&lt;strong&gt;&lt;em&gt;command&lt;/em&gt;&lt;/strong&gt;&amp;gt;: Instructs the builder to run the specified command.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;CMD&lt;/em&gt;&lt;/strong&gt;&amp;lt;&lt;strong&gt;&lt;em&gt;command&lt;/em&gt;&lt;/strong&gt;&amp;gt;, &amp;lt;&lt;strong&gt;&lt;em&gt;arg1&lt;/em&gt;&lt;/strong&gt;&amp;gt;: Sets the default command to be used by the container using this image.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;A typical Dockerfile will look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    FROM python:3.10

    WORKDIR /app

    COPY requirements.txt .

    RUN pip install -r requirements.txt

    COPY . .

    CMD ["python", "main.py"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Image(s)&lt;/strong&gt; - An image is a blueprint/template of creating a container i.e. contains instructions for creating a container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Container(s)&lt;/strong&gt; - A container is an instance of an image. It contains everything required to run a particular application, including code, libraries, system tools etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To build the image and run a container from the Terminal, run the following commands:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t demo .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;where -t denotes tag which identifies the name given your image i.e. demo&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --name demo1 -p 5000:5000 demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;--name is the name of container to be run, and -p sets the port of the docker container to localhost&lt;/em&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Other common commands include:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;docker ps&lt;/code&gt; - lists running containers&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker images&lt;/code&gt; - lists local images&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker stop &amp;lt;id&amp;gt;&lt;/code&gt; - stop running a particular container specified by its id.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker -rm &amp;lt;id&amp;gt;&lt;/code&gt; - removes a container.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Docker Compose?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Docker compose is a tool for defining and running multi-container applications, whereby these containers are managed in a single &lt;code&gt;docker-compose.yaml&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So what's the difference between Docker and Docker Compose?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Docker builds, run and manages containers (containers package applications with their dependencies), whereas Docker Compose simplifies the management of multi-container applications using a single&lt;code&gt;docker-compose.yaml&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Components of  Docker Compose YAML File&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Version&lt;/strong&gt; - Specifies the version of the docker compose file format. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Services&lt;/strong&gt; - Specifies individual containers or services, making up an application. Each service may have a given docker image, environment variables, volumes, networks, ports to expose, and more options.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Volumes&lt;/strong&gt; - Defines shared volumes that could be mounted into services to persist data. Volumes are crucial in storing data that survives container restarts or must be shared between many containers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Networks&lt;/strong&gt; - Defines custom networks for your services to communicate over. A network creates an isolated communications channel, and each service can have zero or more networks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>docker</category>
      <category>dockercompose</category>
    </item>
    <item>
      <title>A Recap of Data Engineering Concepts</title>
      <dc:creator>Mwirigi Eric</dc:creator>
      <pubDate>Mon, 11 Aug 2025 13:38:42 +0000</pubDate>
      <link>https://forem.com/emwirigi/a-recap-of-data-engineering-concepts-325</link>
      <guid>https://forem.com/emwirigi/a-recap-of-data-engineering-concepts-325</guid>
      <description>&lt;p&gt;As a data Engineer, an in-depth comprehension of the core concepts applied in the field, plays a pivotal role in carrying out daily tasks as well as career progression in the field.&lt;/p&gt;

&lt;p&gt;In this article, we explore the concepts and aim to expound their meanings, applications and relevance in the field of Data Engineering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt;  &lt;strong&gt;Batch versus Streaming Ingestion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Data Ingestion&lt;/em&gt;&lt;/strong&gt; refers to the process of data collection (from various sources), and moving it to a target destination either in batches or in real-time. Primarily, the methods adopted for data ingestion are batch and streaming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Batch Ingestion&lt;/em&gt;&lt;/strong&gt; involves collection and processing of data in chunks whereby the process can either be scheduled or designed to occur automatically.&lt;/p&gt;

&lt;p&gt;The method is effective for resource intensive jobs and repetitive tasks and is ideal for applications such as data warehousing and ETL processes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Streaming Ingestion&lt;/em&gt;&lt;/strong&gt; involves collection and processing of data as received i.e in real-time, from source to target.&lt;/p&gt;

&lt;p&gt;The method is effective for applications that require real-time data processing such as network traffic, fraud detection and mobile money services such as Mpesa.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt;  &lt;strong&gt;Change Data Capture (CDC)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is a data integration pattern that captures only the changes made to data, (through insert, update and delete statements), and represents these changes as a list called CDC feed.&lt;/p&gt;

&lt;p&gt;The CDC approach focusses on incremental changes, hence ensuring that target systems access the most current data at all times.&lt;/p&gt;

&lt;p&gt;CDC is usually implemented through four methods namely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log-based method which reads a database transaction logs.&lt;/li&gt;
&lt;li&gt;Trigger-based method which used database triggers attached to source table events.&lt;/li&gt;
&lt;li&gt;Time-based methods that rely on dedicated columns that record the las modified time for each record.&lt;/li&gt;
&lt;li&gt;Polling-based method that checks for changes based on a time-stamp or version column.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt;  &lt;strong&gt;Idempotency&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Idempotency is a property of an operation producing the same results despite of the number of times the operation is run. This ensures the repeatability and predictability of data processes, thus ensuring data consistency across distributed systems, as well as effective handling of failures and retries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt;  &lt;strong&gt;OLTP versus OLAP Data Processing Systems&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Online Transaction Processing (OLTP)&lt;/em&gt;&lt;/strong&gt; systems are designed for real-time transaction management of concurrent users, and focuses on data consistency and fast retrieval of records. Examples of OLTP systems use include; ATM withdrawals, online banking and e-commerce purchases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Online Analytical Processing (OLAP)&lt;/em&gt;&lt;/strong&gt; systems are designed to analyze aggregated historical data from various sources, for the purposes of data analysis, reporting, and business intelligence. A real-world user case of OLAP system is the Netflix movie recommendation system.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5.&lt;/strong&gt;  &lt;strong&gt;Columnar versus Row-based Storage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Data storage and management adopts two formats i.e columnar and row-based storage formats.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;Columnar Storage&lt;/em&gt;&lt;/strong&gt; organizes data by columns whereby each column is stored separately allowing the system to read/write specific columns independently. Common user cases include data warehouses such as Google BigQuery, and Amazon Redshift.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The advantages of columnar storage include Faster aggregations, Efficient data compression and Efficient analytical queries (optimized for read-heavy queries).&lt;/p&gt;

&lt;p&gt;The disadvantages include; Inefficient for transactional operations and complexity in implementing and management.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Row-based Storage&lt;/strong&gt; organizes data by rows, where each row stores a complete record. This format is used in relational databases such as PostgreSQL and MySQL.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The advantages of row-based storage include; Simple data access, and Efficient for transactional operations.&lt;/p&gt;

&lt;p&gt;On the other hand, the row-based format is Inefficient for analytical queries and might use more space if not optimized properly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6.&lt;/strong&gt;  &lt;strong&gt;Partitioning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Data Partitioning involves dividing data into smaller segments/partitions, whereby each partition contains a subset of the entire dataset.&lt;/p&gt;

&lt;p&gt;Partitioning data helps in improving query performance by limiting data retrieval to only the relevant data, thus reducing the servers’ workload and accelerating data processing.&lt;/p&gt;

&lt;p&gt;Data can be partitioned using the following methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;em&gt;Horizontal Partitioning (Row-based)&lt;/em&gt;&lt;/strong&gt; – Splits tables by rows, thus each partition has the same columns but different records, whereby the partitioning is based on a partition key.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;em&gt;Vertical Partitioning (Column-based)&lt;/em&gt;&lt;/strong&gt; – Splits tables by columns allowing the reading/writing of columns independently.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;em&gt;Functional Partitioning&lt;/em&gt;&lt;/strong&gt; – Partitions data according to operational requirements, with each partition containing data specific to a particular function.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7.&lt;/strong&gt;  &lt;strong&gt;ETL versus ELT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Extract, Transform and Load (ETL) and Extract, Load and Transform (ELT) methods are the two common approaches for data integration, with their major difference being &lt;strong&gt;the order of operations&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Extract, Transform and Load (ETL)&lt;/em&gt;&lt;/strong&gt; – transforms data (on a separate processing server) before loading it to a target system such as a data warehouse. Real-world example of ETL user case would be in ecommerce where ETL allows business gain insights into customer behavoir and preferences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Extract, Load and Transform (ELT)&lt;/em&gt;&lt;/strong&gt; - performs data transformations directly within the data warehouse itself. It allows for raw data to be sent directly to the data warehouse, eliminating the need for staging processes. Real-world example of ELT user case would be in cloud data warehouses such as snowflake and Amazon redshift.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8.&lt;/strong&gt;  &lt;strong&gt;CAP Theorem&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The CAP theorem (Brewer’s theorem) in distributed systems claims that; All three of the desirable properties of &lt;strong&gt;&lt;em&gt;Consistency&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;Availability&lt;/em&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;em&gt;Partition Tolerance&lt;/em&gt;&lt;/strong&gt; cannot be concurrently guaranteed in any distributed data system.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;em&gt;Consistency -&lt;/em&gt;&lt;/strong&gt; Means that all clients see the same data at the same time, no matter which node they connect to.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;em&gt;Availability -&lt;/em&gt;&lt;/strong&gt; Means that any client making a request for data gets a response, even if one or more nodes are down. &lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;em&gt;Partition Tolerance -&lt;/em&gt;&lt;/strong&gt; Means that the cluster must continue to work despite any number of communication breakdowns between nodes in the system.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Therefore, in a distributed system only two of the properties can be achieved simultaneously, thus guides developers in prioritizing the properties that best suit their needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9.&lt;/strong&gt;  &lt;strong&gt;Windowing in Streaming&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In streaming, windowing is a way of grouping events into a set of time-based collections or windows, in which the windows are specified based on time intervals or number of records.&lt;/p&gt;

&lt;p&gt;Windowing allows stream processing applications to break down continuous data streams into manageable chunks for processing and analysis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10.&lt;/strong&gt;  &lt;strong&gt;DAGs and Workflow Orchestration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A Directed Acyclic Graph (DAG) is a conceptual representation of tasks, whose order is represented by a graph in which nodes are linked by one-way connections that do not form any cycles.&lt;/p&gt;

&lt;p&gt;DAGs represent tasks as nodes and dependencies as edges, thereby enforcing a logical execution order, ensuring that tasks are executed sequentially based on their dependencies.&lt;/p&gt;

&lt;p&gt;In data engineering DAGs are used in orchestrating ETL processes as well as managing complex data workflows that involve multiple tasks and dependencies, such as a machine learning workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;11.&lt;/strong&gt;  &lt;strong&gt;Retry Logic and Dead Letter Queues&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Retry logic&lt;/em&gt;&lt;/strong&gt; - is a method used in software and systems development to automatically attempt an action again if it fails the first time. This helps to handle temporary issues, such as network interruptions or unavailable services, by giving the process another chance to succeed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Dead Letter Queue&lt;/em&gt;&lt;/strong&gt;- is a special type of message queue that stores messages that fail to be processed successfully by consumers. It acts as a safety net for handling failed messages and helps in debugging and retrying failed tasks.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A real-world user case of the Dead Letter Queue is Uber, which leverages Apache Kafka features using non-blocking request reprocessing Dead Letter Queue to achieve decoupled, observable error-handling without disrupting real-time traffic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;12.&lt;/strong&gt;  &lt;strong&gt;Backfilling and Reprocessing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Data Backfilling&lt;/em&gt;&lt;/strong&gt; involves filling in missing historical data that does not exist in the system or correcting stale data in the system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Data Reprocessing&lt;/em&gt;&lt;/strong&gt; involves preparing raw data for analysis by cleaning and transforming it into a usable format.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;13.&lt;/strong&gt;  &lt;strong&gt;Data Governance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Data governance is a framework of principles that manage data throughout its lifecycle, from collection and storage to processing and disposal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Why it matters:&lt;/em&gt;&lt;/strong&gt; Without effective data governance, data inconsistencies in different systems across an organization might not get resolved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;14.&lt;/strong&gt;  &lt;strong&gt;Data Versioning and Time Travel&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Data Versioning&lt;/em&gt;&lt;/strong&gt; involves creation of a unique reference (query or ID) for a collection of data, to allow for quicker development and processing of data while reducing errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Time Travel&lt;/em&gt;&lt;/strong&gt; feature in data versioning, enables versioning of big data stored in a data lake, allowing access to any historical version of the data thus providing robust data management through data rollback capabilities for bad writes/deletes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;15.&lt;/strong&gt;  &lt;strong&gt;Distributed Processing Concepts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Distributed data processing involves handling and analyzing data across multiple interconnected devices or nodes, leveraging the collective computing power of interconnected devices.&lt;/p&gt;

&lt;p&gt;Benefits of distributed processing include scalability, robust fault tolerance, enhanced system performance and efficient handling of large volumes of data.&lt;/p&gt;

&lt;p&gt;Real-world adoption of distributed concepts include: Fraud detection and risk management, Personalized product recommendation in e-commerce and Network Monitoring and Optimization.&lt;/p&gt;

</description>
      <category>dataengineering</category>
      <category>programming</category>
    </item>
    <item>
      <title>Data Warehouse: Exploring Key Components and Architecture</title>
      <dc:creator>Mwirigi Eric</dc:creator>
      <pubDate>Tue, 29 Jul 2025 09:03:15 +0000</pubDate>
      <link>https://forem.com/emwirigi/data-warehouse-exploring-key-components-and-architecture-4no6</link>
      <guid>https://forem.com/emwirigi/data-warehouse-exploring-key-components-and-architecture-4no6</guid>
      <description>&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; &lt;strong&gt;Defining a Data Warehouse&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A data warehouse is a centralized repository designed specifically to store, manage, and analyze large volumes of historical and current data from various sources within an organization. It is optimized for analytical processing and business intelligence activities.&lt;/p&gt;

&lt;p&gt;The following attributes are associated with a data warehouses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Designed for analytical tasks using data from various applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Includes current and historical data to provide a historical perspective of information.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Its usage is read-intensive.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Designed to handle massive amount of data accumulated over a period (s) of business operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Information is organized in well-defined tables with clear relationships for ease of access by users and analytical tools.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; &lt;strong&gt;Data Warehouse Models/Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The three main types of data warehouses include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;Enterprise Data Warehouse (EDW)&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The EDW serves as a central or main database to facilitate decision-making through the enterprise. The key benefits of having an EDW include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Access to cross-organizational information.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ability to run complex queries.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access to detailed insights enabling data-driven decisions and early risk assessment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Operational Data Store (ODS)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An ODS is a temporary storage area for near real-time data, used for operational reporting and  analysis, often reflecting the most up-to-date information. It focusses on current operational data as opposed to historical trends.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;Data Mart&lt;/em&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A data mart is a subset of a DWH that supports a particular department, region or business unit. Typically, data marts are designed for specific user groups and their analytical needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; &lt;strong&gt;Components of Data Warehouse&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A data warehouse components work together to store, manage, and analyze vast amounts of data. The key components are include:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Operational Source Systems:&lt;/em&gt;&lt;/strong&gt;  They provide raw data originating from various internal and external sources, such as operational systems, third-party providers, and web-based applications. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Load Manager:&lt;/em&gt;&lt;/strong&gt; Manages the ETL (Extract, Transform and Load) processes for data extraction and transformation, ensuring that the data is adequately prepared and meets the required format prior to entry into the warehouse.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Warehouse Manager:&lt;/em&gt;&lt;/strong&gt; Oversees data storage, aggregation and analysis within the data warehouse, handling tasks like de-normalization, backup, collection and optimization for better performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Query Manager:&lt;/em&gt;&lt;/strong&gt; Handles user queries within the data warehouse, i.e supports querying, reporting and data retrieval, with functionality dependent on the available end-user tools.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Detailed Data:&lt;/em&gt;&lt;/strong&gt; Stores granular, raw data for complex analysis and reporting, providing comprehensive insights.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Summarized Data:&lt;/em&gt;&lt;/strong&gt; Stores predefined aggregations of detailed data for faster queries and reports, providing high-level insights for decision making.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Archive and Backup Data&lt;/em&gt;&lt;/strong&gt;: Ensures data integrity and recovery through regular backups and archival storage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Meta Data:&lt;/em&gt;&lt;/strong&gt; Contains information about data structure, source and transformational processes, thereby supporting the ETL processes, warehouse management and querying, by providing essential context for data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;End-user Access Tools:&lt;/em&gt;&lt;/strong&gt; Include analysis, reporting and data mining tools, enabling uses to access, query and derive insights from the data. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt; &lt;strong&gt;Data Warehouse Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Data warehouse architecture refers to the design of an organization’s data collection and storage framework. It consists of planning, designing, constructing, and managing daily operational processes for how data is used for organizational intelligence and decision support. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Components of Data warehouse Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Sources:&lt;/strong&gt; These are operational databases and external systems from which raw data is extracted, such as databases, spreadsheets, XML AND JSON files, emails and images.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Extract, Transform and Load (ETL) Processes:&lt;/strong&gt; ETL processes are responsible for extracting data from the source systems, transforming it into a standardized format (thus ensuring data consistency), and loading it into the data warehouse.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;​ Further, through data validation, cleansing and standardization, the ETL processes contribute to data   integrity by ensuring that the data is accurate, complete and reliable.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Staging Area:&lt;/strong&gt; This is a temporary storage location that holds the data before it is processed and integrated into the data warehouse.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Warehouse Database:&lt;/strong&gt; This is the central repository where the cleansed, integrated, and historical data is stored. This database is optimized for analytical queries and reporting. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Metadata Repository:&lt;/strong&gt; Metadata, or data about the data, is stored in this repository, providing information about the data warehouse's structure, content, and usage. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Front-end Tools:&lt;/strong&gt; Front-end tools (business intelligence tools) enable users to access, analyze, and visualize the data stored in the data warehouse, supporting informed decision-making.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2) Types of Data Warehouse Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Single-tier Architecture&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The data warehouse is built on a single, centralized database that consolidates all data from various sources into one system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Suitability:&lt;/em&gt;&lt;/strong&gt; Suits small-scale applications and organizations with limited data processing needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Advantage:&lt;/em&gt;&lt;/strong&gt; Minimizes the number of layers and simplifies overall design, leading to faster processing and access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Disadvantage:&lt;/em&gt;&lt;/strong&gt; Lacks the flexibility and modularity of more complex architectures.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Two-tier Architecture&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The data warehouse connects directly to business intelligence (BI) tools, often through an online analytical processing (OLAP) system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Suitability:&lt;/em&gt;&lt;/strong&gt; Ideal for businesses with moderate data volumes and relatively simple reporting or analytic needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Advantage:&lt;/em&gt;&lt;/strong&gt; Provides faster access to data for analytic purposes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Disadvantage:&lt;/em&gt;&lt;/strong&gt; May face challenges in handling larger data volumes, as scaling becomes difficult due to the direct connection between the warehouse and BI tools.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Three-tier Architecture&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The model separates the system into distinct layers i.e., the data source layer, staging area layer and the analytics layer, thus enabling efficient ETL processes, followed by analytics and reporting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Suitability:&lt;/em&gt;&lt;/strong&gt; Ideal for large-scale enterprises that require scalability, flexibility and ability to handle large data volumes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Advantage:&lt;/em&gt;&lt;/strong&gt; Enables businesses to manage data more efficiently and supports advanced analytics and real-time reporting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt; &lt;strong&gt;Data Warehouse Architecture Patterns/Schemas&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A data warehouse schema is a blueprint of how data is related logically within a data warehouse.&lt;/p&gt;

&lt;p&gt;The basic components of all data warehouse schemas are the &lt;strong&gt;Fact&lt;/strong&gt; and &lt;strong&gt;Dimension&lt;/strong&gt; tables, whose roles are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fact Tables:&lt;/strong&gt; Aggregates metrics, measurements or facts about business processes. Fact tables store primary keys of dimension tables as foreign keys within the fact table. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dimension Tables:&lt;/strong&gt; Provide descriptive attributes needed to interpret the metrics provided for in the fact tables.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Aspect&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Fact  Tables&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Dimension  Tables&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Purpose&lt;/td&gt;
&lt;td&gt;Stores  numerical metric (measures)&lt;/td&gt;
&lt;td&gt;Provides  descriptive, categorical context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data Type&lt;/td&gt;
&lt;td&gt;Numeric&lt;/td&gt;
&lt;td&gt;Textual  or categorical&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Structure&lt;/td&gt;
&lt;td&gt;Compact;  uses keys and measures&lt;/td&gt;
&lt;td&gt;Wide;  contains attributes and hierarchies&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Query Focus&lt;/td&gt;
&lt;td&gt;Supports  aggregation and analysis&lt;/td&gt;
&lt;td&gt;Optimized  for filtering and grouping&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The following are the common schemas used in data warehousing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Star Schema&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stores data in a star format, consisting of a central table (fact table) and a number of directly connected tables (dimension tables). The fact table contains information about metrics or measures, while the dimension tables contain information about descriptive attributes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Snowflake Schema&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The snowflake schema consists of a central table (fact table), and a number of other tables (dimension tables and sub-dimension tables.) &lt;/p&gt;

&lt;p&gt;​                                   &lt;strong&gt;Comparison between Star and Snowflake Schemas&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Feature&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Star  Schema&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Snowflake  Schema&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Elements&lt;/td&gt;
&lt;td&gt;Single Fact  Table connected to multiple dimension tables with no sub-dimension tables&lt;/td&gt;
&lt;td&gt;Single  Fact Table connects to multiple dimension tables that connects to multiple  sub-dimension tables&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Normalization&lt;/td&gt;
&lt;td&gt;Denormalized&lt;/td&gt;
&lt;td&gt;Normalization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Number of  dimensions&lt;/td&gt;
&lt;td&gt;Multiple  dimension tables map to a single Fact Table&lt;/td&gt;
&lt;td&gt;Multiple  dimension tables map to multiple dimension tables&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data Redundancy&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance&lt;/td&gt;
&lt;td&gt;Fewer  foreign keys resulting in increased performance&lt;/td&gt;
&lt;td&gt;Decreased  performance compared to Star Schema from higher number of foreign keys&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Complexity&lt;/td&gt;
&lt;td&gt;Simple,  designed to be easy to understand&lt;/td&gt;
&lt;td&gt;More  complicated compared to Star Schema—can be more challenging to  understand&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Storage Use&lt;/td&gt;
&lt;td&gt;Higher  disk space due to data redundancy&lt;/td&gt;
&lt;td&gt;Lower  disk space due to limited data redundancy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;5.&lt;/strong&gt;   &lt;strong&gt;Real World Applications of Data Warehouses&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt;   &lt;strong&gt;Spotify: Enhanced Customer Insights&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Spotify uses its data warehouse in curating customer insights and enables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Creation of personalized playlists based on consumers' listening habits.&lt;/li&gt;
&lt;li&gt; Identification of emerging music trends across different demographics.&lt;/li&gt;
&lt;li&gt; Optimization of users' interface based on interaction patterns.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt;   &lt;strong&gt;Airbnb: Market Analysis and Pricing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Airbnb uses its data warehouse to analyze accommodation markets globally, thus enabling:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Dynamic pricing recommendations for hosts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Identification of underserved market segments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Personalized search results based on user preferences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fraud detection and security enhancement.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt;   &lt;strong&gt;Amazon: Supply Chain Optimization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Amazon’s data warehouse supports its global supply chain operations. Through analysis of historical order data and inventory levels, the company optimizes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inventory placement to minimize shipping times.&lt;/li&gt;
&lt;li&gt;Staffing levels based on predicted order volumes.&lt;/li&gt;
&lt;li&gt;Routing efficiency for delivery networks.&lt;/li&gt;
&lt;li&gt;Procurement decisions for high-demand products. &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>dataengineering</category>
      <category>datawarehouse</category>
    </item>
  </channel>
</rss>
