<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by 簡嘉炫 Po Jian on Medium]]></title>
        <description><![CDATA[Stories by 簡嘉炫 Po Jian on Medium]]></description>
        <link>https://medium.com/@tses89214?source=rss-c24d93f068bb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IwSUW6oJ_uvHZPDhiTFJnQ.png</url>
            <title>Stories by 簡嘉炫 Po Jian on Medium</title>
            <link>https://medium.com/@tses89214?source=rss-c24d93f068bb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 22:09:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tses89214/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Rise & Slime Data Pipeline]]></title>
            <link>https://medium.com/@tses89214/rise-slime-data-pipeline-728c26f34e1e?source=rss-c24d93f068bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/728c26f34e1e</guid>
            <category><![CDATA[apache-kafka]]></category>
            <category><![CDATA[apache-flink]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <dc:creator><![CDATA[簡嘉炫 Po Jian]]></dc:creator>
            <pubDate>Wed, 04 Nov 2026 07:07:57 GMT</pubDate>
            <atom:updated>2026-11-04T07:07:57.355Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>A side project: a game produces events, the events flow through a Collector → Kafka → Flink → ClickHouse, and end up in a homemade dashboard.</blockquote><p>As a data engineer, the hardest part of learning data engineering tools is that you have no data source that “generates events by itself.” So I built an idle game, Rise &amp; Slime, as a practice exercise for streaming technology.</p><p>Every action from the player (and a crowd of simulated players) is an event sent into a complete pipeline. The game itself is covered in <a href="https://medium.com/@tses89214/rise-slime-a-small-idle-game-about-a-slime-bakery-d1690c0aa9b8">here</a>. This post focuses on the pipeline behind it and what you can do with the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aeTBGucj-2mkwbMc8igGZw.png" /></figure><h3>Where the Data Comes From</h3><p>Rise &amp; Slime is a slime bakery idle game: players assign slimes to the Farm, Mill and Bakery to produce goods, sell bread for coins, then use the coins to buy more slimes, upgrade and merge. Every player action becomes an event (starting a game, purchases, upgrades, merges, a production snapshot every 5 seconds… 11 types in total). The game produces a steady stream of meaningful, structured events.</p><h3>Architecture</h3><p>Browser game / simulated-player bots → Collector (Python FastAPI) → Kafka → Flink SQL → ClickHouse → homemade HTML dashboard (uPlot)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C9Gavh9buhDt0vdVfjHbXw.png" /></figure><p>Each component has one job:</p><ul><li><strong>Game / bots</strong>: the source of events. The game core is one shared codebase: browsers run real players, Node runs simulated ones.</li><li><strong>Collector (Python FastAPI)</strong>: the entry point of the pipeline. It validates the format. A valid event gets the Collector’s own receive time (ingested_at) and is written to Kafka&#39;s events topic; an invalid one is written to the Dead Letter Queue together with the original payload and the error reason. It also happens to serve read-only queries for the dashboard.</li><li><strong>Kafka</strong>: buffering and replay. It takes in the Collector’s events, lets Flink and ClickHouse each read at their own pace, and lets me start over from the beginning when data goes wrong.</li><li><strong>Flink SQL</strong>: stream computation. It flattens events, deduplicates them, aggregates them into 1-minute windows, and handles late events. The results are written back to Kafka.</li><li><strong>ClickHouse</strong>: storage and queries. It keeps the raw events, the window results, each player’s latest state and the dead letters, pulling data in through its own Kafka engine.</li><li><strong>Dashboard</strong>: presentation only. It reads ClickHouse with fixed queries and draws charts with uPlot.</li></ul><p>A few design points:</p><ul><li>The game core is pure TypeScript with no dependency on the screen, so the same rules can run in Node as bots, producing lots of players without opening a browser.</li><li><strong>There is only one event format</strong>: it is defined with zod, the game and bots import it directly, and the Collector validates against the JSON Schema exported from it.</li><li><strong>Invalid events are never dropped</strong>: an event with a bad format goes to the dead-letter topic (events.dlq) with the error reason attached.</li><li><strong>The simulated players deliberately make the data dirty</strong>: duplicate events, malformed events, and resending after a disconnect (which makes events late). A pipeline only counts as a real pipeline if it has to face these.</li><li>Flink deduplicates with SQL and aggregates in 1-minute windows. Windows accept events up to 15 minutes late and recompute; ClickHouse uses ReplacingMergeTree to take the updates.</li><li><strong>Schema evolution</strong>: events of old and new versions exist side by side, and the same pipeline handles both.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nLn7RMLPyQqvzFb4qlUahw.png" /></figure><h3>Design Trade-offs</h3><p>The above is the result. This section covers a few places where I hesitated while making choices.</p><h4>Why use Flink for aggregation instead of just flattening and letting ClickHouse do it</h4><p>To be honest, at this data volume ClickHouse could do the aggregation on its own: no watermarks, no upserts, and one less system to maintain. I still chose Flink because what this project is meant to practice is exactly the hardest parts of stream processing: event time, watermarks, and stateful deduplication. The cost is also clear: the section “Not trusting the client’s clock” below is the tuition I paid for using Flink. If the goal were only a correct dashboard, I would take the simpler route.</p><p>Flink also doesn’t write directly into ClickHouse. It writes back to Kafka ch.* topics, and ClickHouse&#39;s Kafka engine pulls from there. That adds a layer of topics and a few Kafka-engine tables, but it buys three things: when ClickHouse goes down, Flink doesn&#39;t go down with it; ClickHouse decides how fast to read; and when a table breaks, resetting the offset is enough to rebuild it.</p><h4>Reading the same topic three times</h4><p>In Flink, the events topic is declared as three source tables, each with its own consumer group and watermark:</p><ul><li><strong>raw</strong>: the whole line as a string. ClickHouse’s payload column needs to keep the original JSON, and parsing with the json format drops any fields that weren&#39;t declared, so I need a copy that isn&#39;t parsed.</li><li><strong>typed</strong>: parsed into typed columns, with a declared watermark, for window aggregation.</li><li><strong>sent</strong>: the clock is switched to sent_at, used only to count late events. Windows built on event time simply drop late events, so you could never see them there.</li></ul><p>The cost is that Kafka is read three times as much; the benefit is that the offsets and watermarks of the three processing lines don’t interfere with each other.</p><h4>Late events: wait a little, and still fix things afterward</h4><p>I use two layers of tolerance: the watermark decides when a window is emitted “for the first time” (the shorter one), and allowed lateness decides how long after that it can still be corrected (the longer one). If a late event arrives within the tolerance period, the window is emitted again with the updated result.</p><p>So what Flink writes to Kafka is an upsert: the key is the window, the value is the cumulative total for the whole window rather than an increment, together with a version that only ever grows (the number of events in the window). On the ClickHouse side I use ReplacingMergeTree(version): at merge time, only the row with the largest version is kept for each window, and queries add FINAL. Because what is stored is the cumulative total, &quot;new overwrites old&quot; only needs a comparison of sizes, and I never need to know the order in which events arrived.</p><p>There are two costs: every late event makes the window be re-emitted, which amplifies writes; and events past the tolerance period are dropped at the Flink layer, with no error and no DLQ entry. I accept this because the raw events table has no windows and doesn’t lose a single row, so reconciling the two sides shows exactly how much is missing.</p><h4>Three engines in ClickHouse, each with its own job</h4><ul><li><strong>events (raw events)</strong>: ReplacingMergeTree with no version: rows with the same sorting key are duplicates. Flink&#39;s deduplication state expires, and resubmitting the job re-reads Kafka, so this is the last line of defense against duplicates.</li><li><strong>*_1m (window results)</strong>: ReplacingMergeTree(version), as in the previous section.</li><li><strong>player_state (each player&#39;s latest state)</strong>: AggregatingMergeTree with argMax, min and max. Replacing can&#39;t be used here because it replaces the whole row: an event of another type has no coin field and would overwrite the coins with an empty value, and a late, older event would even make the coins go backward. argMax(coins, event_time) means &quot;the coins from the row with the latest time,&quot; and the result is the same no matter whether events are duplicated or arrive out of order.</li></ul><h4>Not trusting the client’s clock</h4><p>event_time and sent_at are both filled in by the client; only ingested_at comes from the collector&#39;s clock. Flink&#39;s watermark takes the largest event_time, so I worked through a scenario (derived only by reading the code, not reproduced): a browser whose clock is an hour fast sends one event, the watermark is pushed into the future, and other players&#39; perfectly normal events are treated as too late by the windows and dropped. The format is valid, so they don&#39;t go to the DLQ; and the late-event monitoring can&#39;t see it either, because the sent_at and event_time it relies on come from the same broken clock, so subtracting one from the other cancels the error out.</p><p>Each of these three mechanisms looks reasonable on its own: validate only the format, never move the watermark backward, clear state once it expires. But stacked together, they fail quietly.</p><p>My fix is for the Collector to compare event_time with the receive time for events coming from browsers, and send them to the DLQ if the gap is outside a reasonable range. Bots aren&#39;t checked, because fast-forward and resending after a disconnect naturally make those two times differ a lot. One hole remains: the client field is also filled in by the client itself, so if this were ever opened to the public, it would need authentication or signing.</p><h4>Schema evolution: only add, never change the meaning</h4><p>Events of v1 and v2 exist side by side. v2 only adds new event types and optional fields and never changes the meaning of an existing field, so a v1 event is still valid under the v2 schema and downstream doesn’t need to branch on version. The original JSON is stored in full in payload, so a new event type doesn&#39;t even require changing ClickHouse&#39;s tables.</p><p>If I ever have to make an incompatible change (for example, changing a unit), my plan is to store the original as-is and convert it to the standard unit in the derived layer based on schema_version, rather than opening a separate table for each version. Splitting tables would tear apart the events one player sends under different versions over time, and the leaderboard could no longer pick up the latest value. This part exists only as a design so far; I haven&#39;t actually run into it.</p><h4>How I Know the Numbers Are Right</h4><p>A dashboard that “looks reasonable” doesn’t count. I reconciled Flink’s windows against ClickHouse’s raw events table minute by minute (event counts, bread sold, output per station), and all the windows that had been emitted matched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GHZl3jNhZPO1ZJ23dQCp6A.png" /></figure><p>The dashboard shows data produced by the simulated players (bots): output and queues per station, player activity, late events, pipeline latency, and the most recent dead letters.</p><h3>Try It</h3><ul><li>Play the game: <a href="https://tses89214.itch.io/rise-slime">https://tses89214.itch.io/rise-slime</a></li><li>Source code (MIT): <a href="https://github.com/tses89214/Rise-Slime">https://github.com/tses89214/Rise-Slime</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=728c26f34e1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rise & Slime 數據管線]]></title>
            <link>https://medium.com/@tses89214/rise-slime-%E6%95%B8%E6%93%9A%E7%AE%A1%E7%B7%9A-84957da1cd00?source=rss-c24d93f068bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/84957da1cd00</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <category><![CDATA[data-pipeline]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[clickhouse]]></category>
            <dc:creator><![CDATA[簡嘉炫 Po Jian]]></dc:creator>
            <pubDate>Wed, 04 Nov 2026 06:53:54 GMT</pubDate>
            <atom:updated>2026-11-04T06:53:54.741Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>一個 side project：遊戲產生事件，事件經過 Collector → Kafka → Flink → ClickHouse，最後到一個自製的儀表板。</blockquote><p>作為一名數據工程師。要學習數據工程相關技術時，最難的是沒有「會自己產生事件」的資料來源，所以我做了一款放置遊戲 Rise &amp; Slime，來作為 Streaming 技術的練習題。</p><p>玩家（和一群模擬玩家）的每個動作都是一筆事件，送進一條完整的管線。遊戲本身的介紹在<a href="https://medium.com/@tses89214/rise-slime-%E4%B8%80%E6%AC%BE%E9%97%9C%E6%96%BC%E5%8F%B2%E8%90%8A%E5%A7%86%E9%BA%B5%E5%8C%85%E5%9D%8A%E7%9A%84%E5%B0%8F%E5%9E%8B%E6%94%BE%E7%BD%AE%E9%81%8A%E6%88%B2-e6dc4d4bea48">另一篇</a>，這裡專講後面的 Pipeline 和數據應用。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aeTBGucj-2mkwbMc8igGZw.png" /></figure><h3>數據從哪來</h3><p>Rise &amp; Slime 是一款史萊姆麵包坊放置遊戲：玩家把史萊姆派到 Farm、Mill、Bakery 生產，賣麵包賺金幣，再買史萊姆、升級、合成。玩家的每個動作都會變成一筆事件（開始遊戲、購買、升級、合成、每 5 秒一筆的產量快照……共 11 種）。它會源源不絕地產生有意義、有結構的事件。</p><h3>整體架構</h3><p>瀏覽器遊戲／模擬玩家 bots → Collector（Python FastAPI）→ Kafka → Flink SQL → ClickHouse → 自製 HTML 儀表板（uPlot）</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C9Gavh9buhDt0vdVfjHbXw.png" /></figure><p>每個元件各管一件事：</p><ul><li><strong>遊戲／bots<br></strong>事件的來源。遊戲核心是同一份程式，瀏覽器跑真玩家，Node 跑模擬玩家。</li><li><strong>Collector（Python FastAPI）<br></strong>管線的入口。驗證格式，合格的事件打上自己的收件時間（ingested_at）後寫進 Kafka 的 events，不合格的連同原文與錯誤原因寫進 Dead Letter Queue。它也順便提供儀表板用的唯讀查詢。</li><li><strong>Kafka<br></strong>緩衝與重放。收下 Collector 的事件，讓 Flink 和 ClickHouse 各自照自己的速度讀，也讓數據壞了可以從頭再來。</li><li><strong>Flink SQL<br></strong>串流計算。把事件攤平、去重，切成 1 分鐘視窗彙總，並處理遲到事件。結果再寫回 Kafka。</li><li><strong>ClickHouse<br></strong>儲存與查詢。存原始事件、視窗結果、每個玩家的最新狀態和 dead letters，由它自己的 Kafka 引擎把數據拉進來。</li><li><strong>儀表板<br></strong>只負責呈現，用固定的查詢讀 ClickHouse，用 uPlot 畫圖。</li></ul><p>幾個設計重點：</p><ul><li>遊戲核心是純 TypeScript、不依賴畫面，所以同一份規則能在 Node 裡跑成 bots，不用開瀏覽器就能產生大量玩家。</li><li><strong>事件格式只有一份</strong>：用 zod 定義，遊戲和 bots 直接引用，Collector 讀它匯出的 JSON Schema 驗證。</li><li><strong>無效事件不丟棄</strong>：格式不對的事件進 dead-letter topic（events.dlq），附上錯誤原因。</li><li><strong>模擬玩家會故意把數據弄髒</strong>：重複事件、格式錯誤、斷線後補送（於是事件遲到）。管線要面對這些才算是真的管線。</li><li>Flink 用 SQL 去重，並以 1 分鐘視窗彙總，視窗允許 15 分鐘的遲到事件並重新計算；ClickHouse 用 ReplacingMergeTree 接收更新。</li><li><strong>schema 演進</strong>：新舊版本的事件同時存在，同一條管線都能處理。</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nLn7RMLPyQqvzFb4qlUahw.png" /></figure><h3>設計取捨</h3><p>上面是結果。這一節講幾個我做選擇時猶豫過的地方。</p><h4>為什麼聚合要用 Flink，而不是只攤平再交給 ClickHouse</h4><p>老實說，這個數據量讓 ClickHouse 自己算就夠了：不需要 watermark、不需要 upsert，也少維護一個系統。我還是選了 Flink，因為這個專案要練的，正是串流處理最難的那幾件事：event time、watermark、有狀態的去重。代價也很明確，後面「不信任 client 的時鐘」那一段，就是用 Flink 付出的學費。如果目標只是一個正確的儀表板，我會選比較簡單的那條路。</p><p>Flink 也不直接寫進 ClickHouse，而是寫回 Kafka 的 ch.* topic，再由 ClickHouse 的 Kafka 引擎去拉。多了一層 topic 和幾張 Kafka 引擎表，換來三件事：ClickHouse 掛掉時 Flink 不會跟著壞；ClickHouse 自己決定讀多快；表壞了，重設 offset 就能重建。</p><h4>同一個 topic 讀三次</h4><p>events 這個 topic 在 Flink 裡被宣告成三張 source table，各自有 consumer group 和 watermark：</p><ul><li><strong>raw</strong>：整行當字串。ClickHouse 的 payload 欄位要保留原始 JSON，而用 json format 解析會丟掉沒宣告的欄位，所以需要一份不解析的。</li><li><strong>typed</strong>：解析成有型別的欄位，並宣告 watermark，給視窗聚合用。</li><li><strong>sent</strong>：時鐘改成 sent_at，專門用來數遲到事件。以 event time 開的視窗會直接丟掉遲到事件，用它根本看不到。</li></ul><p>代價是 Kafka 被讀三倍；好處是三條處理線的 offset 與 watermark 互不干擾。</p><h4>遲到事件：先等一下，之後還能修正</h4><p>我用兩層容忍：watermark 決定視窗「第一次」何時送出（比較短），allowed lateness 決定送出之後還能修正多久（比較長）。遲到事件在容忍期內到達，視窗就用更新後的結果重新送出。</p><p>所以 Flink 輸出到 Kafka 的是 upsert：key 是視窗，value 是整個視窗的累計值而不是增量，並帶一個只增不減的 version（視窗內的事件數）。ClickHouse 端用 ReplacingMergeTree(version)，merge 時同一個視窗只留 version 最大的那列，查詢時加 FINAL。因為存的是累計值，新蓋舊只需要比大小，完全不用知道事件的到達順序。</p><p>代價有兩個：每筆遲到事件都會讓視窗重送一次，寫入被放大；超過容忍期的事件在 Flink 這層會被丟掉，沒有錯誤，也不進 DLQ。我接受這個代價，是因為原始事件表沒有視窗，一筆都不少，兩邊對帳就看得出差多少。</p><h4>ClickHouse 裡三種引擎，各管一件事</h4><ul><li><strong>events（原始事件）</strong>：ReplacingMergeTree，沒有 version，排序鍵相同就是重複。Flink 的去重 state 會過期，重新提交 job 也會重讀 Kafka，所以它是去重的最後一道防線。</li><li><strong>*_1m（視窗結果）</strong>：ReplacingMergeTree(version)，如上一段。</li><li><strong>player_state（每個玩家的最新狀態）</strong>：AggregatingMergeTree，搭配 argMax、min、max。這裡不能用 Replacing，因為它是整列取代：別種事件沒有金幣欄位，會把金幣蓋成空的；一筆晚到的舊事件還會讓金幣倒退。argMax(coins, event_time) 是「時間最大那筆的金幣」，事件重複、亂序到達，結果都一樣。</li></ul><h4>不信任 client 的時鐘</h4><p>event_time 和 sent_at 都是 client 填的，只有 ingested_at 是 collector 的時鐘。Flink 的 watermark 取最大的 event_time，所以我推演過一個情境（只從程式碼推演，沒有實際重現）：一個時鐘快了一小時的瀏覽器送出一筆事件，watermark 被推到未來，其他玩家正常的事件反而被視窗當成太晚而丟掉。格式合法，所以不會進 DLQ；遲到監控也看不到，因為它用的 sent_at 和 event_time 來自同一個壞時鐘，兩者相減剛好抵銷。</p><p>這三個機制單看都合理：只驗格式、watermark 不倒退、過期就清狀態。<br>但疊在一起才會悄悄出錯。</p><p>我的處理是在 collector 對來自瀏覽器的事件比對 event_time 與收到的時間，差距超出合理範圍就送進 DLQ。bots 不檢查，因為快轉和斷線補送本來就會讓這兩個時間差很多。還有一個沒補上的洞：client 這個欄位也是 client 自己填的，真要對外開放，就得改成認證或簽章。</p><h4>schema 演進：只新增，不改意思</h4><p>v1 和 v2 的事件並存。v2 只新增事件類型和可選欄位，不改既有欄位的意思，所以 v1 事件在 v2 的 schema 下仍然合法，下游不必依版本分支。原始 JSON 完整存進 payload，新的事件類型連 ClickHouse 的表都不用改。</p><p>如果哪天真的要做不相容的變更（例如改單位），我的打算是原文照存，在衍生層依 schema_version 轉成標準單位，而不是為每個版本開一張表。分表會讓同一個玩家先後送出的不同版本事件被拆開，排行榜就取不到最新值。這一塊目前只有設計，還沒有實際遇到。</p><h4>怎麼知道算對了</h4><p>儀表板「看起來合理」不算數。我拿 ClickHouse 的原始事件表逐分鐘對帳 Flink 算出來的視窗（事件數、麵包銷售量、各站產量），已輸出的視窗都吻合。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GHZl3jNhZPO1ZJ23dQCp6A.png" /></figure><p>儀表板顯示的是模擬玩家（bots）產生的數據：各站產量與佇列、玩家活動、遲到事件、管線延遲，以及最近的 dead letters。</p><h3>試試看</h3><ul><li>試玩這款遊戲：<a href="https://tses89214.itch.io/rise-slime">https://tses89214.itch.io/rise-slime</a></li><li>原始碼（MIT）：<a href="https://github.com/tses89214/Rise-Slime">https://github.com/tses89214/Rise-Slime</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84957da1cd00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rise & Slime: Slime Bakery Idle Game]]></title>
            <link>https://medium.com/@tses89214/rise-slime-a-small-idle-game-about-a-slime-bakery-d1690c0aa9b8?source=rss-c24d93f068bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1690c0aa9b8</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[indie-game]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[gaming]]></category>
            <dc:creator><![CDATA[簡嘉炫 Po Jian]]></dc:creator>
            <pubDate>Wed, 04 Nov 2026 06:09:19 GMT</pubDate>
            <atom:updated>2026-11-04T07:08:46.593Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Play it free in your browser: </strong><a href="https://tses89214.itch.io/rise-slime"><strong>https://tses89214.itch.io/rise-slime</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aeTBGucj-2mkwbMc8igGZw.png" /></figure><p>You run a bakery, and your staff is a bunch of round, bouncy slimes. You don’t have to keep clicking. Just put them in the right places and watch the numbers grow.</p><h3>A Very Short Production Line</h3><ul><li><strong>Farm</strong>: each slime grows 1 wheat per second.</li><li><strong>Mill</strong>: each slime grinds 2 wheat into 1 flour.</li><li><strong>Bakery</strong>: each slime bakes 2 flour into 1 loaf of bread.</li><li><strong>Shop</strong>: each loaf sells for 10 coins, and slime customers actually walk up to the door to buy it.</li></ul><p>A station can’t start working until the one before it supplies the ingredients, so piling on more slimes isn’t always better. Every station has a queue bar whose color tells you whether the input is running short (starved), just right, starting to pile up, or completely backed up. The in-game hint: a slime ratio of roughly 4:6:5 keeps all three stations busy.</p><h3>Where the Money Goes</h3><ul><li><strong>Buy new slimes.</strong> They start in the Lounge, and you assign them to a station from there.</li><li><strong>Upgrade a station</strong>: each level makes it 10% faster, and the speed doubles again at levels 10, 25 and 50.</li><li><strong>Expand a station</strong>: every station starts with 10 slots, and you can pay for more once they’re full.</li></ul><h3>Merging and Traits</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BTQj-Qj2OO_zrtCs_YpUTQ.png" /></figure><p>After a while you unlock <strong>merging</strong>: combine 3 slimes of the same tier from the Lounge into 1 slime of the next tier. It’s a trade-off. Three slimes for one means about 17% less total output, but it frees up 2 slots.</p><p>Merging also has a chance to <strong>mutate</strong> a slime into one with a trait, which glows a different color:</p><ul><li><strong>Leaf</strong>: strong at the Farm, weak at the Bakery.</li><li><strong>Stone</strong>: strong at the Mill, weak at the Farm.</li><li><strong>Flame</strong>: strong at the Bakery, weak at the Mill.</li><li><strong>Lucky</strong>: no bonus and no penalty, but merging with it doubles the mutation chance.</li></ul><p>Every trait has a weakness somewhere, so “who goes where” becomes a small puzzle of its own.</p><h3>Odds and Ends</h3><ul><li>All the art is original pixel art, generated by a script. The fonts, music and sound effects are CC0, and all of them are listed in CREDITS.</li><li>There are achievements, achievement pop-ups, and a Help button that explains the full rules.</li><li>The code is open source (MIT). <br><a href="https://github.com/tses89214/Rise-Slime">https://github.com/tses89214/Rise-Slime</a></li></ul><h3>The Other Side of the Game</h3><p>This game has a second identity. Every action in it becomes an event and flows into a real-time data pipeline (Kafka, Flink, ClickHouse). The version on itch.io contains no event-sending code at all. I wrote about the pipeline side in a separate post: <a href="https://medium.com/@tses89214/rise-slime-data-pipeline-728c26f34e1e">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1690c0aa9b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rise & Slime:史萊姆麵包坊放置遊戲]]></title>
            <link>https://medium.com/@tses89214/rise-slime-%E4%B8%80%E6%AC%BE%E9%97%9C%E6%96%BC%E5%8F%B2%E8%90%8A%E5%A7%86%E9%BA%B5%E5%8C%85%E5%9D%8A%E7%9A%84%E5%B0%8F%E5%9E%8B%E6%94%BE%E7%BD%AE%E9%81%8A%E6%88%B2-e6dc4d4bea48?source=rss-c24d93f068bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6dc4d4bea48</guid>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[indie-game]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[game-design]]></category>
            <dc:creator><![CDATA[簡嘉炫 Po Jian]]></dc:creator>
            <pubDate>Wed, 04 Nov 2026 06:03:39 GMT</pubDate>
            <atom:updated>2026-11-04T07:09:58.648Z</atom:updated>
            <content:encoded><![CDATA[<p>試玩（瀏覽器直接玩，免費）<br><a href="https://tses89214.itch.io/rise-slime">https://tses89214.itch.io/rise-slime</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aeTBGucj-2mkwbMc8igGZw.png" /></figure><p>你經營一間麵包坊，員工是一群圓滾滾的史萊姆。你不用一直點，只要把牠們放到對的位置，看數字慢慢長大。</p><h3>一條很短的生產線</h3><ul><li><strong>Farm</strong>:每隻史萊姆每秒種出 1 份小麥。</li><li><strong>Mill</strong>:每隻史萊姆把 2 份小麥磨成 1 份麵粉。</li><li><strong>Bakery</strong>:每隻史萊姆把 2 份麵粉烤成 1 條麵包。</li><li><strong>Shop</strong>:每條麵包賣 10 金幣，史萊姆顧客會真的跑來店門口買。</li></ul><p>一個站得等前一個站供料才會開工，所以不是塞越多越好。每個站有一條「佇列條」，顏色會告訴你原料是不夠(飢餓)、剛好、開始堆積，還是已經卡住。遊戲裡的提示是:大約 4 : 6 : 5 的人數比例，能讓三個站都忙起來。</p><h3>賺到的錢怎麼花</h3><ul><li><strong>買新史萊姆，</strong>先放在 Lounge，再派到站上。</li><li><strong>升級工作站</strong>:每級快 10%，到第 10、25、50 級速度再翻倍。</li><li><strong>擴充名額</strong>:每個站一開始 10 個位子，滿了可以花錢加。</li></ul><h3>合成與特性</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BTQj-Qj2OO_zrtCs_YpUTQ.png" /></figure><p>玩到一段時間會解鎖<strong>合成</strong>:把 Lounge 裡 3 隻同階的史萊姆合成 1 隻高一階的。這是個有取捨的決定，3 隻換 1 隻，總產量約少 17%，但能空出 2 個位子。</p><p>合成時有機會讓史萊姆<strong>變異</strong>出特性，會發出不同顏色的光:</p><ul><li><strong>Leaf</strong>:在 Farm 特別強，在 Bakery 變弱。</li><li><strong>Stone</strong>:在 Mill 特別強，在 Farm 變弱。</li><li><strong>Flame</strong>:在 Bakery 特別強，在 Mill 變弱。</li><li><strong>Lucky</strong>:沒有加成也沒有減益，但帶著它合成，變異機率會翻倍。</li></ul><p>每種特性都在某個地方吃虧，所以「誰放哪一站」是個小小的配置問題。</p><h3>瑣碎細節</h3><ul><li>畫面全部是原創像素美術，用腳本產生;字型、音樂與音效是 CC0 素材，都列在 CREDITS 裡。</li><li>遊戲裡有成就、成就解鎖的提示，以及一個 Help 按鈕講完整規則。</li><li>程式是開源的(MIT)，https://github.com/tses89214/Rise-Slime。</li></ul><h3>另一個身份</h3><ul><li>這款遊戲其實還有另一個身分:它的每個動作都會變成一筆事件，送進一條即時資料管線(Kafka、Flink、ClickHouse)，作為一個作品集。</li><li>上架到 itch.io 的版本不含任何事件傳送程式碼。</li><li>管線那一側我另外寫了一篇: <a href="https://medium.com/@tses89214/rise-slime-%E6%95%B8%E6%93%9A%E7%AE%A1%E7%B7%9A-84957da1cd00">請見這裡</a>。</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6dc4d4bea48" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[The Evolution of Our Data Team] Insight Portal]]></title>
            <link>https://medium.com/@tses89214/the-evolution-of-our-data-team-insight-portal-453a9447b7e2?source=rss-c24d93f068bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/453a9447b7e2</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[簡嘉炫 Po Jian]]></dc:creator>
            <pubDate>Tue, 20 Oct 2026 07:10:00 GMT</pubDate>
            <atom:updated>2026-10-20T07:10:00.055Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdG-ZwamWd185wYoyVnDSw.png" /><figcaption><em>Photo by Lukas on Pexels</em></figcaption></figure><p>This post is the third AI post in the series “The Evolution of Our Data Team” (AI 3). For the full list, see the <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">series index</a>.</p><p>Once the Insight Reports are done, how do we get people to come and read them on their own? This post describes the Insight Portal we built: an internal entry point that presents our work in one place and manages access permissions centrally.</p><h4>Background</h4><p>In the post on Insight Reports (<a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-data-insight-reports-strategy-3cf63eb17c97">Strategy</a>), we said the problems we wanted to address were “the data team’s efforts aren’t reflected in operating results” and “everyone has their own stance, and the company can’t clearly say what direction to take next.” To solve these, we developed the Insight Report program.</p><p>At first, we wanted to simply email the reports to our boss or related units. But on reflection, that would drop us back into the “requesting unit ↔ Data Team” loop, and information still wouldn’t flow.</p><p>So the next thing we thought of was to build a single outward-facing entry point for ourselves. (“Outward” here means toward the company’s other internal requesting units, not toward consumers.) All of the Data Team’s output would be placed there, so people could browse and read it whenever they need it, and the information we provide would be right there.</p><p>So we decided to build an internal website for the company, the <strong><em>Insight Portal</em></strong>. We hope to cultivate in users the habit of checking the Data Team’s output on the Portal at any time.</p><h4>What Is on It Today</h4><ul><li><strong>Insight Reports</strong><br> Each quarter’s market share or public sentiment analysis report, with folders controlling which content each region can see.</li><li><strong>Services built by the Data Team</strong><br> Web pages, admin back-ends, and so on that we developed ourselves for other units to use.</li><li><strong>Dashboards or services from other teams</strong><br> Those units first built a prototype with AI (vibe coding), and we then took it over and extended it, adding real data connections and update mechanisms so that they can keep running.</li></ul><h4>Results</h4><ol><li>The Insight Portal has been live for several months. I designed and developed the whole thing, and it is hosted on Databricks Apps. The deployment process has been written as Skills and can be deployed in one step. Adding an Insight Report only requires putting the file into the designated folder. Adding a service means the service owner provides the code, and after review it is hosted as a plug-in page through a submodule.</li><li>About ten to twenty people from the operations teams are involved. Every one of them has logged in at least once, and some come back every week or two. The user base isn’t large (the number of people in the relevant units is small to begin with), but we do see sustained return visits, from Taiwan, the US, and other countries. After we send out an Insight Report update email, we also see people clicking through to read it. That in itself is direct proof that we have solved the original problem of “written, but nobody reads it.”</li><li>The platform has also truly grown. Besides the Insight Reports, it currently hosts 2 services from the Data Team and 3 dashboards or services from other teams, with more under discussion and development. And these are all working services, not mockups.</li><li>One kind of request deserves special mention. We have been receiving mockups of dashboards or operations systems that operations units drew themselves with Claude. Because they aren’t connected to real APIs or databases, the business units come to ask, “Can you make this page work?” It is also because this platform laid the foundation that we can take on this kind of request. This kind of work is now becoming one of the team’s main services.</li><li>This shift in working style felt a little uncomfortable to team members at first. But from another angle, it is actually the most direct and closest-to-the-requester approach: the requester first draws what they want, we skip the interview-and-clarify step, and we directly take over and make it work. They design their own system themselves, and the need is solved at the moment of use.</li></ol><p>That’s it for this post. For the rest of the series, see: <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=453a9447b7e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[The Evolution of Our Data Team] Data Insight Reports (Implementation)]]></title>
            <link>https://medium.com/@tses89214/the-evolution-of-our-data-team-data-insight-reports-implementation-e38a0f210a3d?source=rss-c24d93f068bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/e38a0f210a3d</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[簡嘉炫 Po Jian]]></dc:creator>
            <pubDate>Tue, 20 Oct 2026 07:05:06 GMT</pubDate>
            <atom:updated>2026-10-20T07:23:30.771Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdG-ZwamWd185wYoyVnDSw.png" /><figcaption><em>Photo by Lukas on Pexels</em></figcaption></figure><p>This post is the second AI post in the series “The Evolution of Our Data Team” (AI 2). For the full list, see the <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">series index</a>.</p><p>Getting an AI to generate a report is easy. Getting it to generate a correct, internally consistent report every time is hard. This post describes how we designed a process that sandwiches the LLM between two layers of deterministic code.</p><h4>Background</h4><p>As described in the previous post, <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-data-insight-reports-strategy-3cf63eb17c97">Data Insight Reports (Strategy)</a>, we set out to build a market share Insight Report, including a discussion of how market size shifts across countries and brands. We also mentioned that we use Databricks Genie to implement it. (Genie is a Text-to-SQL AI tool that can connect to databases.)</p><p>Our original design was actually this: a Python ETL that, when the time came, sent a request to Genie’s endpoint and then stuffed the returned text into an HTML template with placeholders. Simple and direct. As long as we set up clear enough analysis logic, descriptions, and customary analysis SQL in Genie, things should run smoothly.</p><p>But it wasn’t as simple as we had naively assumed. We gradually ran into several problems:</p><ol><li><strong>Consistency of viewpoint</strong><br> Genie can answer a single question, but besides about ten individual questions, we also need a summary of the <em>whole</em> report. For example, after discussing the future shifts among countries in various ways, we need a conclusion that says, “What should you do now, and who should you focus on next?”<br> We could perhaps treat this as just another single question, but we found that the first answer might say A and the second B, and the summary should be A+B, yet it would give us A+C. That’s before we even get to the inconsistency of stance and viewpoint between different questions. Sometimes one question says the market is rising while another question in the same report says it is falling.</li><li><strong>Writing style</strong><br> Genie’s writing style still has some randomness and goes beyond the constraints we designed. For example, we don’t use vague wording such as “several thousand devices” or “a few K devices,” and we want precise figures such as “a total of 1,350 units” rather than “about a thousand units.” Even with constraints in place, these still show up from time to time.</li><li><strong>Calculation formulas</strong><br> We very often ask comparison questions. For example, is this year’s Q2 performance growing? There are two ways to compare: against last year’s Q2, or against this year’s Q1. But Genie can’t strictly follow this logic and often gets it wrong, such as writing the wrong filter or comparing against the wrong baseline.</li><li><strong>Rendering charts</strong><br> This was the most serious and most direct problem: Genie can’t return images, only text. But our users prefer reports with both text and images.</li><li><strong>External information</strong><br> Genie is a Text-to-SQL tool, which means it isn’t good at anything beyond the data. But an analysis report badly needs external information. For example, if everyone’s sales suddenly dropped for a period, it might be because of tariffs or a war, and if sales surged, it might be because two countries signed an agreement.</li></ol><p>There were many other problems, too many to list here. In short, to fix them, we designed an architecture that helps produce correct reports.</p><h4>Results</h4><p>We treat Genie as a database query tool, use Claude Code at the core for tool orchestration and generation, and add the Tavily search tool to supplement external information. In between, we added various validation layers to make sure the data is correct and consistent.</p><p>The whole process has four phases:</p><ul><li><strong>Phase 1: Data acquisition</strong><br> Query Genie for each question’s raw data and insights, and query Tavily for results under specific keywords. In this phase, we also recompute the raw data that Genie provides, to confirm that the results and the insights line up properly.</li><li><strong>Phase 2: Summary generation</strong><br> Led by Claude Code, which produces a summary, overall findings, and highlight analysis from the Phase 1 results.</li><li><strong>Phase 3: Validation and rendering</strong><br> Run five layers of validation (see the figure below) on the current output, covering numeric logic, format, prohibited words, and more. The last step of this phase also renders an HTML file and checks the resulting HTML again for anomalies.</li><li><strong>Phase 4: Overall check</strong><br> Claude Code reads the entire report to confirm that the summary, insights, and raw data are consistent with each other across the whole report.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t_YG5lr1Cjdictl7_Yx8fw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S8dkTh1xqnLviGCAf-VQPg.png" /></figure><h4>How Each of the Five Problems Is Handled</h4><ul><li>Inconsistent viewpoints → Phase 4: Claude Code reads the whole report and checks that the summary, insights, and raw data agree</li><li>Writing style drift → Phase 3: checks such as prohibited words</li><li>Wrong comparison formulas → Phase 1: recompute the raw data first and confirm it matches the insights</li><li>Unable to produce charts → Phase 3: rendered into HTML by code</li><li>Missing external context → Phase 1: supplemented with Tavily search</li></ul><h4>Why So Complicated? Can’t We Just Give the AI Access and Let It Figure It Out?</h4><p>The randomness of AI (or rather, LLMs) is simply too strong. Without good Harness Engineering, it’s hard to guarantee stable output. Frankly, Harness Engineering means sandwiching the LLM between two layers of deterministic code: how the data is pulled and whether the results are right are all judged by hard-coded programs, and the LLM is only responsible for the small middle segment of “generating text.” If we handed the LLM full database access and let it decide how to query and how to judge whether the format is correct, the problems mentioned in the background (inconsistent viewpoints, drifting writing style, wrongly computed YoY) would all happen mixed together, and nobody would know which step went wrong.</p><p>Also, documents like analysis reports carry a strong element of human subjectivity, such as customary phrasing, stance, and viewpoint. To get an LLM to accommodate these human details and produce a fluent, error-free report, we can only control it through layer upon layer of validation.</p><p>Fortunately, AI doesn’t complain. Once a problem is found, we send the work straight back to the previous phase to be rewritten, until it passes or hits the retry limit and reports to a human. The response time is longer, but what we spend is only a few seconds of LLM retries, and what we avoid is the reputational cost of being caught with wrong figures after the report goes out. It is well worth it.</p><h4>Summary</h4><p>This architecture is the first time the team has used AI to generate reports, and we built it up as we explored. It may also be the first technical framework in our company for writing analysis reports. We built four phases and five layers of validation. A small part still needs manual checking and correction, but before this process existed, a report could take an analyst several days. Now the system finishes it in just a few minutes, and with human review added, a report takes one to two hours at most.</p><p>We also hope this result can lay a foundation for the team and the company, so that in the future AI can speed up and optimize our workflows and outputs.</p><p>That’s it for this post. For the rest of the series, see: <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e38a0f210a3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[The Evolution of Our Data Team] System Operations]]></title>
            <link>https://medium.com/@tses89214/the-evolution-of-our-data-team-system-operations-52dee02c25f0?source=rss-c24d93f068bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/52dee02c25f0</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[簡嘉炫 Po Jian]]></dc:creator>
            <pubDate>Tue, 20 Oct 2026 06:45:29 GMT</pubDate>
            <atom:updated>2026-10-28T06:22:02.516Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdG-ZwamWd185wYoyVnDSw.png" /><figcaption>Photo by Lukas on Pexels</figcaption></figure><p>This post is part 5 of the technical posts in the series “The Evolution of Our Data Team” (Tech 5). For the full list, see the <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">series index</a>.</p><p>When I took over system operations, the system had always been in an “as long as it runs” state. This post describes how I rebuilt it, starting from monitoring, account management, and backups. We used to find out about problems only after the system went down. Now, by the time a disk hits 90% full, we’re already on it.</p><h3>Background</h3><p>The team member who previously owned infrastructure had put relatively little into system operations, so the system had in fact always been running in an “as long as it works” state, with many details left unattended.</p><p>After I took over, I decided to rebuild everything from the ground up, from the servers’ <strong>low-level operations, monitoring, and account management</strong>. That included introducing <strong>Prometheus</strong> and <strong>Grafana</strong> for system monitoring, setting up <strong>LDAP</strong> for account management, and purchasing a NAS for backups.</p><h3>Implementation and Results</h3><p>As the saying goes, “you can’t manage what you can’t measure.” First, we need to know what state our servers are in every minute and every second, and only then can we draft a strategy and discuss improvements.</p><h4>Data Collection</h4><p>For monitoring tools, I went with a combination that is common in the industry. First, I introduced <strong>Prometheus</strong>. It is a tool dedicated to collecting monitoring data. As long as a machine exposes all kinds of metrics through Exporters, Prometheus can collect and store them for later use.</p><p>Next, we use Grafana, an open-source visualization tool, to visualize the data Prometheus collects, so we can see the machines’ status at a glance. <a href="https://grafana.com/grafana/dashboards/">Grafana Labs</a> also offers many open-source dashboard templates that you can download and use with a little adjustment, which is very convenient.</p><p>With the core of data collection and presentation in place, we can start adding all kinds of Exporters. We use the following:</p><ul><li><strong>Node Exporter</strong>: the most basic machine metrics, such as memory, CPU, disk, and network.</li><li><strong>cAdvisor</strong>: container performance monitoring, again memory, CPU, and so on.</li><li><strong>K8s Event Exporter</strong>: exports k8s events such as Pending, OOM, and Error.</li><li><strong>Kube State Metrics</strong>: shows the basic state of the k8s cluster, such as the number of Pods.</li><li><strong>NVIDIA DCGM Exporter</strong>: GPU monitoring, such as temperature, memory, and power draw.</li><li><strong>Loki</strong>: a log collector, mainly collecting k8s events and serving as a data source for Grafana.</li></ul><p>In the end, we split everything into four dashboards, monitoring the performance and events of <strong>Instance Resource</strong>, <strong>Docker</strong>, <strong>K8s</strong>, and <strong>GPU</strong>. The content is about the same as the screenshots you can see on <a href="https://grafana.com/grafana/dashboards/1860-node-exporter-full/">Grafana Labs</a>, so I won’t show more here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*5xfMpqCwM_4hV6kpEyllTg.png" /></figure><h4>Alerting</h4><p>As mentioned above, each Exporter contributes some metrics to Prometheus, for example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YrlorHu1o5fwu9qZ9iePew.png" /></figure><p>From these metrics, we can calculate the corresponding alert values. For example, we send a Slack notification when low memory, or an errored Container or Pod, is detected. Here is how it looks in practice:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QgPB5AnrzN4pbDcE4VTPSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ehaqgchNGhTPlTGQ0zk6A.png" /></figure><p>At this point, we have visibility into the basic condition of our on-prem servers. Afterward, we only need to discuss and reallocate around OOM alerts or periods of heavier load.</p><h4>Account Management (LDAP)</h4><p>In the past, the team used shared accounts, so it was impossible to tell who had done what, and it was hard to manage when members changed. I set up LDAP, and now everyone has their own account, managed centrally by the system.</p><h4>Backups (NAS)</h4><p>I purchased a NAS to back up server configuration and VM configuration, so that when a machine has a problem, we don’t have to rebuild from zero.</p><h4>What Specifically Improved?</h4><ul><li><strong>From “found out after it broke” to “fixed before it breaks”</strong><br> Before monitoring, we almost always learned about a problem only after the system went down and someone reported it. Now we get alerts before things fail: when disk usage hits 90%, or when a task runs out of memory, we can deal with it before it causes downtime. This has greatly reduced downtime from these known issues.<br> That doesn’t mean we never have problems. But every time we hit a new kind of failure, we add an alert and a check for it. The team keeps moving forward, with fewer and fewer incidents, instead of fixing things one breakage at a time and firefighting all day.</li><li><strong>Backups that actually saved us</strong><br> Several times, a VM’s disk partitioning was misconfigured and broke its operating system. Each time, we restored it directly from the NAS backup and recovered quickly, without rebuilding from scratch.</li><li><strong>Coverage</strong><br> Monitoring currently covers 5 machines, or about 10 including VMs.</li><li><strong>Account management</strong><br> Accounts went from shared to one per person, managed centrally through LDAP.</li></ul><p>That’s it for this post. For the rest of the series, see: <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52dee02c25f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[The Evolution of Our Data Team] Data Insight Reports (Strategy)]]></title>
            <link>https://medium.com/@tses89214/the-evolution-of-our-data-team-data-insight-reports-strategy-3cf63eb17c97?source=rss-c24d93f068bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cf63eb17c97</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[簡嘉炫 Po Jian]]></dc:creator>
            <pubDate>Tue, 20 Oct 2026 06:44:04 GMT</pubDate>
            <atom:updated>2026-10-20T06:44:04.220Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdG-ZwamWd185wYoyVnDSw.png" /><figcaption>Photo by Lukas on Pexels</figcaption></figure><p>This post is the first AI post in the series “The Evolution of Our Data Team” (AI 1). For the full list, see the <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">series index</a>.</p><p>The team used to set its KPI as the satisfaction of the requesting teams. The dashboards looked good, yet company performance didn’t change accordingly. This post describes how we shifted our focus to the company’s business and revenue, with the Insight Report as the starting point.</p><h4>Background</h4><p>In the past, whenever we provided data analysis, we followed the requester’s question: we pulled the data, ran the analysis, and gave a conclusion. Requests and results went back and forth only between the requester and the data team, with no end point to look back at and check against. Whether the results were later used, and whether they changed anything for the company, was unknown.</p><p>But in mid-2026, we talked with our boss, and the way we were operating was in fact a lot like spinning our wheels. We put a lot of effort into making dashboards and analyses look beautiful, as if satisfying the operations teams would make the whole company’s business flourish. In reality, we didn’t see such results, and team members felt frustrated. Another post discusses a similar problem: <a href="https://medium.com/dashboards-suck/stop-building-dashboards-what-high-impact-data-teams-do-instead-c36290240461">Stop building dashboards: what high-impact data teams do instead</a>. The team should focus on “<strong>improving the company’s performance</strong>,” rather than setting its KPI as “<strong>the satisfaction of operations teams</strong>.”</p><p>So we decided to change direction. We would carry out all kinds of analysis with the company’s business, revenue, and development as the subject, and in turn promote our findings to the existing operations teams, ultimately helping the company develop.</p><p>But we can foresee many obstacles on this road, such as unclear business metric definitions, people working by gut feeling, and the company lacking a unified policy or stance.</p><p>For this reason, we decided to at least take the first step: solving the problem of “everyone has their own view, and the company as a whole can’t clearly say what it is doing.”</p><blockquote><em>Build the Data Team’s own Single Source of Truth</em></blockquote><p>We needed to produce a research report on the company’s business, which we call an Insight Report, to serve as the foundation and basis for the company’s development and progress. This report may need to be split by different topics and angles, such as operations, market, and public sentiment. We happened to have regularly updated market share data at hand, so our first Insight Report is a market share analysis.</p><p>In short, the team plans to regularly produce a market share Insight Report. Its content will include fairly high-level discussion of the current situation and forecasts of future development, such as changes in the market share of the company and its competitors, and the growth or shrinkage of the overall market. Where permissions allow, we share this information as widely as possible with members of the company.</p><h4>What Is an Insight Report?</h4><p>An Insight Report is the data team’s consolidated analysis of the company’s current state. Compared with analysis aimed at a specific problem or a specific customer group, it takes a more comprehensive view, with the company’s business and revenue as its subject.</p><h4>Why Change? What Happens If We Don’t?</h4><p>We can look at this on several levels. The first is how the team operates. The team’s current habit is effectively to set its KPI as “the satisfaction of the requesting units,” and as long as we satisfy them, we go home content. But this may be one of the key reasons the team is spinning its wheels and the business isn’t improving. Over the long run, team members have also sensed this powerlessness and felt frustrated, and our boss has also instructed that this habit needs to change. So this is a way of operating that must change, or the team will keep spinning its wheels.</p><p>The second is how the company operates. Operations units for different product lines and different regions don’t communicate with one another. (Even within the same department, the colleague sitting next to you has a different area of responsibility, so information is disconnected.) Even if operating figures and scale differ, the company still needs a unified methodology as the basis for analysis, judgment, and decisions. At present this is missing, which ultimately leads not only to data silos, but also to information flow between product lines and departments turning into silos of their own.</p><h4>Results</h4><p>We spent about two weeks interviewing members of the operations teams in all business regions. We mainly discussed: “How do you use market share analysis?” and “What perspective do you usually take on changes in the data?” We tried to extract their usage methods, perspectives, and expectations for market share analysis so that our analysis report wouldn’t stray too far from reality. As mentioned above, though, satisfying them was not the goal. Their input was only a reference.</p><p>In the end, each business region receives a market share report of its own. Each report covers at least three different market segments, and each segment has at least five to ten questions, for example: “Has our market share against competitors changed?”, “What are the market’s and competitors’ current preferences for machines of different specs and sizes?”, and “Which countries might be worth investing in or are growing, and where should we play defense instead?” The reports are also refreshed on an automated schedule, and from now on a market share Insight Report will be produced for everyone every quarter.</p><p>Operations teams also gave feedback that they did find different perspectives in the reports, and that the reports sped up their overall pace. Some operations colleagues also said that the depth of the analysis isn’t as detailed as what they need when actually reporting to their own boss. But they can use it as an introduction, as a basis for further in-depth work, or as teaching material for building a basic concept of the whole market when new people join.</p><p>That’s it for this post. For the rest of the series, see: <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cf63eb17c97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[The Evolution of Our Data Team] Migrating Airflow to K8s]]></title>
            <link>https://medium.com/@tses89214/the-evolution-of-our-data-team-migrating-airflow-to-k8s-8ad956175a61?source=rss-c24d93f068bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ad956175a61</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[platform-engineering]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[airflow]]></category>
            <dc:creator><![CDATA[簡嘉炫 Po Jian]]></dc:creator>
            <pubDate>Tue, 20 Oct 2026 06:33:44 GMT</pubDate>
            <atom:updated>2026-10-20T06:33:44.154Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdG-ZwamWd185wYoyVnDSw.png" /><figcaption><em>Photo by Lukas on Pexels</em></figcaption></figure><p>This post is part 4 of the technical posts in the series “The Evolution of Our Data Team” (Tech 4). For the full list, see the <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">series index</a>.</p><p>The team’s Airflow originally ran on a single machine, with all tasks sharing the workers and no visibility into resource usage. When an OOM happened, the only remedy was to stagger the tasks’ run times. This post describes how I built a K8s cluster from servers left behind by my predecessors and migrated Airflow onto it.</p><h3>Background</h3><p>The team mainly implements ETL in Python and uses Airflow as the workflow orchestrator. Airflow was running in Celery Executor mode on a single machine, which in practice behaved much like Local Executor.</p><p>After collecting several servers and PCs left behind by my predecessors, I decided to build them into a <strong>K8s cluster</strong> and move Airflow to <strong>K8s Executor mode</strong>. I split it into separate production and test environments, to make the overall infrastructure more stable and better utilized, and I took the opportunity to <strong>separate production from test</strong> at the same time.</p><p>I also considered simply adding more Airflow Celery Executor workers to spread the load. But after weighing a few things, I decided to go straight to K8s, for these reasons:</p><ol><li>ETL compute load varies from task to task, sometimes large and sometimes small, and K8s is better than Celery at allocating and isolating resources. Celery schedules tasks as a queue, and each worker just gets whatever it gets, which makes it hard to allocate on demand. K8s lets you specify the memory and CPU a task needs.</li><li>Our machine setup is a bit odd: one higher-performance server (the single machine mentioned above) and several lower-performance idle PCs. So we needed logic like “small tasks go to small servers, big tasks go to the big server,” and the K8s Executor makes that easier to arrange.</li><li>Celery workers are exclusive to Airflow, but K8s can be used by any service. If one day the team needs to add a query engine such as Spark or Presto, K8s can manage that too.</li></ol><h3>It Already Runs. Why Upgrade?</h3><h4>More Precise Resource Control</h4><p>With the old single-machine Celery mode, every task was thrown onto the server regardless. Developers weren’t strictly controlling how many resources they needed, observability was insufficient, and when an OOM happened, all we could do was try to stagger the task times. K8s mode forces developers to pay more attention to their resource usage and fill in the figures, which makes review easier and helps avoid OOM.</p><h4>Spreading Out Load Peaks</h4><p>Following on from that, single-machine Celery throws all tasks onto the server together, and if an OOM happens, we only find out after things blow up. But if K8s has resources reserved in advance, its own task coordination mechanism lets tasks sit in Pending briefly at peak times, so the whole run doesn’t blow up. And for the big-machine and small-machine issue mentioned earlier, K8s can route a task to a big machine, or the reverse, more precisely.</p><h4>Easier to Extend</h4><p>As mentioned above, if other services come along in the future, as long as K8s can deploy them, they can live on K8s as Pods, which reduces resource contention.</p><h3>Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQYBHxPoL_E6pTAM_BRmuQ.png" /></figure><p>We have been running in K8s mode for over a year. We ran into some problems along the way, but after resolving them step by step, it is now running stably. Obvious anomalies are rare, and resource scheduling is more effective as expected, with more precise resource specification.</p><h4>Monitoring Modules</h4><p>I also added many monitoring modules, including Grafana, Prometheus, K8s Event Exporter, K8s State Metrics, Loki, and more. The monitoring screen in the image above is produced from this monitoring stack. With it, we can better monitor whether each Pod starts normally, or what mishap occurred, and the underlying system is much clearer at a glance. The specific monitoring details will be discussed in the next post.</p><p>In addition, I added an Airflow plugin that overrides the pre_execute and post_execute functions of BaseOperator. Each time a task starts, it spawns a resource-monitoring sub-process that keeps printing resource usage into the log. This improves observability of running tasks and makes it easier to judge afterward whether resource allocation is reasonable.</p><h4>Resource Allocation</h4><p>In Airflow’s Pod Template, we can set how many resources each Pod gets by default. When necessary, we can override a specific task’s Pod conditions from the Airflow Operator so that it points to a specific K8s node, which makes effective use of resources.</p><ul><li><strong>OOM nearly gone</strong><br> Previously, tasks on single-machine Celery shared workers and often failed from OOM at peak times, so we could only stagger execution times. After the migration, OOM almost never happens.</li><li><strong>Queueing at peaks instead of failing</strong><br> Now at peak times, tasks queue up according to reserved resources and are digested gradually, and overall digestion is faster too.</li><li><strong>Scale</strong><br> About 100 DAGs currently run on the cluster.</li></ul><h4>Production / Test Environments</h4><p>We also set up two Airflow instances on different machines with different Pod Templates, so that Pods mount paths on different machines at startup: the production environment mounts the production configuration, and vice versa. This solved the environment separation problem. Data is isolated between environments, while Pods within the same environment share paths and config files.</p><ul><li><strong>How resources are allocated</strong><br> The cluster currently consists of two large servers and three small worker nodes. The production environment uses Affinity settings so that tasks get resources starting from the large servers and then work down. The test environment is the opposite, starting from the small worker nodes and working up. The two environments use their own Pod Templates, so their scheduling directions are independent.</li><li><strong>Trade-offs</strong><br> The aim is to use resources efficiently. The cost is that, by design, test-environment jobs could squeeze production resources. In practice, though, our test workload is small, so this has never happened.</li></ul><p>That’s it for this post. For the rest of the series, see: <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ad956175a61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[The Evolution of Our Data Team] Event Tracking QA Framework]]></title>
            <link>https://medium.com/@tses89214/the-evolution-of-our-data-team-event-tracking-qa-framework-7ac700df3381?source=rss-c24d93f068bb------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ac700df3381</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[簡嘉炫 Po Jian]]></dc:creator>
            <pubDate>Tue, 20 Oct 2026 06:30:27 GMT</pubDate>
            <atom:updated>2026-10-20T06:30:27.044Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdG-ZwamWd185wYoyVnDSw.png" /><figcaption>Photo by Lukas on Pexels</figcaption></figure><p>This post is part 3 of the technical posts in the series “The Evolution of Our Data Team” (Tech 3). For the full list, see the <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">series index</a>.</p><p>Before every release, analysts had to tap around on test devices to confirm tracking events, which took several days each time. This post describes the QA framework I built, so that analysts only need to write the test and validation logic and the framework handles the rest.</p><h3>Background</h3><p>QA of event tracking data has always been an important job. In my experience, the Data Team usually designs the tracking events and their trigger conditions, and the web or app team implements them. Without good communication and coordination, we often receive wrong events, which hurts the quality of our analysis.</p><p>At our company, the QA Team only tests functionality, such as whether files can be uploaded normally or settings can be changed. Whether the tracking event for a file upload fired correctly is outside the QA Team’s scope.</p><p>So our analysts take on part of the QA work: before a software release, they go to the test devices and tap around to confirm that the events fire normally. But there is a subtle gap here. Analysts usually don’t have (and usually don’t need) a background in test automation, so data engineers also have to step in and help with the automated testing part.</p><p>For this, I built a QA framework for analysts to use to help them test.</p><h3>Why Didn’t the Old Approach Work, and Why Build a Framework?</h3><p>In the past, analysts would tap around in the software and then check whether the database had received the events to judge the result. This had several problems:</p><ul><li><strong>[Manual work is time-consuming]</strong><br> We have many events and many products, so every release consumed several days of analysts’ time.</li><li><strong>[Insufficient log collection]</strong><br> Once an anomaly is found, the development team needs logs to diagnose it. But ordinary tapping around can’t surface problems that show up in logs (such as error reports), which makes reproducing and troubleshooting issues difficult and slow.</li><li><strong>[QA experience can’t accumulate]</strong><br> Every QA round requires remembering what was done last time, and things may be missed. Ideally, experience should keep accumulating.</li></ul><h3>Framework Design</h3><p>I designed an Auto Data QA framework, implemented mainly with <strong>Appium</strong>. It can <strong>run test scripts automatically</strong>, <strong>collect logs</strong> during the process for later analysis, and <strong>produce a report</strong> after validation so it can be submitted directly to the development team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YIngp_A0OszjheTzdPsfqg.png" /></figure><p>It also has a few distinguishing features:</p><ul><li><strong>Test &amp; Validate</strong><br> The framework is split into a Test module and a Validate module. Ideally, analysts go to a test device and run the Test module to collect logs, then return to the office to analyze and validate against those logs.<br> We do it this way partly because the test devices are shared by many teams and hard to get. But the bigger reason is that our tracking events don’t necessarily fire immediately: they may be sent only after accumulating for five or ten minutes. That makes the old approach of writing unit tests unworkable, which is why execution is split into two phases.</li><li><strong>Logic-Only Authoring</strong><br> Analysts only need to write the test and validation logic. For example, they write the logic of “tap left, then tap right,” plus which events those two actions should produce. The framework handles everything else, such as interacting with the Appium Server, recording logs through ADB, parsing the logs, and generating test and validation reports. This approach also works with version control, so test scripts accumulate clearly.</li><li><strong>Multi-Source &amp; Cross-Platform Framework</strong><br> Our software currently runs on Android and Windows, and our tracking solutions are Matomo and GA. Applying object-oriented concepts, I implemented an abstract “Solution” class and a separate implementation for each of the two solutions, which gives the framework good extensibility.</li></ul><h3>Adoption Results</h3><ul><li><strong>Much shorter QA time</strong><br> In the past, for every release, analysts spent several days manually confirming tracking events. With the framework, a complete release QA can be finished within a few hours.</li><li><strong>Logs surface problems</strong><br> The framework automatically collects logs during testing. Once, through the logs, we found an event being sent twice, as well as the wrong user identity being carried over during switching, and we found and fixed a bug as a result. Problems like these are hard to see when tapping manually, because everything looks fine on the screen.</li></ul><p>That’s it for this post. For the rest of the series, see: <a href="https://medium.com/@tses89214/the-evolution-of-our-data-team-a4f363ae31ee">link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ac700df3381" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>