Home

NSQ

NSQ is an open-source real-time distributed messaging platform designed for high throughput, reliability, and horizontal scalability. It was created by Bitly and is maintained as a community project focusing on a decentralized architecture that avoids a single point of failure.

The NSQ architecture centers on three core components: nsqd, a daemon that stores and delivers messages; nsqlookupd,

In operation, a producer publishes a message to a topic on an nsqd. The message is stored

NSQ communicates primarily over TCP for data delivery and provides HTTP endpoints for administration and monitoring.

a
service
discovery
layer
that
tracks
topics
and
the
nsqd
instances
hosting
them;
and
nsqadmin,
a
web-based
administrative
UI.
Messages
are
organized
into
topics,
and
each
topic
can
have
multiple
channels.
Producers
publish
messages
to
a
topic,
and
each
channel
delivers
those
messages
to
a
set
of
consumers.
The
system
is
designed
to
span
multiple
nsqd
nodes
to
enable
scalability
and
fault
tolerance,
with
nsqlookupd
providing
dynamic
mappings
for
producers
and
consumers
to
locate
relevant
nsqd
instances.
and
made
available
to
all
channels
associated
with
that
topic.
Consumers
connect
to
nsqd
to
receive
messages
from
a
channel.
After
processing
a
message,
a
consumer
acknowledges
it;
if
the
message
is
not
acknowledged
within
a
configured
timeout,
NSQ
re-queues
it
for
delivery,
potentially
to
another
consumer.
This
mechanism
provides
at-least-once
delivery
and
helps
ensure
resilience
in
the
face
of
consumer
failures.
The
architecture
emphasizes
decentralization
rather
than
centralized
brokers,
contributing
to
scalability
and
fault
tolerance.
Client
libraries
exist
for
multiple
languages,
including
Go,
Python,
Java,
Ruby,
and
C#,
enabling
producers
and
consumers
to
integrate
with
diverse
applications.
NSQ
is
commonly
used
for
real-time
event
processing,
telemetry,
and
background
job
processing,
offering
low
latency
and
scalable
operation
while
acknowledging
potential
message
duplicates
and
the
absence
of
strict
delivery
ordering
guarantees.