Throttling Concurrent Connections Per IP: Forum Admin FAQ

When automated scrapers discover a discussion community, aggressive multi-threaded crawlers can quickly saturate upstream workers, spike database loads, and leave ordinary visitors waiting. Implementing connection limits at the web server layer provides an immediate safeguard against thread harvesters. Below are answers to the practical technical questions community administrators face when setting up connection throttling.
What counts as an active connection when limiting scrapers?
A frequent misconception among administrators is that every open TCP socket consumes a slot in the tracking table. Under the Module ngx_http_limit_conn_module, not all connections are counted. A connection only increments the counter when the server actively processes a request and has already read the full request header.
If an automated tool leaves idle keep-alive connections open without issuing an active request, or if incoming data has not yet delivered the full header, those states do not trigger the throttle. Once the limit is exceeded by active requests, the server refuses additional requests by returning an error status code. By default, rejected requests receive an HTTP 503 response, controlled by the limit_conn_status directive, which was introduced in version 1.3.15.
Why should tracking zones use binary IP addresses?
Shared memory zones allocate fixed memory pools to record concurrent states for incoming client keys. Choosing how the client IP is stored directly dictates how many concurrent scraper addresses your server can track simultaneously before memory is exhausted:
- Standard text representation via the
$remote_addrvariable varies from 7 to 15 bytes. - Binary representation via the
$binary_remote_addrvariable occupies a fixed 4 bytes for IPv4 addresses or 16 bytes for IPv6 addresses. - On 32-bit operating systems, each stored state consumes either 32 or 64 bytes of memory, while 64-bit systems always require 64 bytes.
- A 1 megabyte shared memory zone can retain approximately 32 thousand 32-byte states or approximately 16 thousand 64-byte states.
If a shared memory zone runs completely out of storage space, the server responds to all further requests with an error. Storing binary addresses ensures maximum capacity for tracking aggressive harvesting spiders across large forum archives.
How do modern HTTP protocols impact concurrent connection math?
On legacy HTTP versions, clients frequently opened several separate TCP connections to fetch forum assets in parallel. However, under HTTP/2 and HTTP/3, connections support multiplexed streams. In these modern protocols, each individual concurrent request is treated as an independent connection by the limiting module.
This design is particularly advantageous for defending against content scrapers. Even if a harvesting script attempts to pull forum threads across a single multiplexed HTTP/2 session, every simultaneous stream that is actively being processed counts against the defined limit. For broader defense architectures, administrators often combine these connection controls with policies outlined in our Bot Management Profile: Thwarting Forum Scrapers and Bad Signups.
Can connection throttles be tested without blocking forum members?
Administrators who worry about turning away genuine users browsing multiple tabs can test their thresholds safely. The limit_conn_dry_run directive, introduced in version 1.17.6, enables a dry-run mode that defaults to off. When turned on, the server does not enforce restrictions or block client requests, but excessive connections are still counted inside the shared memory zone.
During dry runs, administrators can observe the embedded $limit_conn_status variable (also added in version 1.17.6) to evaluate traffic flow. This variable logs one of three explicit values:
PASSED: The connection stayed within limits.REJECTED: The connection would be blocked under active enforcement.REJECTED_DRY_RUN: The connection exceeded the limit but was permitted during the dry run.
Additionally, the logging severity can be adjusted through limit_conn_log_level (introduced in version 0.8.18, defaulting to error, with options for info, notice, warn, or error). This allows fine-tuning before turning on live mitigation, keeping boards fast as described in our guide on How to Speed Up a Slow Forum: A Practical Checklist.
How do inheritance rules and multiple limit directives behave?
Connection limits can be applied at multiple tiers. An administrator can specify several limit_conn directives simultaneously to enforce a tight ceiling per individual IP while setting a higher global ceiling across an entire virtual host (for instance, limiting an address to 10 connections while capping the entire virtual server at 100).
Directives set inside http, server, or location blocks follow strict inheritance rules: settings are passed down from an outer level if and only if no connection limit directives are explicitly configured on the current level. Note also that legacy configurations using limit_zone should be updated; that syntax was declared obsolete in version 1.1.8 and removed entirely in version 1.7.6, replaced by modern limit_conn_zone declarations defined in the Module ngx_http_limit_conn_module.
Sources
Module ngx_http_limit_conn_module
Published October 30, 2026. No affiliate links on this page. Facts come from the sources linked above; check them for updates.