본문 바로가기

전체 글

(10)
Handling CockroachDB OOM Killer with a Simple TTL Tweak IntroLet me share a troubleshooting journey with CockroachDB's (CRDB) very useful Row-Level TTL (Time to Live) feature. I'll walk you through how what seemed like a simple setup turned into a threatening Out of Memory (OOM) bomb, and how I used system tables and internal queries to find the clues and ultimately resolve the issue.Chapter 1: The Alluring Promise of CRDB's Row-Level TTLIn my projec..
Collecting Elements by Type with Scala Macros IntroWhen developing, we often need to iterate over a collection and pick out only the elements of specific types. This seems like a simple task, but what's the optimal way to write the code? In this post, I'll share my journey, starting from inefficient code and progressing to a final solution that is type-safe, efficient, and reusable, using Scala 3 macros.The Start of the Problem: Inefficient..
Between Probability and Trust: Uncovering the Hidden Pitfalls of a Gacha System IntroI'm a developer working on a game development team. I want to share a story about a critical issue I faced and the systems I built to resolve it. It’s a story about "gacha" or random item systems, which are directly tied to user trust.Chapter 1: The Incident - A Crack in TrustThe game I'm working on has a "gacha" system where users spend in-game currency to acquire random items. In such a s..
Journey to Server Maintenance with Scala ZIO-Based Interactive Prompt IntroI want to share my journey to improve our server maintenance process by adopting ZIO. I'll walk you through my experiences, why I chose ZIO, and how I actually implemented it.The Problem: Manual Maintenance was Clumsy and RiskyOur server maintenance involved a complex series of steps: muting Datadog alerts (to prevent false alarms when servers go down), taking down servers (kubectl delete),..
[FP] Database Optimization in Event Sourcing + FP Architecture IntroI want to talk about an interesting problem we faced while using Event Sourcing architecture and how we solved it. We'll specifically look at optimizing DB Journals and how it ties into the lazy concept of Functional Programming.Event Sourcing?Event Sourcing is an architectural pattern where we store changes to an application's state as a sequence of Events. Unlike traditional methods that ..
Scala Macro + Implicit's Power: Tackling Ambiguous Error Messages with "sourcecode” Scala implicitScala's implicit keyword is incredibly powerful, often praised for enabling elegant DSLs, type class patterns, and dependency injection. However, for those new to Scala or even seasoned developers, its true utility beyond these common use cases might not always be immediately apparent.I want to share a practical scenario where implicits, combined with the sourcecode library, dramat..
[FP] Covariance, Contravariance IntroAt its core, variance is about how the subtype relationship of a type parameter influences the subtype relationship of a generic type itself. It addresses the question: when a subtype relationship is established for a type parameter (e.g., Dog ), how does this relationship translate to the generic type when that type parameter is injected into it? The answer largely depends on how the type ..
[FP] The Way I Understand Monads IntroOne powerful way to understand a concept—especially abstract ones—is to ask two simple but profound questions:What is its definition?Why is it defined that way—what’s the benefit?This dual approach isn’t just useful for mathematics. It applies equally well to functional programming (FP), where abstract structures like Monads are central. In this post, I aim to explore Monads through these t..
GC of python 1. Basics: Reference CountingThe del statement removes a name, not the actual object. An object may be garbage collected as a result of del, but only if the deleted variable was the last reference to the object the object becomes unreachable (e.g., due to circular references).In CPython, garbage collection is primarily based on reference counting. Essentially, each object keeps track of how many..
How does Python handle hash collisions? IntroThere are theoretical approaches to avoid collisions in hash maps:Separate chainingOpen addressingWhich approach does Python use internally? If you dig into CPython’s implementation, you can see it quite easily, and the comments explaining it are beautifully written.Explanation in CPythonMajor subtleties ahead: Most hash schemes depend on having a "good" hashfunction, in the sense of simul..