DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk8 min

How Many CPU Cores Do You Have? Set NGINX Worker Processes Correctly

Set NGINX worker processes with confidence: count the CPUs visible inside your VM or container, start with worker_processes auto, and tune connections and limits using real workload measurements.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start with worker_processes auto;. NGINX will try to detect the CPU capacity visible to its process and create an appropriate number of request-processing workers. Check the CPUs available inside the same virtual machine or container that runs NGINX, not just the host’s total. Use an explicit number only when load measurements, CPU pinning, or an orchestration constraint show that it is better.

Worker count is only one part of capacity planning. worker_connections, the process open-file limit, TLS or proxy workload, disk speed, and CPU quotas can all become the real bottleneck. The settings below give you a safe baseline and a way to tune it without guessing.

As an Amazon Associate I earn from qualifying purchases.

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

The short answer

For a current NGINX installation on a multi-core system, put this at the top level of nginx.conf:

worker_processes auto;

events {
    worker_connections 512;
}

auto is a starting point, not a promise of maximum throughput. It asks NGINX to use the CPU capacity it can see. A container limited to two CPUs may therefore need only two workers even when the physical host has 32. Conversely, an explicit value equal to the host’s CPU count can create unnecessary scheduling overhead when a VM, cpuset, or cgroup gives NGINX less capacity.

#1 Best Overall
Sale
AMD RYZEN 7 9800X3D 8-Core, 16-Thread Desktop Processor
  • The world’s fastest gaming processor, built on AMD ‘Zen5’ technology and Next Gen 3D V-Cache.
  • 8 cores and 16 threads, delivering +~16% IPC uplift and great power efficiency
  • 96MB L3 cache with better thermal performance vs. previous gen and allowing higher clock speeds, up to 5.2GHz
  • Drop-in ready for proven Socket AM5 infrastructure
  • Cooler not included

After changing the configuration, reload NGINX, verify the resulting worker count, and test with representative traffic. Keep the automatic setting unless measurements demonstrate a repeatable benefit from another number.

How NGINX uses CPU cores

NGINX has a master process and one or more worker processes. The master reads and validates configuration, opens listening sockets, and starts or stops workers. Workers accept connections and process HTTP requests, TLS handshakes, static files, and proxy traffic. The worker_processes directive controls how many workers the master starts.

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

The documented default is 1. That is safe for a small installation but leaves additional cores unused for request processing. NGINX documentation says the optimal value depends on several factors, including CPU cores, the number of hard drives storing data, and the load pattern. A static-file server, a TLS-heavy reverse proxy, and a disk-bound application can therefore reach different optimums on the same machine.

On multiprocessor systems, NGINX’s HTTPS guidance recommends running several workers, at least as many as the available CPU cores, and shows worker_processes auto; in a multi-core example. Treat that as a starting point: benchmark your own traffic before forcing a fixed count.

How to find the CPU count NGINX can actually use

The relevant number is the CPU capacity visible to the NGINX process. A physical server’s specification, a cloud provider’s advertised vCPU total, and the process’s effective CPU set are not necessarily the same.

Rank #2
Sale
AMD Ryzen 5 5500 6-Core, 12-Thread Unlocked Desktop Processor with Wraith Stealth Cooler
  • Can deliver fast 100 plus FPS performance in the world's most popular games, discrete graphics card required
  • 6 Cores and 12 processing threads, bundled with the AMD Wraith Stealth cooler
  • 4.2 GHz Max Boost, unlocked for overclocking, 19 MB cache, DDR4-3200 support
  • For the advanced Socket AM4 platform

Linux host or virtual machine

Run these commands in the same operating-system environment as NGINX:

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

Both report online processors available to the command. You can inspect the broader kernel view with:

grep -c '^processor' /proc/cpuinfo

That last value can differ from the CPUs a service is allowed to run on when affinity or cgroup limits are present. Prefer the process-visible result when deciding on workers.

Docker or another container

Execute the check inside the running container rather than on the Docker host:

docker exec <container-name> nproc
docker exec <container-name> getconf _NPROCESSORS_ONLN

A container may have a CPU quota, a cpuset, or both. A host command such as nproc can consequently report a larger number than the NGINX process can schedule on. If the container was started with a CPU limit, confirm the limit in the container or through the orchestrator’s workload definition before selecting an explicit worker count.

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.
Rank #3
AMD Ryzen 9 9950X3D 16-Core Processor
  • AMD Ryzen 9 9950X3D Gaming and Content Creation Processor
  • Max. Boost Clock : Up to 5.7 GHz; Base Clock: 4.3 GHz
  • Form Factor: Desktops , Boxed Processor
  • Architecture: Zen 5; Former Codename: Granite Ridge AM5

VMs, cpusets, and orchestrators

A virtual machine normally exposes only its assigned vCPUs. Kubernetes and other schedulers can additionally restrict a pod to a cpuset or a quota. Check the effective CPU assignment for the NGINX process, not merely the node’s total. If the scheduler can change that assignment during deployment, auto is usually safer than baking a host-specific integer into the image.

Other operating systems

On macOS, sysctl -n hw.logicalcpu displays online logical CPUs. On Windows, Task Manager’s CPU panel shows logical processors; PowerShell can report them with:

(Get-CimInstance Win32_Processor).NumberOfLogicalProcessors

NGINX deployments are most commonly Linux or BSD based, so always confirm the number from the Unix environment where the master process runs.

Configure and reload worker_processes

The directive belongs in the main context of nginx.conf, outside the http and events blocks. Its syntax is either an integer or auto. The automatic form is supported in NGINX versions 1.3.8 and 1.2.5 and later.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Open the active configuration. Use the file loaded by your service, commonly /etc/nginx/nginx.conf, and confirm the path with your package or service configuration.
  2. Set the worker count. Use worker_processes auto; unless you have a measured reason to choose an integer.
  3. Keep connection settings separate. In the events block, set an appropriate worker_connections value; changing worker count does not automatically raise file-descriptor limits.
  4. Validate before applying. Run nginx -t. Do not reload if the test reports a syntax or permission error.
  5. Reload gracefully. On a systemd installation, use sudo systemctl reload nginx; with a direct installation, sudo nginx -s reload sends the reload signal to the master process.
  6. Confirm the result. List NGINX processes with your operating system’s process tool and check that the master has the expected number of workers. Then observe traffic rather than assuming the setting helped.

An explicit value is valid when the deployment requires it. For example, a service pinned to four CPUs might use worker_processes 4;. Do not set the number to the physical host’s core total when NGINX is confined to a smaller CPU set.

Rank #4
Sale
AMD Ryzen™ 5 9600X 6-Core, 12-Thread Unlocked Desktop Processor
  • Pure gaming performance with smooth 100+ FPS in the world's most popular games
  • 6 Cores and 12 processing threads, based on AMD "Zen 5" architecture
  • 5.4 GHz Max Boost, unlocked for overclocking, 38 MB cache, DDR5-5600 support
  • For the state-of-the-art Socket AM5 platform, can support PCIe 5.0 on select motherboards
  • Cooler not included

auto versus an explicit worker count

Decision factor worker_processes auto; Explicit integer
CPU capacity visible to NGINX Attempts to adapt to the CPUs available to the process. You must keep the number aligned with VM, container, and cpuset changes.
Static, TLS, proxy, or disk-heavy load Provides a sensible baseline, but workload testing is still required. Useful when measurements show a stable optimum for a known workload.
Connection and file-descriptor limits Does not change worker_connections or open-file limits. Also does not change those limits; more workers alone may add no usable capacity.
CPU utilization and latency Start here, then compare utilization, latency, throughput, and errors under representative load. Keep it only when a repeatable test improves the metrics that matter.
VM or container quotas Usually follows the capacity visible to the process. Can oversubscribe CPUs if copied from the host or a different environment.
Operational constraints Adapts when assigned CPU capacity changes. May be required by a platform, licensing policy, or deliberate CPU partitioning.

More workers are not automatically better. Excess workers compete for the same CPUs, consume memory, and can increase context switching. Too few workers can leave cores idle when request processing is CPU-bound. The correct choice is the one that improves your measured service metrics at the concurrency and request mix you actually serve.

How many worker_connections do you need?

worker_connections is the maximum number of simultaneous connections opened by one worker. Its documented default is 512. The limit includes connections to proxied upstream servers, not just client sockets, and it cannot exceed the process’s open-file limit.

A rough upper bound is:

worker_processes × worker_connections

For example, four workers with worker_connections 512; give a nominal 2,048 connections. That is not a guaranteed number of clients. A reverse-proxy request can consume one connection for the client and another for the upstream, keepalive sockets remain open, and the operating system may impose a lower descriptor limit. Memory, bandwidth, upstream capacity, and application latency can become bottlenecks first.

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.

Tune the two limits independently

  • Raise worker_connections when the measured concurrency of client and upstream sockets approaches the per-worker ceiling.
  • Raise the NGINX process’s open-file limit as well; a larger directive is ineffective if the operating system refuses more descriptors.
  • Check whether proxying doubles connection usage for your workload.
  • Test long-lived WebSocket, HTTP/2, or keepalive traffic separately from short static requests because each pattern holds connections for a different length of time.

Do not multiply workers merely to obtain a larger theoretical connection total. First establish whether the bottleneck is CPU, descriptors, memory, network, or the upstream application.

A measurement-led tuning procedure

  1. Record the starting point. Note the CPU count visible inside the NGINX environment, current worker count, worker_connections, open-file limits, request rate, latency percentiles, and error rate.
  2. Use the automatic baseline. Set worker_processes auto;, validate with nginx -t, reload, and confirm the workers started.
  3. Apply representative load. Include the real mix of static files, TLS handshakes, dynamic proxy requests, uploads, and long-lived connections. A synthetic test containing only one request type can favor the wrong setting.
  4. Watch CPU and latency together. Look for saturated CPUs, idle CPUs, rising tail latency, throughput changes, and worker or upstream errors. A higher request rate is not an improvement if latency or errors worsen.
  5. Check descriptor headroom. Compare active connections and open files with both worker_connections and the process limit. If descriptors are exhausted, fix that constraint rather than adding workers.
  6. Test one explicit value at a time. If auto is suboptimal, test a small range around the visible CPU count while holding other settings constant. Keep a change only when the result is repeatable.
  7. Re-test after deployment changes. A new container quota, VM size, TLS configuration, storage layout, or traffic mix can invalidate a previously optimal integer.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

CPU affinity: when to bind workers

By default, NGINX workers are not bound to particular CPUs. The worker_cpu_affinity directive can bind workers to CPU sets represented by bitmasks. Its auto affinity mode is documented for FreeBSD and Linux.

Best Value
Sale
AMD Ryzen 7 7800X3D 8-Core, 16-Thread Desktop Processor
  • Processor provides dependable and fast execution of tasks with maximum efficiency.Graphics Frequency : 2200 MHZ.Number of CPU Cores : 8. Maximum Operating Temperature (Tjmax) : 89°C.
  • Ryzen 7 product line processor for better usability and increased efficiency
  • 5 nm process technology for reliable performance with maximum productivity
  • Octa-core (8 Core) processor core allows multitasking with great reliability and fast processing speed
  • 8 MB L2 plus 96 MB L3 cache memory provides excellent hit rate in short access time enabling improved system performance

Affinity is an advanced placement tool, not a substitute for sizing workers. Deliberate binding can reduce unwanted migration or reserve CPUs for other services, but it can also conflict with a container’s cpuset or an orchestrator’s scheduling decisions. Use it only when you control the CPU topology and measurements show a benefit. If the platform changes the available CPU set, revisit the masks before reusing the configuration.

Troubleshooting common symptoms

Only one worker appears

Check whether the configuration still uses the default or an explicit worker_processes 1;. Run nginx -T to display the complete active configuration, then validate and reload. A process listing taken before the reload can also show the old generation of workers.

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

auto selects fewer workers than the host has CPUs

This is expected when NGINX runs in a VM, container, cpuset, or cgroup quota. Measure CPUs from inside that environment and inspect the scheduler’s assignment. The host total is not the effective capacity of the process.

Adding workers does not increase throughput

Check CPU utilization, disk wait, upstream response time, network bandwidth, memory pressure, and open-file limits. If another resource is saturated, additional workers only compete for the same bottleneck.

Connections are rejected despite a high connection setting

Compare active client and upstream sockets with the per-worker limit and the process open-file limit. Remember that proxied connections count too. Raise both limits only after confirming that the operating system, memory budget, and upstream service can handle the additional concurrency.

Latency rises after enabling affinity

Remove or relax the affinity rule and repeat the same load test. A mask that conflicts with a container or leaves some workers sharing too few CPUs can be worse than the default scheduler behavior.

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

Quick Recap

SaleBestseller No. 1
AMD RYZEN 7 9800X3D 8-Core, 16-Thread Desktop Processor
AMD RYZEN 7 9800X3D 8-Core, 16-Thread Desktop Processor
8 cores and 16 threads, delivering +~16% IPC uplift and great power efficiency; Drop-in ready for proven Socket AM5 infrastructure
$443.00
SaleBestseller No. 2
AMD Ryzen 5 5500 6-Core, 12-Thread Unlocked Desktop Processor with Wraith Stealth Cooler
AMD Ryzen 5 5500 6-Core, 12-Thread Unlocked Desktop Processor with Wraith Stealth Cooler
6 Cores and 12 processing threads, bundled with the AMD Wraith Stealth cooler; 4.2 GHz Max Boost, unlocked for overclocking, 19 MB cache, DDR4-3200 support
$87.95
Bestseller No. 3
AMD Ryzen 9 9950X3D 16-Core Processor
AMD Ryzen 9 9950X3D 16-Core Processor
AMD Ryzen 9 9950X3D Gaming and Content Creation Processor; Max. Boost Clock : Up to 5.7 GHz; Base Clock: 4.3 GHz
$689.00
SaleBestseller No. 4
AMD Ryzen™ 5 9600X 6-Core, 12-Thread Unlocked Desktop Processor
AMD Ryzen™ 5 9600X 6-Core, 12-Thread Unlocked Desktop Processor
Pure gaming performance with smooth 100+ FPS in the world's most popular games; 6 Cores and 12 processing threads, based on AMD "Zen 5" architecture
$177.99
SaleBestseller No. 5
AMD Ryzen 7 7800X3D 8-Core, 16-Thread Desktop Processor
AMD Ryzen 7 7800X3D 8-Core, 16-Thread Desktop Processor
Ryzen 7 product line processor for better usability and increased efficiency; 5 nm process technology for reliable performance with maximum productivity
$348.00

Practical checklist

  • Count CPUs from the same VM or container that runs NGINX.
  • Use worker_processes auto; as the initial setting.
  • Keep worker_connections and open-file limits as separate tuning tasks.
  • Validate with nginx -t before every reload.
  • Measure CPU, latency, throughput, errors, descriptors, and upstream health under realistic traffic.
  • Choose an explicit worker count only for a demonstrated performance gain or a clear deployment constraint.
  • Apply CPU affinity only when intentional placement is needed and compatible with the platform’s CPU assignment.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.