Tagged articles
sync.Pool
24 articles · Page 1 of 1
This article presents a systematic, evidence-driven framework for Go memory optimization, covering allocation profiling, GC tuning, container memory accounting, runtime metrics observability, and validation methodologies to prevent Kubernetes OOM kills while meeting SLOs.
GOGCGOMEMLIMITGo
0 likes · 40 min read

This article explains why the pre‑generic sync.Pool suffers from boxing and type‑assertion costs, shows how to wrap it with a type‑safe generic Pool[T] implementation, demonstrates usage with a byte‑buffer example, and outlines the three main benefits and caveats of the approach.
GenericsGoboxing
0 likes · 5 min read

This article presents five practical Go techniques—using context for graceful cancellation, enriching errors with fmt.Errorf, leveraging sync.Pool to reduce GC pressure, employing pprof for performance profiling, and designing testable code with dependency injection—each illustrated with real‑world code examples and common pitfalls.
Best PracticesContextGo
0 likes · 7 min read

This guide shows how to efficiently extract timestamp‑filtered logs from a 16 GB text file in Go by reading the file in chunks, reusing memory with sync.Pool, and parallelising processing with goroutines, achieving roughly 25 seconds runtime.
File ProcessingGoLarge Files
0 likes · 10 min read

This article explains how Go's sync.Pool works, shows practical usage examples, walks through its source code, and details the underlying implementation, including Put/Get methods, pinning, and garbage‑collection interaction, helping developers efficiently reuse objects in concurrent programs.
ConcurrencyGoobject pooling
0 likes · 20 min read

This article explains how Go's concurrent mark‑sweep garbage collector can become a bottleneck in high‑performance scenarios and provides practical techniques—such as using sync.Pool, avoiding unnecessary pointers, pre‑allocating memory, and applying zero‑copy and unsafe tricks—to dramatically lower GC overhead and improve overall program speed.
GCGoJSON
0 likes · 8 min read

This article examines Go’s internal lock‑free single‑producer multi‑consumer queues—PoolDequeue and its dynamic extension PoolChain—detailing their design, atomic operations, and benchmark comparisons that show they can be up to ten times faster than standard channels in a producer‑consumer workload.
ConcurrencyGoQueue
0 likes · 13 min read

This article explores the internal structure and growth mechanism of Go's bytes.Buffer, demonstrates how the GWS library replaces gorilla/websocket, and presents a high‑performance bytes.Buffer pool implementation using sync.Pool with power‑of‑two sizing to reduce allocations and improve concurrency in backend services.
Gobytes.Buffermemory pool
0 likes · 25 min read

This article explains how Go's sync.Pool enables efficient object reuse to cut memory allocation and garbage‑collection overhead, detailing its features, basic usage, underlying mechanics, ideal scenarios, performance‑boosting examples, and important considerations for safe and effective implementation.
Goobject poolingsync.Pool
0 likes · 8 min read

This article explains how Go's sync.Pool can reduce memory allocations and garbage‑collection overhead in high‑performance applications, provides step‑by‑step usage examples, demonstrates a byte‑buffer pool, shows performance benefits, and visualizes the mechanism with UML class and sequence diagrams.
Gomemory managementperformance optimization
0 likes · 7 min read

This article explains the principles of object pools, details the internal implementation of Go's sync.Pool, and demonstrates through benchmarks how using an object pool can dramatically reduce memory allocation and latency for high‑traffic menu services in a restaurant ordering application.
Gobenchmarkhigh concurrency
0 likes · 13 min read

This article explains the concept of object pools in Go, outlines their performance benefits, demonstrates how to implement pools using the standard sync.Pool and channel approaches with full code examples, and reviews several third‑party libraries for advanced pooling needs.
ConcurrencyGoobject pool
0 likes · 12 min read

This article introduces the Go WorkQueue project, detailing its motivation, overall architecture, layered design of Queue, Simple Queue, Delaying Queue, Priority Queue, and RateLimiting Queue, compares underlying data structures such as DoubleLinkedList versus slice, presents performance benchmarks, and explains memory‑fragmentation mitigation using sync.Pool.
GoQueueWorkqueue
0 likes · 12 min read


21CTOMar 31, 2023 · Backend Development
This article presents six practical Go performance optimizations—including GOMAXPROCS tuning for Kubernetes, struct field ordering, garbage‑collection limits, zero‑copy unsafe conversions, jsoniter usage, and sync.Pool pooling—that together can dramatically lower CPU, memory, and latency in production services.
GoKubernetesUnsafe
0 likes · 9 min read

This article explains Go 1.18 generics, covering type parameters, type sets, type inference, and shows how to simplify sorting, strconv.Append, heap, sync.Pool, and sync.Map with concise generic implementations and real code examples.
GenericsHeapsorting
0 likes · 24 min read

This article explains Go 1.18 generics—type parameters, type‑set interfaces, and inference—through six practical examples including a universal sorting function, generic Append, heap, sync.Pool and sync.Map wrappers, showing how generics reduce code size, improve readability, and enhance type safety.
Go 1.18Go genericsType Constraints
0 likes · 22 min read

The article explains how Go's lock‑free sync.Pool can cut garbage‑collection overhead, shows practical FFmpeg thread‑parameter tuning that balances CPU use and latency for video filtering versus encoding, and compares PaddlePaddle's static and dynamic graph modes, including debugging tips and conversion to static.
ConcurrencyDynamic GraphStatic Graph
0 likes · 13 min read

The article surveys a range of Go standard‑library performance tricks—from using sync.Pool and zero‑copy string/byte conversions to reducing lock contention, leveraging go:linkname, caching call‑frame data, optimizing cgo calls, employing custom epoll, SIMD, and occasional JIT—while urging profiling‑first, readability‑preserving optimizations.
Gocgosync.Pool
0 likes · 17 min read


21CTOJun 16, 2021 · Backend Development
This article explains how to efficiently extract time‑range logs from a massive 16 GB .txt/.log file using Go's bufio.NewReader, sync.Pool for buffer reuse, and concurrent goroutines, achieving processing times of around 25 seconds.
ConcurrencyLarge Fileslog processing
0 likes · 9 min read

Learn how to efficiently extract timestamped logs from a massive 16 GB file in seconds using Go's buffered I/O, sync.Pool, and goroutine concurrency, with step‑by‑step code examples, performance tips, and a complete runnable program.
ConcurrencyLarge Fileslog processing
0 likes · 10 min read

This article explains what a sync.Pool object pool is, when it should be used, details the Go 1.12 implementation with its internal structures and algorithms, describes the enhancements introduced in Go 1.13, and analyzes the resulting performance improvements for high‑concurrency backend applications.
ConcurrencyGoobject pool
0 likes · 18 min read

This article presents a collection of practical Go performance‑tuning techniques—including reuse of objects with sync.Pool, avoiding pointer‑heavy map keys, generating marshal code to bypass reflection, using strings.Builder for efficient concatenation, preferring strconv over fmt, and pre‑allocating slices—to significantly reduce allocation overhead and garbage‑collection time.
map optimizationslice allocationstrconv
0 likes · 13 min read

This article presents seven practical Go performance optimization techniques—including using sync.Pool, avoiding pointer‑heavy maps, generating marshal code, leveraging strings.Builder, preferring strconv over fmt, pre‑allocating slices, and passing byte slices—to reduce garbage collection overhead, improve allocation efficiency, and achieve up to 97% faster execution.
Gobenchmarkoptimization
0 likes · 14 min read

This article analyzes Uber's open‑source Go logging library zap, explaining its architectural trade‑offs, performance‑boosting techniques such as object pooling, reflection avoidance, and write‑time copying, and offers practical guidance for developers who want to build high‑performance logging components in Go.
BackendGoLogging
0 likes · 18 min read
