Inferensys

Glossary

Data Locality

A scheduling concept in distributed systems that places computation close to cached data, using affinity rules to minimize data transfer latency.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
DISTRIBUTED SCHEDULING PRINCIPLE

What is Data Locality?

Data locality is a scheduling strategy that minimizes network transfer overhead by placing computational tasks on the same physical node or rack where the required data already resides.

Data locality is a scheduling concept in distributed computing that co-locates computation with its required data to eliminate network transfer latency. By enforcing affinity rules, schedulers like Kubernetes direct pods to nodes where cached datasets or persistent volumes are already present, avoiding costly remote reads.

In AI-enhanced RAN architectures, data locality is critical for proactive caching strategies. When a Multi-access Edge Computing (MEC) node predicts content popularity and pre-fetches data, the inference task must execute on that same edge node to achieve sub-millisecond latency, making locality a foundational requirement for edge inference offloading.

FOUNDATIONAL PRINCIPLES

Core Characteristics of Data Locality

Data locality is a scheduling strategy that minimizes network I/O by placing computation on the node where the required data resides. It is a critical optimization in distributed systems, from Kubernetes pod scheduling to Apache Spark job execution.

01

Node Affinity and Anti-Affinity

The primary mechanism for enforcing data locality in container orchestration. Node Affinity attracts pods to specific nodes based on labels, while Pod Anti-Affinity ensures replicas are spread across failure domains.

  • RequiredDuringSchedulingIgnoredDuringExecution: A hard rule that must be met for a pod to be scheduled.
  • PreferredDuringSchedulingIgnoredDuringExecution: A soft preference that the scheduler tries to satisfy but does not guarantee.
  • This is distinct from Taints and Tolerations, which repel pods from nodes unless explicitly tolerated.
ms
Intra-rack latency
10x+
Cross-DC penalty
02

Rack and Topology Awareness

Modern schedulers are aware of the physical or virtual topology of the cluster. They use this to optimize data transfer costs.

  • Rack Awareness: In Hadoop and Spark, the scheduler knows which nodes share a power supply or network switch to prevent correlated failures.
  • Topology Spread Constraints: In Kubernetes, this feature distributes pods across zones, regions, or hosts to maximize availability while respecting data gravity.
  • The goal is to keep the network hop count between compute and storage as low as possible, ideally on the same physical host.
< 1 ms
Local NVMe access
~500 µs
RDMA transfer
03

Data Gravity

A concept coined by Dave McCrory stating that as data accumulates in a location, services and applications are attracted to it due to the prohibitive cost and latency of moving large datasets.

  • Large datasets have a 'gravitational pull' that influences where computation should run.
  • This is the inverse of the traditional model where compute was fixed and data was moved to it.
  • In practice, this means ETL jobs and analytics engines are deployed in the same availability zone as the data lake or data warehouse.
TB/s
Modern data ingest rates
04

Cache Affinity and Sticky Sessions

A stateful form of data locality where requests from a specific user or session are routed to the same server that holds their hot data in memory.

  • Sticky Sessions: A load balancer configuration that uses cookies or IP hashing to maintain session affinity.
  • Consistent Hashing: An algorithm that minimizes cache redistribution when nodes are added or removed, preserving locality.
  • This is crucial for in-memory data grids like Redis or Hazelcast, where fetching from a cold cache defeats the purpose of the optimization.
99.9%
Target cache hit ratio
05

Data Locality in Apache Spark

Spark's scheduler has a sophisticated, multi-tiered data locality preference system that directly impacts job performance.

  • PROCESS_LOCAL: Data is in the same JVM. Best case.
  • NODE_LOCAL: Data is on the same node (e.g., HDFS). Requires disk I/O.
  • RACK_LOCAL: Data is on the same rack. Requires a network hop.
  • ANY: Data is elsewhere in the network.
  • Spark will wait for a configurable time (spark.locality.wait) for a local executor to free up before degrading to the next level.
PROCESS_LOCAL
Optimal Spark level
3s
Default locality wait
06

NUMA-Aware Scheduling

Non-Uniform Memory Access (NUMA) is a hardware architecture where memory access time depends on the memory's location relative to a CPU. NUMA-aware scheduling binds processes to specific CPU cores and their local memory banks.

  • Prevents the performance penalty of a CPU accessing memory attached to a remote socket.
  • Critical for high-performance computing and latency-sensitive database workloads.
  • Tools like numactl on Linux allow manual binding, while modern Kubernetes supports the TopologyManager policy to align pod resources with NUMA nodes.
~100 ns
Local memory access
~300 ns
Remote socket access
DATA LOCALITY

Frequently Asked Questions

Clear, technically precise answers to the most common questions about data locality in distributed systems, Kubernetes scheduling, and edge computing architectures.

Data locality is a scheduling principle in distributed computing that places computational tasks on or near the node where the required data already resides, minimizing network transfer latency. It works by using affinity rules and topology-aware scheduling to co-locate processing with storage. In practice, a scheduler inspects metadata about data placement—such as HDFS block locations or persistent volume node affinities in Kubernetes—and preferentially assigns workloads to nodes holding the relevant data. This avoids the performance penalty of moving large datasets across congested network links. The concept is foundational to frameworks like Apache Hadoop, which famously moves computation to data rather than data to computation, and is now critical in edge computing, where data generated by IoT sensors must be processed locally to meet sub-millisecond latency budgets.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.