Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk4 min

Service Discovery and Load Balancing in Node.js Without Consul or Kubernetes

DNS, Node.js cluster, and NGINX can work together, but each handles a different layer of service discovery or load balancing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can discover service endpoints with DNS, distribute connections among local Node.js workers with cluster, or route HTTP requests among configured application servers with a reverse proxy such as NGINX. These mechanisms solve different problems: choose based on where your instances run and which component should own routing.

Choose the mechanism by the scope of the problem

Start by deciding whether you need more processes on one machine or routing across multiple application instances, potentially on separate machines. Node.js cluster helps with the first case. DNS records can publish endpoint information for clients that need to find services. An HTTP reverse proxy can route requests to an upstream list of application servers.

As an Amazon Associate I earn from qualifying purchases.

Mechanism Scope Where membership comes from What you must manage
DNS and service records Finding service endpoints across machines, if the environment publishes suitable records The DNS zone or DNS service; SRV records can include target names and ports Record updates, caching behavior, endpoint selection, and connection handling
Node.js cluster Worker processes sharing a server port on one host Workers started by the Node.js primary process Worker lifecycle and whether local process distribution fits the workload
NGINX reverse proxy HTTP routing among configured upstream application servers The proxy’s upstream configuration Keeping the configured upstream membership aligned with deployed instances

These layers can be combined, but they are not interchangeable. For example, DNS may help an application find a remote service, while a proxy routes incoming HTTP traffic to a set of app instances. Neither function is supplied automatically by local worker processes.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What Node.js DNS APIs do—and do not do

Node.js has two different kinds of name-resolution API. The distinction matters if you expect a particular DNS record type or want to build endpoint discovery.

dns.lookup() follows operating-system name resolution

dns.lookup() uses operating-system facilities and may not send a DNS query over the network. It is useful for resolving a hostname through the host’s configured name-resolution path, but it is not the API to use when you specifically need DNS record data such as SRV records. See the Node.js DNS documentation.

dns.resolve* methods query DNS records

Methods such as dns.resolveSrv() use the DNS protocol to request records. An SRV result includes a priority, weight, port, and target name. Those fields give an application information about possible service endpoints; they do not implement a complete discovery system by themselves.

For a real SRV-based client, your application still needs to decide how to select among returned records, establish and manage connections, refresh records, respond to failed endpoints, and handle caching appropriately for its environment. SRV helps only when the relevant DNS zone or provider actually publishes usable SRV records.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Promises, address families, and TTLs

The Node.js DNS documentation describes both callback and Promise APIs, as well as address-family options for lookup. It also documents optional TTL output for resolve4() and resolve6(). Do not assume that every DNS method returns a TTL, or that an application cache will automatically honor one: your code and resolver behavior determine how results are refreshed and reused.

Use cluster for multiple local worker processes

The Node.js cluster module creates separate worker processes that can share a server port. This provides process-level distribution on one host; it is not a service registry and does not discover remote machines. The Node.js documentation describes round-robin scheduling and a mode that leaves distribution to the operating system. Round-robin is the default except on Windows. See the Node.js cluster documentation.

A single Node.js process can already handle many concurrent connections. Adding workers changes process-level concurrency and resource use, so choose it to meet a workload or deployment need rather than treating it as a universal requirement. Worker distribution can help use multiple processes on a machine, but it does not tell another service where that machine is or which remote instances are healthy.

Route HTTP traffic with an external reverse proxy

For HTTP traffic that must reach multiple application instances, NGINX documents a reverse-proxy approach using upstream application servers. The proxy becomes a routing point outside the Node.js processes, while the application servers handle the requests it forwards. See NGINX’s HTTP load-balancing documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

With a configured upstream list, someone or something in your deployment process must keep that list aligned with the instances that are actually available. Treat membership updates as an operational responsibility. The exact behavior for health checks, DNS re-resolution, sticky sessions, or dynamic upstream changes depends on the NGINX edition and configuration; do not assume those capabilities from the general reverse-proxy pattern alone.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Put the pieces together without confusing their roles

  • One host, multiple Node.js processes: use cluster when local worker processes are the scope of the need.
  • Finding a remote service: use ordinary hostname resolution when that is what the environment provides; use SRV only when suitable records are published and your application implements selection, refresh, and connection behavior.
  • HTTP routing across app instances: use a reverse proxy such as NGINX with configured upstream servers, and keep its membership current through deployment operations.

The ownership boundary is as important as the mechanism: DNS administrators or services own published records, the Node.js primary manages local workers, and proxy configuration owners manage upstream routing. Combining layers is reasonable—for example, a proxy in front of several app instances, with DNS used to resolve a downstream service—but each layer needs an explicit source of endpoint membership and a plan for changes.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.