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.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

The fastest NGINX configuration is not a copied “best” snippet. Measure your current request time, bytes, connection reuse, CPU, memory and upstream latency first; then change one layer at a time and verify the result. Start with worker_processes auto on a multi-core host, size worker connections together with the operating system’s open-file limit, keep connections and TLS sessions reusable, compress only suitable responses, enable HTTP/2 only when the installed modules and TLS stack support it, and design proxy or FastCGI caches around application correctness.

What NGINX optimization actually means

NGINX performance is a balance among throughput, median latency, tail latency, CPU consumption, memory use, TLS handshake work, backend load and response correctness. A directive that improves one measurement can hurt another: compression saves bandwidth but consumes CPU; a larger connection limit helps concurrency only if the process can open enough files; caching reduces origin requests but can serve incorrect content when keys or bypass rules are wrong.

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

Optimize the layer that limits your workload. Static-file delivery, TLS negotiation, response compression, HTTP/2 multiplexing, reverse-proxying and application execution have different bottlenecks. Treat every configuration change as an experiment with a baseline and a rollback.

1. Establish a measurable baseline

Log the variables that explain latency

NGINX exposes variables that make before-and-after comparisons possible. Include request duration, status, response size, connection identity and the number of requests served over that connection. If NGINX proxies an application, also record upstream timing.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
log_format performance '$remote_addr - $request '
                       'status=$status bytes=$bytes_sent '
                       'request_time=$request_time '
                       'connection=$connection '
                       'connection_requests=$connection_requests '
                       'upstream_time=$upstream_response_time';

access_log /var/log/nginx/access.log performance;

request_time measures the complete request; upstream_response_time helps separate application delay from NGINX and network work. Compare the median and high percentiles, not only an average. A faster median with a worse tail can still be a regression for real users.

Record resource and correctness indicators

  • Request time, status-code distribution and bytes sent.
  • Connection reuse through connection_requests.
  • CPU and memory consumption on NGINX workers and application servers.
  • Upstream latency, queueing and backend request rate.
  • TLS handshake rate and negotiated protocol.
  • Compression ratio, cache hit ratio and the rate of bypassed or stale responses.

Apply changes safely

  1. Save the current configuration as a rollback copy.
  2. Change one directive group, such as workers, TLS or caching, rather than several unrelated layers.
  3. Validate syntax before reloading: nginx -t.
  4. Reload only after validation succeeds, then run representative traffic tests.
  5. Compare error rates, tail latency, resource use and content correctness with the baseline.

Re-run this process after an NGINX, OpenSSL, kernel or application upgrade. Defaults and directive availability can change with those components.

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

2. Size workers, connections and file descriptors together

Choose worker processes

The master process manages NGINX; worker processes perform request processing. On a multi-core host, worker_processes auto; is a sensible starting point because NGINX can select a worker count based on available CPUs. A fixed count can be appropriate when CPU affinity or strict resource partitioning is part of your design, but measure before choosing it.

worker_processes auto;

Set a connection ceiling that the host can actually support

worker_connections limits simultaneous connections handled by each worker. It is a concurrency ceiling, not a promise of throughput. The official configuration example uses worker_connections 2000;; treat that as an example to test, not a universal optimum.

events {
    worker_connections 2000;
}

The effective total is also constrained by the operating system’s per-process open-file limit. If workers are allowed to count thousands of sockets but the process cannot open that many files, connections will fail before the NGINX setting is reached. worker_rlimit_nofile can raise NGINX’s file-descriptor ceiling when the host policy permits it.

worker_rlimit_nofile 65535;

Use a value approved for your operating system and workload rather than copying the example. Account for client sockets, upstream sockets, log files, cache files and other descriptors. Validate under peak concurrency; idle keep-alive connections consume descriptors too.

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

Interpret symptoms

  • Connection failures or “too many open files” indicate a descriptor ceiling, not necessarily insufficient CPU.
  • High CPU with available descriptors points toward TLS, compression, application work or excessive request processing.
  • Idle connections consuming most descriptors suggest that keep-alive duration and connection limits need measurement, not an arbitrary increase.

3. Improve static delivery and connection reuse

Evaluate kernel-assisted file delivery

For static files, test sendfile on; so NGINX can use the operating system’s efficient file-transfer path. Pairing it with tcp_nopush on; is shown in NGINX’s example configuration, but the result depends on the kernel, storage path and response pattern. Benchmark with the same files and concurrency used by your application.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
sendfile on;
tcp_nopush on;

Do not assume these directives help every storage backend. Compare bytes-per-second, CPU use and tail latency with them enabled and disabled.

Keep connections alive

HTTP keep-alive lets a client reuse an existing connection instead of repeating TCP and TLS setup. Higher reuse appears in connection_requests and normally reduces handshake work. Keep-alive is especially valuable for HTTPS, where SSL operations consume additional CPU resources.

Connection reuse is not free: every idle socket uses memory and a file descriptor. Size worker connections and file limits with the expected number of active and idle clients, and verify that upstream keep-alive behavior matches the application’s concurrency model.

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

4. Reduce HTTPS overhead without weakening security

Use supported TLS versions

Use the current TLS versions supported by the installed NGINX and OpenSSL combination. NGINX’s examples use TLS 1.2 and TLS 1.3. Confirm support in your exact build before applying syntax from another version.

ssl_protocols TLSv1.2 TLSv1.3;

Do not trade performance for obsolete protocols. A protocol downgrade can increase handshake cost and create a security problem.

Share the SSL session cache

Session reuse avoids repeating expensive handshake operations for returning clients. Configure a shared cache that all workers can use instead of relying only on a worker-local cache.

ssl_session_cache shared:SSL:1m;

NGINX documents that a 1 MB shared cache stores approximately 4,000 TLS sessions. That figure is an approximate documentation value, not a capacity guarantee for every build or session format. Choose the cache size from observed session reuse and memory availability, then monitor handshake rates.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Check the whole TLS path

  • Verify that clients negotiate TLS 1.2 or TLS 1.3 as intended.
  • Measure full handshakes versus resumed sessions.
  • Check CPU during handshake-heavy traffic; SSL operations consume extra CPU.
  • Retest after OpenSSL or NGINX upgrades because supported directives and defaults can change.

5. Use gzip selectively

Choose content types and a size threshold

The gzip module provides gzip_types, gzip_min_length, gzip_proxied, gzip_vary and compression levels from 1 through 9. Enable compression for text-based responses that shrink meaningfully, and avoid spending CPU on already-compressed formats such as common image, video or archive files.

gzip on;
gzip_min_length 1000;
gzip_types text/plain text/css application/javascript application/json application/xml;
gzip_vary on;

The size threshold above is an example to benchmark, not a universal setting. Very small responses may gain little after compression overhead. Set gzip_proxied deliberately when responses come from an upstream server, and ensure caches distinguish compressed and uncompressed variants through the Vary: Accept-Encoding header.

Balance level, CPU and latency

Levels 1–9 provide a bandwidth-versus-CPU trade-off. A higher level can reduce bytes further while increasing compression time. Benchmark CPU, request time, response size and tail latency together; compression overhead can negatively affect performance on CPU-constrained hosts.

Account for HTTPS side effects

When compressing HTTPS responses, consider the BREACH attack risk documented by NGINX. Do not blindly compress secrets or responses that combine attacker-controlled input with sensitive data. Apply application-specific exclusions where necessary.

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

6. Enable HTTP/2 only after compatibility testing

HTTP/2 can multiplex many streams over one connection, but it is not an automatic latency win for every workload. NGINX needs the HTTP/2 module, and TLS connections require ALPN support in OpenSSL. Confirm both the installed NGINX version and TLS library before enabling the directive syntax used by your release.

Test with representative browsers, API clients and proxies. Measure connection counts, stream concurrency, header sizes, response ordering, error rates and upstream behavior. A client or intermediary that does not support the negotiated protocol must still receive a correct response through the supported fallback path.

Compare HTTP/1.1 and HTTP/2 using the same objects and traffic mix. Keep the configuration that improves the metrics that matter to your users, rather than assuming multiplexing lowers every latency measurement.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

7. Add proxy caching without serving the wrong content

Define a cache zone and an explicit key

For cacheable reverse-proxy responses, define a disk path and shared memory zone, enable caching for the intended location and set a deliberate key. The key must vary on every request attribute that changes the representation, such as scheme, host, URI or relevant query parameters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=app_cache:10m inactive=60m;

server {
    location / {
        proxy_pass http://app_backend;
        proxy_cache app_cache;
        proxy_cache_key "$scheme$request_method$host$request_uri";
        proxy_cache_valid 200 10m;
        proxy_cache_lock on;
    }
}

The path, zone size and freshness period above are illustrative values to adapt after measuring your object count, response sizes and freshness requirements. A cache key that omits a language, device, tenant or query parameter can leak one user’s representation to another.

Control freshness, revalidation and failure behavior

Use proxy_cache_valid for explicit freshness periods. Add revalidation when the origin can efficiently confirm that an object has not changed. Define whether stale content may be served during an origin failure, and use proxy_cache_lock when concurrent misses would otherwise create a stampede of identical upstream requests.

Bypass private responses

Authenticated, personalized or otherwise private responses generally should not enter a shared cache. Create matching bypass and no-cache rules based on the application’s headers, cookies and authorization model. Test anonymous, logged-in, expired and error responses separately.

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

8. Tune FastCGI caching for application responses

PHP and other FastCGI applications use the parallel controls fastcgi_cache_path, fastcgi_cache, fastcgi_cache_key, fastcgi_cache_valid, fastcgi_cache_lock and fastcgi_cache_use_stale.

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.
fastcgi_cache_path /var/cache/nginx/fastcgi levels=1:2 keys_zone=fcgi_cache:10m inactive=60m;

location ~ .php$ {
    fastcgi_pass unix:/run/php/php-fpm.sock;
    fastcgi_cache fcgi_cache;
    fastcgi_cache_key "$scheme$request_method$host$request_uri";
    fastcgi_cache_valid 200 5m;
    fastcgi_cache_lock on;
}

Adapt the socket, path and validity period to the installed application. Exclude sessions, authorization-bearing requests, checkout pages, account pages and any response whose content varies per user. If the origin is unavailable, fastcgi_cache_use_stale can be part of a deliberate stale-serving policy; define which failures permit stale data and communicate that behavior to application owners.

Measure cache hit ratio, backend request rate, origin latency and correctness together. A high hit ratio is not a success if invalidation is late or private data is cached.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

9. Use reverse proxying and load balancing based on saturation

NGINX can distribute requests across application servers, but adding servers or changing the balancing arrangement should follow measurements of upstream saturation and queueing. Log upstream timing and compare each backend’s latency, error rate and request rate.

  • Reuse upstream connections where the application protocol and concurrency model support it.
  • Align buffering with response size and latency. Large responses and streaming responses have different needs.
  • Investigate queueing before increasing client-side concurrency; an overloaded origin can make a larger NGINX connection limit harmful.
  • Keep cache keys, bypass rules and authentication semantics consistent across all upstreams.

Do not copy a tuning snippet without checking the NGINX version, kernel, TLS library, storage, workload and backend behavior. Those variables determine whether a setting helps or hurts.

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

10. A repeatable optimization workflow

  1. Baseline. Capture request time, status, bytes, connection reuse, CPU, memory and upstream latency under representative traffic.
  2. Classify the bottleneck. Decide whether delay comes primarily from static I/O, connection setup, TLS, compression, NGINX processing, cache misses or the application.
  3. Change one layer. For example, tune workers and file limits before testing gzip, then test caching separately.
  4. Load-test realistically. Include authenticated and anonymous requests, cache hits and misses, HTTP/1.1 and HTTP/2 clients, and the response sizes users actually receive.
  5. Check tail behavior. Compare high-percentile latency, timeout and error rates, not only average throughput.
  6. Verify correctness. Inspect headers, content encoding, personalized responses, cache age and stale behavior.
  7. Validate and reload. Run nginx -t, reload, watch logs and keep the previous configuration ready for immediate rollback.
  8. Document the result. Record the directive, workload, date, observed change and rollback condition.

11. Troubleshoot common regressions

“Too many open files” or refused connections

Check the operating system and NGINX file-descriptor ceilings, then compare active and idle sockets with the configured worker connection limit. Raising worker_connections without raising the permitted open-file count cannot increase usable concurrency.

CPU rises after enabling gzip

Inspect compressed MIME types, response-size distribution and compression level. Exclude already-compressed formats, raise the minimum-size threshold for tiny responses and test a lower level. Keep the change only if the bandwidth saving justifies the CPU and latency cost.

TLS remains handshake-heavy

Confirm keep-alive is working, clients support session resumption and all workers use the shared SSL session cache. Check negotiated TLS versions and measure full versus resumed handshakes before changing other directives.

Cache responses are stale or personalized

Inspect the cache key, cookies, authorization headers, bypass conditions and invalidation path. Purge or expire affected objects, then test anonymous, authenticated and parameterized URLs independently. A cache hit ratio cannot compensate for incorrect content.

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

HTTP/2 clients fail or show no improvement

Verify that the HTTP/2 module and ALPN-capable OpenSSL build are installed and that the directive syntax matches the NGINX version. Compare stream concurrency, header sizes and upstream timing with HTTP/1.1 clients; disable the change if compatibility or tail latency worsens.

Static files become slower after sendfile changes

Benchmark the same files against the actual storage path and kernel. Storage drivers, virtualized disks and unusual file-generation paths can change the result. Revert the directive when CPU, throughput or tail latency deteriorates.

12. What to compare when choosing a configuration

Area Measure Trade-off or requirement
Workers and connections Throughput, CPU, memory, active connections and descriptor use Worker count and connection limits must fit available CPU and the host open-file limit
Keep-alive and TLS reuse Connection requests, handshake rate and TLS CPU Reuse reduces setup work but idle sockets consume descriptors and memory
Compression Bytes sent, compression ratio, CPU and tail latency Gzip levels 1–9 trade bandwidth for CPU; select MIME types and a size threshold
HTTP/2 Stream concurrency, connection count, header behavior and latency percentiles Requires the HTTP/2 module and ALPN support for TLS; client and upstream testing is required
Proxy or FastCGI cache Hit ratio, backend request rate, origin latency and correctness Keys, freshness, bypass, invalidation and stale policies must match application semantics
Load balancing Per-backend latency, queueing, errors and request distribution Distribute traffic only after measuring upstream saturation and connection reuse

13. A practical order of operations

Begin with observability and safe reloads. Next, make worker processes, worker connections and file limits internally consistent. Then verify keep-alive and test static-file delivery. Reduce TLS setup cost with supported protocols and a shared session cache. Add selective gzip only after measuring CPU. Test HTTP/2 for your actual clients. Finally, introduce proxy or FastCGI caching and load balancing with explicit keys, freshness and privacy rules.

This order isolates causes and makes rollback straightforward. It also prevents a cache or protocol change from hiding an unresolved descriptor, TLS or upstream bottleneck.

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

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.