Ivan Sinitsin

Scoring 2000 Products per Request: Performance Pitfalls in Golang

Is your clean Go code the real performance bottleneck? See how inefficient memory layout left a CPU idle 90% of the time, and how data-oriented design fixed it.

Scoring 2000 Products per Request: Performance Pitfalls in Golang
#1about 3 minutes

Diagnosing latency when standard performance metrics are green

A high-throughput recommendation system experiences SLA breaches despite healthy database, cache, and network metrics, indicating a language runtime bottleneck.

#2about 4 minutes

How Protobuf's memory layout hurts CPU performance

The default Go code generated by Protobuf scatters objects across the heap, which forces pointer chasing and disables the CPU's hardware prefetcher.

#3about 1 minute

Replacing complex Protobuf timestamps with primitive types

Replacing a Protobuf timestamp object with a simple int64 for Unix milliseconds eliminates millions of allocations and significantly reduces CPU and network load.

#4about 4 minutes

Eliminating polymorphism with flat data structures

Replacing polymorphic 'oneof' fields with flat arrays and offset-based addressing creates a contiguous memory block that dramatically improves performance.

#5about 6 minutes

The physics of sequential versus random memory access

Sequential data access allows the CPU hardware prefetcher to load data into the L1 cache ahead of time, eliminating memory stalls caused by random pointer chasing.

#6about 3 minutes

Optimizing Protobuf serialization with the vtprotobuf plugin

The vtprotobuf plugin generates reflection-free, hardware-sympathetic serialization code that avoids runtime overhead by pre-calculating buffer sizes.

#7about 5 minutes

Using object pools to achieve zero-allocation requests

Implementing object pools with vtprotobuf's generated reset methods allows for memory reuse across requests, but requires strict ownership control to prevent data corruption.

#8about 3 minutes

Building a custom arena allocator for transient objects

A custom arena or bump allocator provides extremely fast, fragmentation-free memory for temporary objects by allocating a single large chunk and advancing a pointer.

#9about 2 minutes

Understanding Go's memory allocator contention under load

Under high request volume, Go's tiered memory allocator becomes a bottleneck as goroutines contend for locks on shared memory pools like Mcentral and Mheap.

#10about 4 minutes

The hidden cost of atomics and zero-synchronization design

Even lock-free atomics cause significant overhead through cache line contention, pushing systems toward a complex but highly scalable share-nothing architecture.

Related jobs
Jobs that call for the skills explored in this talk.

Featured Partners

Related Articles

View all articles

From learning to earning

Jobs that call for the skills explored in this talk.