Netflix engineers optimized their Ranker service's serendipity scoring feature by replacing inefficient nested loops with batched matrix multiplication. This optimization significantly reduced CPU usage and cluster footprint by improving memory layout and leveraging the JDK Vector API.
Highlights
Identified serendipity scoring as a significant CPU hotspot, consuming 7.5% of total CPU per node.
Replaced O(M×N) nested loops for cosine similarity with more efficient batched matrix multiplication operations.
Improved cache locality and reduced garbage collection pressure by restructuring memory layout with flat buffers and ThreadLocal reuse.
Leveraged the JDK Vector API to optimize the computation of vector embeddings at scale.
auto-generated
Netflix Technology Blog · via Netflix TechBlog
Context
Audience
Software Engineers, Machine Learning Engineers, and Backend Developers