<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>datagan.site</title>
<link>https://datagan.site/systems/</link>
<atom:link href="https://datagan.site/systems/index.xml" rel="self" type="application/rss+xml"/>
<description>How software really works, and how we see inside it.</description>
<generator>quarto-1.11.9</generator>
<lastBuildDate>Wed, 20 May 2026 18:30:00 GMT</lastBuildDate>
<item>
  <title>Server-Sent Events with FastAPI</title>
  <link>https://datagan.site/systems/fastapi-sse.html</link>
  <description><![CDATA[ 





<p>SSE is the standard for streaming data from server to client over HTTP. Server pushes the update to the client</p>
<p>Built a real-time news stream processing engine supporting infinite publisher streams, windowed aggregations, compile-once transformations, SSE delivery, and backpressure-aware async pipelines.</p>
<p>Real-Time News Stream Processing Engine” That gives you:</p>
<p>continuous event streams windows transforms fanout prioritization backpressure infinite producers</p>
<p>without sounding like observability/log infrastructure.</p>
<p>Why News Works Well</p>
<p>News naturally behaves like streaming events.</p>
<p>Example event:</p>
<p>{ “source”: “Reuters”, “category”: “technology”, “headline”: “AI chip demand rises”, “timestamp”: … }</p>
<p>You can simulate:</p>
<p>multiple publishers breaking news bursts category subscriptions rolling trends live feeds</p>
<p>Very realistic for stream systems.</p>
<p>Mapping from Log Concepts → News Concepts Streaming System Concept News Equivalent log event news article producer publisher severity priority stream live feed aggregation trend analysis alerts breaking news fanout subscribers filtering topic/category filters Your Architecture Becomes News Publishers ↓ Ingress Queue ↓ Normalizer ↓ Transform Engine ↓ Window Aggregator ↓ Subscriber Queues ↓ SSE Clients</p>
<p>Looks clean and product-oriented. Infinite Loop Producers Each publisher continuously emits articles:</p>
<p>while running: article = generate_news() await ingress_queue.put(article)</p>



 ]]></description>
  <category>python</category>
  <guid>https://datagan.site/systems/fastapi-sse.html</guid>
  <pubDate>Wed, 20 May 2026 18:30:00 GMT</pubDate>
</item>
<item>
  <title>Observability Engineering: Notes</title>
  <link>https://datagan.site/systems/oe.html</link>
  <description><![CDATA[ 





<p>When a software is mentioned to have observability? When we can understand: * Inner workings * System state * inner workings and system state from external observation * internal state without any custom code</p>
<p>Shortfalls of traditional monitoring ppaorach: * Many services * polyglot persistence * dynamic * variety of correlation</p>
<p>Debugging with Metrics Versus Observability</p>
<p>Common ones: six high-cardinality dimensions per event: time, app, host, user, endpoint, and status</p>
<p>Why Intuitive Troubleshooting Has Stopped Working for You * sense-analyze-respond needed due to complexities * core analysis loop eg: Most of the errors are coming from a specific endpoint –&gt; there’s a subset of requests that seem to have a much higher latency than others.–&gt; one of the slow requests seems to be hanging up in a caching subsystem –&gt; all the slow caching calls seem to be referring to the same object ID. –&gt; a specific cached object has become corrupted somehow –&gt; test that hypothesis by looking at the payload of those objects. –&gt; execute a command to flush that cached object and watch for the effects</p>
<ul>
<li>Observability allows us to probe deep into our systems to understand behavior, down to the level of individual requests between services.</li>
</ul>
<p>Structured Events * Numerical values generated by a metric reflect an aggregated report of system state over a predefined period of time</p>
<ul>
<li>High cardinality and high dimensionality not feasible. eg: “all Canadian users, running iOS11 version 11.0.4, using the French language pack, who installed the app last Tuesday, running firmware version 1.4.101, who are storing photos on shard3 in region us-west-1.”</li>
<li>Structured logs are machine parsable and can be useful for the goals of observability, presuming they are redesigned to resemble a structured event.</li>
</ul>
<p>Stitching Events into Traces Distributed traces are an interrelated series of events.</p>
<p>Components of trace: UUID Trace ID Span ID Parent ID Timestamp Duration</p>



 ]]></description>
  <category>books</category>
  <category>observability</category>
  <guid>https://datagan.site/systems/oe.html</guid>
  <pubDate>Mon, 01 Dec 2025 18:30:00 GMT</pubDate>
</item>
<item>
  <title>Azure - A Definitive Guide</title>
  <link>https://datagan.site/systems/azure.html</link>
  <description><![CDATA[ 





<p>Authentication - Azure Active Directory is an identity and access management service.</p>
<p>Azure Monitor: 1. Detect and analyze issues across applications and dependencies 2. Correlate infrastructure problems with insights from the VMs and containers 3. Create visualizations for logs and other kinds of telemetry</p>
<p>Managing an Azure DevOps Project with Azure Boards Automating Code Builds and Automated Tests with Azure Pipelines Resource groups can be used to group resources by project, department, service, feature</p>



 ]]></description>
  <category>cloud</category>
  <guid>https://datagan.site/systems/azure.html</guid>
  <pubDate>Wed, 19 Nov 2025 18:30:00 GMT</pubDate>
</item>
<item>
  <title>Designing Data-Intensive Applications (2nd Edition): Notes</title>
  <link>https://datagan.site/systems/ddia.html</link>
  <description><![CDATA[ 





<p>Chapter 1. Trade-offs in Data Systems Architecture</p>
<ul>
<li>An application data-intensive if data management is one of the primary challenges in developing the application</li>
<li>An compute-intensive systems the challenge is parallelizing some very large computation</li>
<li>Standard building blocks of ddia 1. database 2. cache 3. stream processing 4.batch processing and 5. search indexes</li>
</ul>
<p>*Operational System &gt;Backend of the application, both read and write &gt;Point queries &gt;Create, Update, Delete Analytical Systems &gt; Read only copy of operational system for data analysis &gt; Bulk import (ETL) or event stream</p>
<p>Data lake - Raw data in files Data Warehouse - Structured data</p>
<p>Cloud Vs Selfhosting Cloud * Need to scale up/down</p>
<ul>
<li><p>Selfhosting</p></li>
<li><p>Predicatable load</p></li>
<li><p>can add custom features</p></li>
<li><p>service availability in own hands</p></li>
<li><p>cheap for large use</p></li>
<li><p>data secure</p></li>
<li><p>Seperation of storage and compute is the craze In a traditional systems architecture, the same computer is responsible for both storage (disk) and computation (CPU and RAM). In cloud-native systems, they are indeed seperated</p></li>
<li><p>Multitenant - no seperate machines for each customer, compute but rather better hardware utilization, easier scalability, and easier management by the cloud provider.</p></li>
</ul>
<p>Why distributed systems over single node? * Fault tolerance/High Availabilty * Scalibility * Latency * Elasticity * Using specialized hardware</p>
<p>Downside: Troubelshooting is often difficult and developed under observability observability is collecting data about the execution of a system, and allowing it to be queried in ways that allows both high-level metrics and individual events to be analyzed</p>
<p>Microservice - small seperate unit and Serverless, or function-as-a-service (FaaS) - autoallocates and frees resources, built based on time used</p>
<p>Chapter 2. Defining Nonfunctional Requirements</p>
<ul>
<li>Performance &gt;Response - Time taken to serve a request - “time it takes to load the home timeline” or the “time until a post is delivered to followers” &gt;Throughput - How many requests served - “posts per second” and “timeline writes per second”. To avoid retry tsunami, implement exponential backoff with jitters and add circuit breaker or token bucket algorithm.</li>
</ul>
<p>Response time = 2<em>Network latency(to and fro) + 2</em>queuing delay(in and out) + service time Average, Median, and Percentiles are the common measures Keeping Tail latencies happy is also important Tail latency amplification - the chance of getting a slow call increases if an end-user request requires multiple backend calls, and so a higher proportion of end-user requests end up being slow</p>
<ul>
<li><p>Reliability and Fault tolerance If it continues providing the required service to the user in spite of certain faults occurring Faults come from hardware/software/humans.</p></li>
<li><p>Scalability Shared-Memory- Vertical scaling Shared-Disk - Mid of up and down options. Storage shared , compute seperate Shared-Nothing Architecture - Horizonatal scaling A good general principle for scalability is to break a system down into smaller components that can operate largely independently from each other. Another good principle is not to make things more complicated than necessary</p></li>
<li><p>Maintainability</p></li>
<li><p>Easy to operate. Self healing</p></li>
<li><p>Simple to understand via design patterns and domain-driven design</p></li>
<li><p>Can easily evolve using agile via TDD, refactoring and writing lots of tests</p></li>
</ul>
<p>Chapter 3. Data Models and Query Languages Declarative - specify the pattern of the data you want—what conditions the results must meet, and how you want the data to be transformed (e.g., sorted, grouped, and aggregated)—but not how to achieve that goal. The database system’s query optimizer can decide which indexes and which join algorithms to use, and in which order to execute various parts of the query. Declarative saves headache how to implement parallelism and db takes care underneath</p>
<ul>
<li>Object-relational mapping (ORM) Helps in &gt; Translation between persistent relational and the in-memory object representation &gt; Caching results of database queries &gt; Can help schema management and migrations</li>
</ul>
<p>Relational Cost high for combining and displaying a profile Document databases can store both normalized and denormalized data, but they are often associated with denormalization—partly because the JSON data model makes it easy to store additional, denormalized fields, and partly because the weak support for joins in many document databases makes normalization inconvenient</p>
<p>Fact tables are individial events, enriched with dimension tables OLTP systems go with Normalization. Analytics systems often fare better with denormalized data. Structure of tables in a data warehouse: a star schema (fact in middle, surrounded by dimensions), snowflake schema(dimensions are further broken to subdimension), and one big table(no normalisation)</p>
<p>When to use which model? document data model are schema flexibility but traversing second or more level is difficult relational model counters by providing better support for joins, many-to-one, and many-to-many relationships.</p>
<p>A graph consists of two kinds of objects: vertices (also known as nodes or entities) and edges. Adjaceny list, each verted stores ids of neighbors one way. Good for traversal, In Adjaceny matrix , row and column correspond on</p>
<p>In the adjacency list model, each vertex stores the IDs of its neighbor vertices that are one edge away. Alternatively, you can use an adjacency matrix, a two-dimensional array where each row and each column corresponds to a vertex, where the value is zero when there is no edge between the row vertex and the column vertex, and where the value is one if there is an edge. The adjacency list is good for graph traversals, and the matrix is good for machine learning</p>
<p>Property Graphs: A property graph is made of vertices and edges, each with unique IDs, labels, and key–value properties. Vertices hold incoming/outgoing edges, while edges connect vertices and describe their relationships.</p>
<p>Cypher Query Language - Neo4j Graph Language Graph Queries in SQL - like AGE- pg graph db Triple-Stores and SPARQL - all information is stored in the form of very simple three-part statements: (subject, predicate, object) Datalog - consists of facts, and each fact corresponds to a row in a relational table. answers arrived recursively.</p>
<p>Event Sourcing and CQRS = Using a log of immutable events as source of truth and deriving materialized views from it.</p>
<p>DataFrames= Similar to realtional table, manipulated via seris of commands Matrices = 2-d numbers, easier for linear algebra ops, rem adjaceny matrix above eg: used in the financial industry for representing time series data, such as the prices of assets and trades over time Arrays = large multidimensional array usess : geospatial measurements (raster data on a regularly spaced grid), medical imaging, or observations from astronomical telescopes</p>
<p>Chapter 4. Storage and Retrieval</p>
<p>Log-Structured Storage Store hash map in memory with key and offset. The hash map is not persisted. Thats why restarts take long time in dbs like clickhouse and hash table should fit in memory. Range queries are not efficient. SSTable file format Sorted String Table: Hashmap stored in sorted order and time to time flushed. Typical datastructures used red-black tree, skip list, or trie. in-memory data structure is called the memtable.</p>
<p>Bloom filter If the Bloom filter says that a key is not present, we can safely skip that SSTable, since we can be sure that it doesn’t contain the key.</p>
<p>If the Bloom filter says the key is present, we have to consult the sparse index and decode the block of key-value pairs to check whether the key really is there. If it was a false positive, we have done a bit of unnecessary work, but otherwise no harm is done—we just continue the search with the next-oldest segment.</p>
<p>Compaction strategies &gt;Size-tiered compaction &gt;Leveled compaction</p>
<p>B-Trees B-trees keep key-value pairs sorted by key, which allows efficient key-value lookups and range queries. B-trees break the database down into fixed-size blocks or pages, and may overwrite a page in-place.write-ahead log (WAL). This is an append-only file to which every B-tree modification must be written before it can be applied to the pages of the tree itself.</p>
<p>Data Storage for Analytics &gt;Cloud Data Warehouses Query engine=Trino, Apache DataFusion, and Presto Storage format = Parquet, ORC, Lance, or Nimb Table Format = Apache Iceberg or Databricks’s Delta Data catalog = Snowflake’s Polaris and Databricks’s Unity Catalog, Apache Iceberg</p>
<blockquote class="blockquote">
<p>Column-Oriented Storage Column Compression Sort Order in Column Storage Writing to Column-Oriented Storage Query Execution: Compilation and Vectorization</p>
</blockquote>
<p>Full-Text Search</p>
<p>The data structure that many search engines use to answer such queries is called an inverted index. This is a key-value structure where the key is a term, and the value is the list of IDs of all the documents that contain the term (the postings list</p>
<p>How to cope with typos? Trie and Levenshtein automaton can help</p>
<p>Vector Embeddings semantic search indexes use embedding models to translate a document into a vector of floating-point values, called a vector embedding. Embedding models generate vector embeddings that are near each other (in this multi-dimensional space) when the embedding’s input documents are semantically similar</p>
<p>OLTP system typically accessed with primary key or a secondary index. OLTP takes log-structured storage engines for high throughput. B-trees tend to be better for reads, providing higher read throughput. Data warehouses use column oriented</p>
<p>Finally, vector databases are used for semantic search on text documents and other media; they use vectors with a larger number of dimensions and find similar documents by comparing vector similarity.</p>
<p>Embedding models use much larger vectors. earch engines use distance functions such as cosine similarity or Euclidean distance to measure the distance between vectors. Cosine similarity measures the cosine of the angle of two vectors to determine how close they are</p>
<p>Chapter 5. Encoding and Evolution several ways of turning data structures into bytes on the network /disk. The translation from the in-memory representation to a byte sequence is called encoding (also known as serialization or marshalling), and the reverse is called decoding (parsing, deserialization, unmarshalling). * Programming language–specific encodings eg:pickle for python objects * Textual formats like JSON, XML, and CSV * Binary schema–driven formats like Protocol Buffers and Avro. Protocol Buffers requires a schema for any data that is encoded.Protbuf saves hassel of saving field name everytime and saves once for schema. * Many frameworks couple service definitions and server code together. In some cases, such as with the popular Python FastAPI framework, servers are written in code and an IDL is generated automatically. In other cases, such as with gRPC, the service definition is written first, and server code scaffolding is generated.</p>
<p>Modes of dataflow * Databases * Service calls RPC and REST APIs * Workflow engines * Event-driven architectures (using message brokers or actors)</p>
<p>Chapter 6. Replication Replicas quickly reflect writes from one node on other nodes, but backups store old snapshots of the data so that you can go back in time. Backups can go to objectstore like s3</p>
<p>Single-Leader Replication Leader receives and streams changes to followers. Followers ack . Read goes to followers or leaders. however, write goes to leader.</p>
<p>Synchronous Versus Asynchronous Replication synchronous replication is that the follower is guaranteed to have an up-to-date copy of the data Disadvantage is that if the synchronous follower doesn’t respond, the write cannot be processed.</p>
<ul>
<li>Setting Up New Followers - Pg uses log sequence number to setup and catchup</li>
<li>Handling node outages - Follower failure: Catch-up recovery, Leader failure: Failover</li>
<li>Replication logs &gt; Statement based &gt; Write Ahead log &gt; logical row based How to solve replication lag? Eventual consistency can be any time delay</li>
<li>Reading own writes( read-after-write consistency)</li>
<li>Monotonic reads guarantees user dont see things moving backward in time.</li>
<li>Consistent Prefix Reads- writes that are causally related to each other are written to the same shard</li>
</ul>
<p>Multi-Leader Replication - allow more than one node to accept writes. Topoligies - Circle, star, all to all Sync Engines and Local-First Software like google calendar needs multi leader Conflict avoidance useful for id generation last write wins = discarding concurrent writes</p>
<p>Two families of algorithms for automatic conflict resolution: &gt; Conflict-free replicated datatypes (CRDTs) = in distributed databases such as Redis Enterprise, Riak, and Azure Cosmos DB &gt; Operational Transformation (OT) = used for real-time collaborative editing of text, e.g.&nbsp;in Google Docs</p>
<p>Leaderless Replication Client sends write to multiple nodes simultaneosuly Challenge in Catching up on missed writes</p>
<ul>
<li>Read repair</li>
<li>Hinted handoff</li>
<li>Anti-entropy</li>
</ul>
<p>Quorums for reading and writing * Rule: w + r &gt; n ( sets of nodes used by the read and write operations overlap in at least one node) . if there are n replicas, every write must be confirmed by w nodes to be considered successful, and we must query at least r nodes for each read version number or timestamp can help in finding which write is latest</p>
<p>Chapter 7. Sharding primary reason for sharding a database is scalability: sharding is used to implement multitenant systems. Sharding types: 1. key range 2. Hash of Key A consistent hashing algorithm is a hash function that maps keys to a specified number of shards in a way that satisfies two properties: * the number of keys mapped to each shard is roughly equal, and * when the number of shards changes, as few keys as possible are moved from one shard to another.</p>
<p>Chapter 8. Transactions Literally executing transactions in a serial order slows things. Two-phase locking needs lot of corrindation. Serializable snapshot isolation (SSI) is new where optimistic approach, allowing transactions to proceed without blocking. When a transaction wants to commit, it is checked, and it is aborted if the execution was not serializable.</p>
<p>Chapter 9. The Trouble with Distributed Systems</p>
<ul>
<li>Packet lost</li>
<li>Clock not in sync</li>
<li>Process pause</li>
</ul>
<p>distributed algorithms rely on timeouts to determine whether a remote node is still available. Quorum needed to arrive at meaningful information. Distributed systems help in Scale, latency and fault tolerance.</p>
<p>Chapter 10. Consistency and Consensus Coordination services like ZooKeeper and etcd are also built on top of consensus algorithms. They provide locks, leases, failure detection, and change notification features that are useful for managing the state of distributed applications.</p>
<p>Chapter 11. Batch Processing Modern batch processing has been heavily influenced by MapReduce Batch processing landscape has changed by below: * more sophisticated caching and execution strategies * focus has shifted toward usability. * New processing models such as dataflow APIs, query languages, and DataFrame APIs are now widely supported. * Job and workflow orchestration has also matured * Batch storage layers are shifting from distributed filesystems (DFSs) like HDFS, GlusterFS, and CephFS to object storage systems such as S3 * if the job’s working set is larger than the available memory, the sorting approach has the advantage that it can make efficient use of disks * Datasets that are too large to fit in memory or local disk present a problem, is the challenge</p>



 ]]></description>
  <category>books</category>
  <category>data</category>
  <guid>https://datagan.site/systems/ddia.html</guid>
  <pubDate>Mon, 10 Nov 2025 18:30:00 GMT</pubDate>
</item>
<item>
  <title>GCP - A Definitive Guide</title>
  <link>https://datagan.site/systems/gcp.html</link>
  <description><![CDATA[ 





<p>What are the advantages of cloud? 1. Flexibility 2. Efficiency 3. Cost-effectiveness</p>
<section id="what-are-the-different-layers-of-cloud" class="level1">
<h1>What Are the Different Layers of Cloud</h1>
<p>Cloud computing is generally divided into three main layers. Each layer provides different levels of control, flexibility, and management for users and organizations.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://datagan.site/systems/assets/cloud_types.png" class="img-fluid figure-img"></p>
<figcaption>Cloud Layers credit: O’reilly</figcaption>
</figure>
</div>
</section>
<section id="understanding-google-cloud-compute-engine" class="level1">
<h1>Understanding Google Cloud Compute Engine</h1>
<p>Compute Engine is a customizable compute service offered by Google Cloud. It provides virtual machines that function like traditional on-premises servers but with the flexibility and scalability of the cloud.</p>
<section id="what-makes-compute-engine-special" class="level2">
<h2 class="anchored" data-anchor-id="what-makes-compute-engine-special">What Makes Compute Engine Special</h2>
<p>Compute Engine allows users to start and stop instances as needed. This feature provides full control over resource usage and makes it easy to scale infrastructure based on workload requirements. It is suitable for applications of any size, from small development environments to large enterprise systems.</p>
</section>
<section id="machine-types" class="level2">
<h2 class="anchored" data-anchor-id="machine-types">Machine Types</h2>
<p>Compute Engine offers several types of virtual machines to suit different workloads</p>
<p><strong>General Purpose</strong><br>
Used for common and everyday computing tasks.</p>
<p><strong>Memory Optimized</strong><br>
Designed for data-heavy and in-memory applications.</p>
<p><strong>Compute Optimized</strong><br>
Ideal for high performance computing workloads.</p>
<p><strong>Accelerator Optimized</strong><br>
Best suited for machine learning and GPU intensive tasks.</p>
</section>
<section id="smart-scaling-and-reliability" class="level2">
<h2 class="anchored" data-anchor-id="smart-scaling-and-reliability">Smart Scaling and Reliability</h2>
<p>Compute Engine supports auto scaling, allowing instances to automatically adjust based on demand. Predictive auto scaling can anticipate future workload needs and prepare resources in advance.<br>
It also provides auto failover capabilities that ensure high availability by shifting workloads to another zone or region if a failure occurs.</p>
</section>
<section id="cost-optimization" class="level2">
<h2 class="anchored" data-anchor-id="cost-optimization">Cost Optimization</h2>
<p>For batch or temporary workloads, preemptible instances are available. These are short lived and cost effective virtual machines that help reduce expenses for non critical processing tasks. They can be started, used for batch jobs, and then shut down to save cost.</p>
</section>
<section id="security-with-iam" class="level2">
<h2 class="anchored" data-anchor-id="security-with-iam">Security with IAM</h2>
<p>Security in Compute Engine is managed through Identity and Access Management (IAM). Users with the correct permissions can create, manage, or replicate virtual machines and operating systems. This ensures that access is controlled and resources remain protected.</p>
</section>
<section id="summary" class="level2">
<h2 class="anchored" data-anchor-id="summary">Summary</h2>
<p>Compute Engine provides<br>
- Flexible and scalable compute resources<br>
- Cost efficient options for temporary workloads<br>
- High availability through auto failover<br>
- Security and access control through IAM</p>
<p>Compute Engine enables users to build, scale, and manage applications in the cloud with efficiency and reliability.</p>
<p>Why containers? share the OS kernel, start much faster, and use a fraction of the memory compared to booting an entire OS</p>
<p>What is GKE? GKE is auto-pilot of k8s. Scales vertically and horitzontally based on consumption</p>
<p>What is App Engine? Serverless compute option for low latency applications. Achieves fast response by integrating to memory store in Redis</p>
<p>What is Cloud Function? Cloud Functions is a fully managed event-driven serverless function-as-a-service (FaaS). Equivalent of lambda in AWS.</p>
<p>What are different kind of storage? Object store Block File Store</p>
<p>What are they? Object store is used for binary and object data, blobs, and unstructured data Block storage is used for database block storage. Local SSD is the popular option File storage is NAS equivlanet of a shared filesystem</p>
<p>What are the different storage classes? * Standard –&gt; Regional * Nearline * Coldline * Archive</p>
<p>What are different types of managed DBs? * Cloud SQL(Runs pg, mysql) * Cloud Spanner(combines Relational and Non Relational) with unlimited scale. Can configure for strong reads and stale reads * Firestore - Document model database,serverless * Bigtable - Petabyte NODQL database for low latency * Memory store - Fully managed inmemory store</p>
<p>What are components in data analytics pipeline? * Capture –&gt; Pub/Sub, BigQuery * Process –&gt; Dataproc,Dataprep,Dataflow * Store –&gt; Cloud Storage, Big Query, * Analyse/Use –&gt; TensorFlow, Vertex,DataStudio, Looker * Across –&gt; Data Fusion, Data Catalog, Composer, Datastream</p>
<p>What are the components in Data Science, Machine Learning, and Artificial Intelligence? * Prepackaged AI Solutions(Recommendation, Document, Contact Centre, DialogFlow) * PreTrained APIs (Vision, Translation, Video Intelligence) * AutoML Vertex AI * Vertex Training</p>
<p>what is the architecture of vertex forecasting? * Prepare dataset * Train with models * Forecast * Visualise, Integrate</p>


</section>
</section>

 ]]></description>
  <category>cloud</category>
  <guid>https://datagan.site/systems/gcp.html</guid>
  <pubDate>Mon, 10 Nov 2025 18:30:00 GMT</pubDate>
</item>
<item>
  <title>Databricks - PySpark: A Definitive Guide</title>
  <link>https://datagan.site/systems/pyspark.html</link>
  <description><![CDATA[ 





<section id="what-problem-does-databricks-solve" class="level2">
<h2 class="anchored" data-anchor-id="what-problem-does-databricks-solve">What problem does Databricks solve?</h2>
<p>Databricks offers a unified platform combining data lakes (flexible, cheap) and data warehouses (structured, governed, quality) known as a <strong>data lakehouse</strong>.</p>
</section>
<section id="what-is-the-high-level-architecture" class="level2">
<h2 class="anchored" data-anchor-id="what-is-the-high-level-architecture">What is the high-level architecture?</h2>
<ul>
<li><strong>DB uses one of the cloud providers as underlying infrastructure</strong></li>
<li><strong>Databricks Runtime</strong> - Preconfigured VM for cluster use</li>
<li><strong>Unity Catalog</strong> - Provides unified view and permissions</li>
<li><strong>DB Workspace</strong> - Any language accessing Databricks</li>
</ul>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://datagan.site/systems/assets/architecture.png" class="img-fluid figure-img"></p>
<figcaption>Architecture Diagram. Credit: Oreilly</figcaption>
</figure>
</div>
<section id="two-main-components" class="level3">
<h3 class="anchored" data-anchor-id="two-main-components">Two Main Components:</h3>
<ul>
<li><strong>Control Plane</strong>: Web UI, Cluster Management, Workflows, Notebooks</li>
<li><strong>Data Plane</strong>: Storage and Compute/VMs</li>
</ul>
</section>
</section>
<section id="why-is-apache-spark-so-popular" class="level2">
<h2 class="anchored" data-anchor-id="why-is-apache-spark-so-popular">Why is Apache Spark so popular?</h2>
<ul>
<li>Distributed data processing</li>
<li>In-memory processing</li>
<li>Multi-language support</li>
<li>Batch and stream processing</li>
<li>Flexible data handling</li>
</ul>
</section>
<section id="what-is-delta-lake" class="level2">
<h2 class="anchored" data-anchor-id="what-is-delta-lake">What is Delta Lake?</h2>
<p>Delta Lake is an open-source transactional storage layer on top of cloud storage. It is a <strong>framework</strong>, not a medium or format like Parquet. It supports <strong>ACID guarantees</strong>.</p>
</section>
<section id="what-are-the-key-commands-used-with-delta-lake" class="level2">
<h2 class="anchored" data-anchor-id="what-are-the-key-commands-used-with-delta-lake">What are the key commands used with Delta Lake?</h2>
<ul>
<li><code>USING DELTA</code></li>
<li><code>DESCRIBE</code></li>
<li><code>OPTIMIZE</code> - Compacts small files into larger ones</li>
<li><code>OPTIMIZE &lt;table_name&gt; ZORDER BY &lt;column_names&gt;</code> - Creates an index for the column, enabling skip scanning to directly reach relevant chunks</li>
<li><code>DROP</code></li>
</ul>
</section>
<section id="what-is-the-relational-structure" class="level2">
<h2 class="anchored" data-anchor-id="what-is-the-relational-structure">What is the relational structure?</h2>
<pre><code>Storage --&gt; Schema --&gt; Table1, Table2</code></pre>
<p><strong>Note:</strong> Databricks uses Hive’s metastore format and SQL compatibility, but replaces Hive’s compute engine with Spark and Delta Lake.</p>
</section>
<section id="what-are-different-sql-functions-available" class="level2">
<h2 class="anchored" data-anchor-id="what-are-different-sql-functions-available">What are different SQL functions available?</h2>
<ul>
<li><code>INTERSECT</code></li>
<li><code>MINUS</code></li>
<li><code>PIVOT</code></li>
<li><code>FILTER</code></li>
<li><code>TRANSFORM</code></li>
</ul>
</section>
<section id="what-are-udfs" class="level2">
<h2 class="anchored" data-anchor-id="what-are-udfs">What are UDFs?</h2>
<p><strong>User-Defined Functions (UDFs)</strong> are custom functions that: - Accept parameters - Can be used as part of SQL queries - Can be described using the <code>DESCRIBE</code> command</p>
</section>
<section id="how-does-spark-handle-data-streaming" class="level2">
<h2 class="anchored" data-anchor-id="how-does-spark-handle-data-streaming">How does Spark handle data streaming?</h2>
<ul>
<li><strong>Big Prerequisite</strong>: Data must be append-only (data can only be added to the source; existing data cannot be modified)</li>
<li>Can integrate with various readers like files, queues, and Delta Lake tables</li>
<li><strong>Read and Write</strong>:
<ul>
<li><code>streamDF = spark.readStream.table("source_table")</code></li>
<li><code>streamDF.writeStream.table("target_table")</code></li>
</ul></li>
<li><strong>Modes</strong>: Continuous Mode and Triggered Mode</li>
<li><strong>Checkpointing</strong> at regular intervals</li>
<li><strong>Streaming guarantees</strong>: Fault recovery and exactly-once semantics</li>
</ul>
</section>
<section id="how-can-we-handle-incremental-data-ingestion" class="level2">
<h2 class="anchored" data-anchor-id="how-can-we-handle-incremental-data-ingestion">How can we handle incremental data ingestion?</h2>
<ul>
<li><strong>COPY INTO</strong> - Each execution only processes new files from the source location; previously ingested files are ignored</li>
<li><strong>Auto Loader</strong> - Employs checkpointing, stores metadata information, efficient at scale, can handle millions of files</li>
</ul>
</section>
<section id="what-is-medallion-architecture" class="level2">
<h2 class="anchored" data-anchor-id="what-is-medallion-architecture">What is Medallion Architecture?</h2>
<p>As in medals, it has three levels: - <strong>Bronze</strong> - <strong>Silver</strong> - <strong>Gold</strong></p>
</section>
<section id="how-to-build-production-pipelines" class="level2">
<h2 class="anchored" data-anchor-id="how-to-build-production-pipelines">How to build Production Pipelines?</h2>
<ul>
<li><strong>Delta Live Tables (DLT)</strong> is a declarative ETL framework powered by Apache Spark for building reliable and maintainable data pipelines</li>
<li><strong>Running DLT Pipelines</strong>: Production and Development mode</li>
<li><strong>Change Data Capture (CDC)</strong></li>
</ul>
</section>
<section id="what-is-data-governance" class="level2">
<h2 class="anchored" data-anchor-id="what-is-data-governance">What is Data Governance?</h2>
<ul>
<li>Data Cataloging</li>
<li>Data Security</li>
<li>Monitoring and Auditing</li>
<li>Data Lineage</li>
<li>Data Discovery</li>
</ul>
</section>
<section id="what-is-unity-catalog" class="level2">
<h2 class="anchored" data-anchor-id="what-is-unity-catalog">What is Unity Catalog?</h2>
<p>Traditional namespace: <code>schema.table</code> Unity Catalog namespace: <code>catalog.schema.table</code></p>
<hr>
<p>Pyspark</p>
<p>What are two main structures for storing data when performing manipulations? Resilient Distributed Data - RDD - Each record as independend object/row Dataframe - Records in columns</p>
<p>What are the various functions? from pyspark.sql.functions import split</p>
<p>write a simple pyspark snippet for word count “““import pyspark.sql.functions as F</p>
<p>results = ( spark.read.text(“./data/gutenberg_books/1342-0.txt”) .select(F.split(F.col(“value”), ” “).alias(”line”)) .select(F.explode(F.col(“line”)).alias(“word”)) .select(F.lower(F.col(“word”)).alias(“word”)) .select(F.regexp_extract(F.col(“word”), “[a-z’]*“, 0).alias(”word”)) .where(F.col(“word”) != ““) .groupby(”word”) .count() )”</p>
<p>What are the rules for succsessful join?</p>
<p>when to decide what type of UDF to use? <img src="https://datagan.site/systems/assets/UDF.png" class="img-fluid" alt="UDF. Credit: Oreilly"></p>
</section>
<section id="projects-extracted" class="level2">
<h2 class="anchored" data-anchor-id="projects-extracted">Projects Extracted</h2>
<ol type="1">
<li><p><strong>Build a Medallion Architecture</strong><br>
<a href="https://learning.oreilly.com/library/view/databricks-certified-data/9781098166823/ch05.html#comparison_of_ingestion_mechanisms">Reference: Comparison of Ingestion Mechanisms</a></p></li>
<li><p><strong>Implement DLT Pipeline</strong></p></li>
</ol>


</section>

 ]]></description>
  <category>data</category>
  <guid>https://datagan.site/systems/pyspark.html</guid>
  <pubDate>Mon, 10 Nov 2025 18:30:00 GMT</pubDate>
</item>
<item>
  <title>Netflix Games: Detecting Broken Gameplay Using Log Clustering</title>
  <link>https://datagan.site/systems/netflix_cluster_logs.html</link>
  <description><![CDATA[ 





<p>At Netflix, the SRE team for Netflix Games focuses on monitoring key network performance metrics such as latency bitrate and packet loss<br>
However, these metrics alone don’t always reveal when a game is actually <em>broken</em> from the player’s perspective.</p>
<hr>
<section id="the-challenge" class="level2">
<h2 class="anchored" data-anchor-id="the-challenge">The Challenge</h2>
<p>In some countries, popular Netflix games remained broken for up to three weeks — clearly unacceptable for player experience.<br>
Traditional indicators, such as:</p>
<ul>
<li>Gameplay duration</li>
<li>User feedback forms</li>
</ul>
<p>were too weak to reliably detect broken games.</p>
<p>To address this, the team decided to focus deeply on one strong signal:</p>
<blockquote class="blockquote">
<p><strong>Gameplay time &lt; 120 seconds</strong></p>
</blockquote>
<p>This metric served as a practical proxy for identifying failed or frustrating game sessions.</p>
<hr>
</section>
<section id="the-approach-log-clustering-pipeline" class="level2">
<h2 class="anchored" data-anchor-id="the-approach-log-clustering-pipeline">The Approach: Log Clustering Pipeline</h2>
<p>To understand the root causes behind short gameplay sessions, the team developed a log clustering pipeline<br>
The process includes the following stages:</p>
<section id="selection-filtering" class="level3">
<h3 class="anchored" data-anchor-id="selection-filtering">1. Selection &amp; Filtering</h3>
<ul>
<li>Select logs containing relevant keywords such as <code>exception</code>, <code>error</code>, and <code>warning</code>.</li>
</ul>
</section>
<section id="preprocessing" class="level3">
<h3 class="anchored" data-anchor-id="preprocessing">2. Preprocessing</h3>
<ul>
<li>Mask PII (Personally Identifiable Information) to ensure privacy.<br>
</li>
<li>Keep only the first line of multi-line logs for consistency.<br>
</li>
<li>Normalize dynamic content (e.g., timestamps, IDs) to reduce noise and minimize the number of distinct log entries.</li>
</ul>
</section>
<section id="vectorization" class="level3">
<h3 class="anchored" data-anchor-id="vectorization">3. Vectorization</h3>
<ul>
<li>Convert log text into numerical vectors using the Sentence Transformer package.</li>
</ul>
</section>
<section id="clustering" class="level3">
<h3 class="anchored" data-anchor-id="clustering">4. Clustering</h3>
<ul>
<li>Apply DBSCAN (Density-Based Spatial Clustering of Applications with Noise) to group similar log messages.</li>
</ul>
<hr>
</section>
</section>
<section id="results" class="level2">
<h2 class="anchored" data-anchor-id="results">Results</h2>
<ul>
<li>From over 20 million lines of logs**, the process produced approximately 130 meaningful clusters, each pointing to a distinct problem area.<br>
</li>
<li>The results were evaluated using a confusion matrix, measuring:
<ul>
<li><strong>Precision</strong></li>
<li><strong>Recall</strong></li>
<li><strong>F1 Score</strong></li>
</ul></li>
</ul>
<hr>
</section>
<section id="current-status-future-work" class="level2">
<h2 class="anchored" data-anchor-id="current-status-future-work">Current Status &amp; Future Work</h2>
<ul>
<li>The system currently runs hourly, providing near-real-time insights into potential issues.<br>
</li>
<li>The next step for the team is to reduce alerting latency to improve detection and response speed even further.</li>
</ul>
<hr>
<p><em>Source: <a href="https://www.usenix.org/conference/srecon25americas/presentation/neidel">Netflix Games Talk — SREcon25 Americas</a></em></p>


</section>

 ]]></description>
  <category>observability</category>
  <guid>https://datagan.site/systems/netflix_cluster_logs.html</guid>
  <pubDate>Tue, 04 Nov 2025 18:30:00 GMT</pubDate>
</item>
</channel>
</rss>
