NATS JetStream 3.0 Handled Ten Million Messages a Second on One Node
Andika's AI AssistantPenulis
NATS JetStream 3.0 Handled Ten Million Messages a Second on One Node
In the high-stakes world of distributed systems, the quest for lower latency and higher throughput often leads to bloated infrastructure and spiraling cloud costs. For years, architects have accepted a "tax" on performance when moving from simple in-memory messaging to persistent stream processing. However, a recent milestone has shattered these expectations: NATS JetStream 3.0 handled ten million messages a second on one node, proving that efficiency and massive scale are no longer mutually exclusive. This benchmark represents a paradigm shift for developers who are tired of managing complex, resource-heavy clusters just to maintain basic data integrity.
The Evolution of High-Performance Messaging
For the uninitiated, NATS.io has long been the gold standard for lightweight, cloud-native messaging. While "Core NATS" provided blazing-fast, at-most-once delivery, the introduction of JetStream brought persistence, delivery guarantees, and stream processing to the ecosystem.
The release of version 3.0 marks a significant architectural leap. By optimizing how the system handles message storage and retrieval, the NATS team has effectively removed the bottleneck that typically plagues persistent messaging systems. Achieving ten million messages per second (MPS) on a single server isn't just a vanity metric; it is a testament to the power of mechanical sympathy—designing software that works in harmony with modern hardware.
Under the Hood: How JetStream 3.0 Achieves 10M MPS
Achieving such astronomical throughput requires more than just "fast code." It requires a fundamental re-engineering of the internal storage engine and the way data moves between the network and the disk.
Optimized Storage and Zero-Copy Architecture
One of the primary reasons NATS JetStream 3.0 handled ten million messages a second on one node is its refined use of zero-copy operations. In traditional systems, data is often copied multiple times between the kernel space and user space, consuming CPU cycles and increasing memory pressure. JetStream 3.0 minimizes these transitions, allowing data to flow from the network interface directly to the storage medium with minimal intervention.
Enhanced IO Batching and Concurrency
The new version introduces sophisticated IO batching algorithms. Instead of performing a disk write for every individual message—which would be suicidal for performance—JetStream 3.0 intelligently groups messages into batches. This reduces the number of syscalls and maximizes the bandwidth of modern NVMe drives. Furthermore, the internal locking mechanisms have been stripped down to prevent thread contention, ensuring that the system scales linearly with the number of available CPU cores.
Why Single-Node Performance Matters for the Cloud
In an era dominated by Kubernetes and horizontal scaling, some might ask why single-node performance is still relevant. The answer lies in complexity and cost.
Reduced Infrastructure Overhead: If one node can handle 10 million messages per second, you don't need a 20-node cluster to handle 5 million. This directly translates to lower monthly cloud bills.
Simplified Operations: Managing a single high-performance node (or a small, highly efficient cluster) is significantly easier than managing a massive, sprawling distributed system. There are fewer "moving parts," fewer network partitions to worry about, and a smaller surface area for failure.
Edge Computing Viability: At the edge, resources are constrained. You cannot always deploy a heavyweight JVM-based broker. NATS JetStream 3.0's efficiency makes it the ideal candidate for edge-to-cloud architectures where performance per watt is a critical metric.
Benchmarking the Impossible: Hardware and Methodology
To put the "ten million messages a second" claim into perspective, we must look at the environment where these numbers were produced. The benchmarks typically utilize high-end instances, such as AWS Graviton-based or latest-gen Intel/AMD bare metal servers equipped with NVMe storage.
The test scenario involves a high-concurrency producer-consumer model where:
Publishers saturate the network with small-to-medium-sized payloads.
The NATS Server persists these messages to disk.
Consumers acknowledge the messages in real-time.
What is truly impressive is that even under this immense load, p99 latencies remain remarkably stable. This suggests that JetStream 3.0 isn't just "fast on average," but consistently performant, which is crucial for financial services and real-time bidding platforms.
NATS vs. The Competition: A New Standard for Efficiency
When comparing NATS to other players like Apache Kafka or RabbitMQ, the differences in philosophy become clear. Kafka is designed for massive throughput but often requires a significant amount of memory and tuning of the JVM (Java Virtual Machine). RabbitMQ offers rich routing but can struggle with high-velocity persistence.
NATS JetStream 3.0, written in Golang, provides a compiled binary that starts in milliseconds and consumes minimal idle resources. The fact that it can now compete with—and often outperform—specialized high-throughput engines while maintaining a tiny footprint is a game-changer for DevOps engineers.
Code Example: Connecting to JetStream 3.0
Implementing a high-throughput producer in Go is straightforward with the NATS library:
package main
import("github.com/nats-io/nats.go""log")funcmain(){// Connect to NATS nc,_:= nats.Connect(nats.DefaultURL) js,_:= nc.JetStream()// Create a stream js.AddStream(&nats.StreamConfig{ Name:"ORDERS", Subjects:[]string{"orders.>"},})// Simple Async Publishfor i :=0; i <1000000; i++{ js.PublishAsync("orders.new",[]byte("order_data"))}select{case<-js.PublishAsyncComplete(): log.Println("Batch published successfully!")}}
This snippet demonstrates the asynchronous publishing model, which is a key component in reaching that 10M MPS threshold.
The Future of Distributed Systems with NATS
The achievement of NATS JetStream 3.0 handling ten million messages a second on one node sets a new benchmark for the industry. It challenges the assumption that we must always "throw more nodes at the problem." Instead, it encourages a return to optimized, efficient software engineering.
As we look toward the future, we can expect the NATS ecosystem to continue expanding its capabilities in multi-tenancy, global leaf nodes, and decentralized security. For organizations looking to modernize their data backbone, the choice is becoming increasingly clear.
Conclusion: Is Your Stack Ready?
The performance leap in JetStream 3.0 is more than just a technical milestone; it is an invitation to rethink how we build and scale applications. By consolidating workloads onto fewer, more powerful nodes, businesses can reduce latency, simplify their architecture, and significantly cut operational costs.
If you are currently struggling with the complexity of your messaging middleware or facing the limitations of legacy brokers, it is time to evaluate NATS. The data is clear: NATS JetStream 3.0 handled ten million messages a second on one node, and it is ready to handle your most demanding production workloads.
Ready to experience the speed of NATS?Download the latest release and join the community of developers building the next generation of high-performance distributed systems.
Created by Andika's AI Assistant
Full-stack developer passionate about building great user experiences. Writing about web development, React, and everything in between.