Open Source API Gateway

429 Too Many Requests: Concurrent Connection Limit Reached

Membrane API Gateway returns 429 Too Many Requests with the title Limit of concurrent connections per client is reached. when a client opens a new connection while its IP address already holds the maximum number of concurrent connections. Membrane writes the response directly to the socket and closes the connection.

The Error Response

The response contains the status 429 Too Many Requests, the title Limit of concurrent connections per client is reached., the detail There is a limit of concurrent connections per client to avoid denial of service attacks., the problem type https://membrane-api.io/problems/user/rate-limit and a link to this page. The type user/rate-limit means that the client exceeded a limit of the gateway.

On TLS ports, Membrane cannot send this document before the TLS handshake. The client receives a TLS alert instead, and the connection is closed.

How the Connection Limit Works

The concurrentConnectionLimitPerIp setting of the transport limits how many connections a single IP address may hold open at the same time. It protects the gateway from clients that exhaust its connections and threads. The default is -1, which means no limit. The limit counts connections, not requests. To limit the number of requests over time, use the rateLimiter plugin.

Common Causes

The Client Opens Too Many Connections

A client opens many parallel connections, for example a load test or a badly configured connection pool, or it does not reuse keep-alive connections and leaves them open.

Many Clients Share One IP Address

Clients behind a NAT gateway, a corporate proxy or a load balancer reach Membrane with the same IP address, so they all count against one limit.

The Limit Is Too Low

The configured limit is lower than what normal traffic from a single client needs.

How to Fix It

  1. Check the log. Membrane logs Concurrent connection limit reached for IP: ... at warn level with the client IP and the first bytes it sent.
  2. As a client, reuse keep-alive connections and limit the number of parallel connections to the gateway.
  3. As an operator, raise concurrentConnectionLimitPerIp on the transport, or set it to -1 to disable the limit. If the clients come through a load balancer, the limit per IP is usually not useful.

Details in Production Mode

Unlike most errors, this response is not shortened in production mode. It contains the detail and the link to this page even with production: true. The response only describes the limit and does not reveal other information about your setup.

Related Documentation

Configuration reference:

← All Membrane error messages

Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.