RSSAmplifier

Blog

Nite

This is Nite's home!

nite07.comRSS feed ↗10 posts

Latest posts

OpenViking Memory Directories Split by Language: Unify with Custom Templates

OpenViking memory paths ended up with two parallel directory trees: entities/infrastructure/ and entities/基础设施/ holding the same kind of content. The cause is in the session commit auto-extraction pipeline, which names directories in the detected conversation language. Editing the memory template fixes the naming at the source; steps below. 
 Symptom 
 
…

Tailscale Split DNS: Reach Internal Services Directly from the Tailnet

Scenario 
 
 A home server runs a bunch of services and has no public IP. The domains’ A records point to a VPS with a public IP, and Caddy on the VPS reverse-proxies back to the home server. Devices inside the tailnet take the VPS detour too, adding an extra hop. 
 The goal: when Tailscale is up, domains resolve directly to the home server’s Tailscale IP; when it’s…

Go goroutine

Goroutines are the core of Go concurrency interviews, but this series already covers most of the ground in separate posts: the scheduler in Go GMP Model , channel semantics and the memory model in Go channel , locks in Go Mutex , context in Go Context , and Go sync.Once . This post fills in what the series doesn’t cover in detail: goroutines vs threads, panics across goroutines, race…

Consistent Database Backups with btrfs Snapshots + Backrest Hooks

When you back up a directory with restic or Backrest, and that directory contains live databases like PostgreSQL or SQLite, copying the data files directly can leave you with a backup that won’t start — or worse, one that starts silently with corrupt data. This article shows how to freeze the whole data directory into a consistent state with a btrfs subvolume snapshot, and have Backrest…

Go + Redis Distributed Lock

Interview notes on Go + Redis distributed locks. Covers: why a distributed lock is needed, atomic locking with SET NX EX, Lua-script unlock, expiry and watchdog renewal, master-replica failover and Redlock. 
 Why you need a distributed lock 
 
 sync.Mutex only protects goroutines inside one process: the lock state lives in memory that other processes can’t see. Once a service…

Go context internals

Go context interview notes. Covers: basic usage, cancellation and propagation, timeout and deadline, values, internals, memory model, common patterns and pitfalls. 
 Basic usage 
 
 A context carries three kinds of information across API boundaries: a cancellation signal, a deadline, and request-scoped data. Official definition: a Context carries a deadline, a cancellation signal, and…

Go Mutex

Interview notes on Go mutexes. Covers: basic usage, non-reentrancy and the consequences of misuse, starvation mode, TryLock, RWMutex, the memory model, common patterns and pitfalls. 
 Basic usage 
 
 var mu sync.Mutex // zero value is usable, no need for new

mu.Lock() // lock; blocks if someone else holds it
// critical section: only one goroutine can be in here at a…

Go Channel

Interview notes on Go channels. Covers: basic usage, unbuffered vs buffered channels, send/receive panic cases, timeouts and non-blocking operations, select semantics, the memory model, common patterns, leaks and deadlocks. 
 Basic usage 
 
 Creating, sending, receiving, closing, ranging: 
 ch := make(chan int) // unbuffered
ch2 := make(chan string, 8) // buffered, capacity…

Go GC Mechanism

Go’s GC went through three stages: mark-and-sweep (full STW) → tri-color marking + insertion/deletion write barriers (concurrent marking) → tri-color marking + hybrid write barrier. This post follows that evolution, then covers today’s trigger conditions, the full cycle, and tuning. 
 One-Paragraph Recap 
 
 Go’s GC is fundamentally concurrent mark-and-sweep.…

Go GMP Model

GMP is the trio of core components in the Go scheduler: 
 
 G (Goroutine): the task created by go func() . 
 M (Machine): an OS thread. 
 P (Processor): scheduling context that manages a G queue. 
 
 M is an OS thread. The runtime creates it via newm / newosproc (the functions that create M and its underlying thread), and the OS then schedules it onto a CPU core. M is the…