Open Source API Gateway

transport

Version

Opens the listening ports of all APIs, accepts client connections and runs every exchange through the global flow. Each connection is served by its own thread from a shared pool.

Declaring a transport under components overrides the default settings for inbound HTTP connections, such as timeouts, thread pool sizes and TCP options. A configuration may declare at most one transport; without one, Membrane uses a transport with default settings.

Example Configuration

components:
inbound:
transport:
socketTimeout: 60000
maxThreadPoolSize: 300
---
api:
port: 2000
target:
url: https://api.predic8.de
components:
   inbound:
     transport:
       socketTimeout: 60000
       maxThreadPoolSize: 300
 ---
 api:
   port: 2000
   target:
     url: https://api.predic8.de

Syntax

transport:
'$ref': <string>
backlog: <int>
concurrentConnectionLimitPerIp: <int>
coreThreadPoolSize: <int>
flow:
- <flow>
forceSocketCloseOnHotDeployAfter: <int>
maxThreadPoolSize: <int>
reverseDNS: <boolean>
socketTimeout: <int>
tcpNoDelay: <boolean>
transport:
  '$ref': <string>
  backlog: <int>
  concurrentConnectionLimitPerIp: <int>
  coreThreadPoolSize: <int>
  flow:
    - <flow>
  forceSocketCloseOnHotDeployAfter: <int>
  maxThreadPoolSize: <int>
  reverseDNS: <boolean>
  socketTimeout: <int>
  tcpNoDelay: <boolean>

Attributes

NameRequiredDefaultDescriptionExamples
$reffalse-Reference a component defined under components.-
backlogfalse50Maximum number of incoming connections the operating system queues on a listening port before Membrane accepts them. Beyond that, the operating system refuses or drops new connection attempts.200
concurrentConnectionLimitPerIpfalse-1Maximum number of concurrent connections from a single client IP address. A connection beyond the limit is closed after a 429 Problem Details response, or a TLS alert on TLS ports. -1 disables the limit.100
coreThreadPoolSizefalse20Number of threads the pool keeps alive while idle. Threads are created on demand; beyond this number, idle threads are released after 60 seconds.5
forceSocketCloseOnHotDeployAfterfalse30000Grace period in milliseconds when Membrane stops or reloads its configuration (hot deployment). During this period only idle connections are closed, so running exchanges can finish; afterwards all remaining connections are closed.5000
maxThreadPoolSizefalseunlimitedMaximum number of threads, and therefore of concurrent client connections, since each connection occupies one thread. A connection accepted while all threads are busy is closed immediately.300
reverseDNSfalsetrueWhether to resolve the client IP address to a host name via reverse DNS lookup. The result is cached and becomes the remote address of the exchange, e.g. in logs. When false, the IP address is used and no lookup is made.false
socketTimeoutfalse30000Read timeout for client connections in milliseconds. A connection that sends no data for this long, e.g. an idle keep-alive connection, is closed. 0 disables the timeout.60000
tcpNoDelayfalsetrueSets TCP_NODELAY on client connections, which sends data immediately instead of buffering small writes into larger packets (Nagle's algorithm). Lowers latency at the cost of more packets.false

Child Structure

ElementCardinalityDescription
flow0..*Flow every exchange runs through. Without it, Membrane uses a built-in flow that matches the request to an API, runs the API's flow and forwards the request to the target. A configured flow replaces that built-in flow completely, so it has to contain those steps itself.

Can be used in