본문 바로가기

전체 글

(12)
Trading 100% Certainty for 99.99% Efficiency IntroI'd like to share my experience applying the Monte Carlo algorithm to solve a problem I encountered in my work. It was a fascinating journey that showed how efficiently a seemingly complex problem can be solved by slightly shifting one's perspective.The Problem I Faced: Finding a 'Non-Bingo' CombinationGame RulesIn our game, there's a system where players receive rewards from an N x N bingo..
IEEE 754 Distorts My Ranking System IntroIn this post, I want to share a detailed account of an interesting issue I encountered with our Redis-based ranking system.One day, we noticed that the Battle Time records for some top-ranked players on our game's leaderboard were being displayed as slightly distorted values. The user recorded a battle time of 600 seconds, but it was displayed as 600.06 seconds on the ranking leaderboard. E..
The Mysterious CRDB OOM Killer IntroI recently ran into an Out-of-Memory (OOM) error with CockroachDB (CRDB) in our development environment. I want to share the story of how I detected the issue and the steps I took to fix it. I'll walk you through what caused this OOM time bomb, how I used system tables and internal queries to find clues, and how I ultimately resolved the problem.The Mysterious OOM KillerI got a report from ..
One Pass, N Types: Efficient Type Filtering with Scala 3 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..
Building Static and Dynamic Gacha Validation Systems 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 random item systems, which are directly tied to user trust.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 system, the most crucia..
Building a Reliable Server Maintenance with ZIO 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),..
Journal Optimization Strategies in Event Sourcing DB Architecture IntroI currently work with an Event Sourcing (ES) architecture. One of the most interesting parts of ES is its database usage patterns. I always keep a close eye on how client requests create load on our database. In this post, I want to share an interesting DB load problem I faced and how I solved it. First, let's quickly go over what Event Sourcing is.What is Event Sourcing?Event Sourcing is a..
Solving the Ambiguous Error Problem in Trampolined Effects using Compile-Time Macros IntroScala'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, dramatically im..
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? (e.g., List[Dog] ) The answer largely depen..
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..
CPython Memory Management and the GIL The Life Cycle of a Python ObjectIn Python, specifically the CPython implementation, managing memory is less about "deleting files" and more about managing labels. A common misconception is that the del statement destroys an object. In reality, del only removes the binding between a name and an object. Consider this classic scenario:a = [1, 2, 3]b = adel aIn this case, the name a is gone, but th..
How CPython Handles 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 CPythonThe explanatory comments written below are linked here https://github.com/python/cpython/blob/2f1ecb3bc4..