Best of Halodoc2025

  1. 1
    Article
    Avatar of halodocHalodoc·1y

    Log Standardization

    Debugging in microservices is challenging without structured logging. This post explores logging strategies for HTTP requests, Kafka events, and concurrency in Java, Golang, and Python. It addresses context loss in Java’s multi-threading by introducing MDCAwareCompletableFuture and MDCAwareExecutorService, ensuring traceability in concurrent systems. A structured logging approach with Request ID, Transaction ID, and Parent Transaction ID is recommended for better traceability and debugging efficiency.

  2. 2
    Article
    Avatar of halodocHalodoc·18w

    Kubernetes OptimizationInPlace Pod Resizing,ZoneAware Routin

    Halodoc reduced Kubernetes infrastructure costs by implementing two optimization strategies: in-place pod resizing to dynamically adjust resources during low-traffic periods without restarts (achieving ~15% CPU and ~10% memory reduction), and zone-aware routing to minimize cross-AZ traffic (reducing data transfer costs by ~25% and latency by ~5%). The approach uses a custom scheduler for periodic resource patching and Kubernetes' trafficDistribution: PreferClose feature combined with topology spread constraints to keep traffic within availability zones.

  3. 3
    Article
    Avatar of halodocHalodoc·25w

    Find & Fix Node.js Memory Leaks with Heap Snapshots

    Memory leaks in Node.js applications cause gradual memory growth until containers crash or restart. Heap snapshots provide detailed dumps of JavaScript memory at specific moments, revealing which objects consume memory and why they aren't garbage collected. The article demonstrates capturing snapshots using Node.js V8 API, triggering them on app start, via SIGUSR2 signals, and automatically during OOM events. Analysis involves comparing multiple snapshots in Chrome DevTools to identify growing objects, examining retained sizes, and tracing retainer chains to find root causes. Common leak patterns include lingering timers, unremoved event listeners, unclosed RxJS subscriptions, and closures retaining large objects. The solution includes storing snapshots securely in S3 with encryption and automatic expiry, enabling systematic debugging of production memory issues.

  4. 4
    Article
    Avatar of halodocHalodoc·32w

    Migrating from JDK 17 to JDK 21: An Overview and Practical Guide

    A comprehensive guide covering the migration from JDK 17 to JDK 21, highlighting key benefits like Virtual Threads for improved concurrency and scalability. The article provides a step-by-step technical approach including environment setup, dependency updates, containerization, CI/CD pipeline modifications, and runtime optimization with Generational ZGC. Real-world results show 30% heap usage reduction, stabilized P99 latency, and over 10% infrastructure cost savings for I/O-bound services.