Go @ VictoriaMetrics
Container CPU Requests & Limits Explained with GOMAXPROCS Tuning
When running Go apps in Kubernetes, default CPU thread scheduling can conflict with cgroup CPU limits. The runtime sees all host CPUs, but the container may only be allowed a fraction of one. This often leads to early throttling. Properly configuring GOMAXPROCS avoids this waste and improves stability.
gRPC in Go: Streaming RPCs, Interceptors, and Metadata
Go’s gRPC implementation uses code generation to create type-safe client and server interfaces. Streaming RPCs allow sending multiple messages over a single connection, perfect for real-time updates and continuous data flows. Interceptors provide middleware-like functionality for authentication, logging, and error handling without modifying your core service logic.
How Protobuf Works—The Art of Data Encoding
Protocol Buffers is faster and smaller than JSON, but the interesting part is understanding why. This article breaks down the encoding techniques that make Protobuf efficient, backed by benchmark results and practical examples
How HTTP/2 Works and How to Enable It in Go
HTTP/2 solves head-of-line blocking at the application layer by multiplexing multiple streams over a single TCP connection. While HTTP/1.1 requires requests to be processed sequentially, HTTP/2 allows parallel processing through independent streams, each with its own ID. The Go standard library supports HTTP/2 out of the box when using HTTPS, and with some configuration, it can work over plain HTTP too
From net/rpc to gRPC in Go Applications
The net/rpc package in Go demonstrates basic RPC concepts by establishing TCP connections between clients and servers, using sequence numbers to match requests with responses, and supporting both gob (Go-specific) and JSON codecs for data serialization. While net/rpc is simpler and limited to Go services by default, gRPC offers advanced features like HTTP/2 streaming, cross-language support, and better performance
Weak Pointers in Go: Why They Matter Now
Through the weak package, you can create these special pointers that automatically become nil when their target memory gets collected. While they’re a bit trickier to use than regular pointers, they’re super useful for things like canonicalization maps and memory-efficient caching. The implementation is pretty clever too, using an 8-byte indirection object to make garbage collection more efficient.
Go Runtime Finalizer and Keep Alive
Go’s runtime package provides two intriguing features: Finalizers and KeepAlive, which help manage object lifecycle in unique ways. Finalizers let you attach cleanup functions to objects that run when they’re garbage collected. Meanwhile, KeepAlive serves as a tool to prevent premature object collection, especially when dealing with resources that need to stay alive longer than the compiler might expect.
Go sync.Once is Simple... Does It Really?
The sync.Once is probably the easiest sync primitive to use, but there’s more under the hood than you might think. It’s also a good opportunity to understand how it works by juggling both atomic operations and mutexes.
Go I/O Closer, Seeker, WriterTo, and ReaderFrom
Still, we haven’t really covered some other important interfaces, like Closer, Seeker, and a few others. And honestly, if you’re learning Go, you probably don’t want to leave those in the blind spot.
Go I/O Readers, Writers, and Data in Motion
The io.Reader and io.Writer interfaces are probably some of the most common tools. Today, we’re kicking off the I/O series by taking a look at a lot of these readers and writers, and pointing out some common mistakes — like using io.ReadAll in ways that can backfire.