Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/momentum/4/config-options-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ The `Version` column indicated the version(s) of Momentum that support the optio
| [sysdescription](/momentum/4/config/ref-snmp) – Set the SNMP SysDescription option value | na | (*non-dynamic*) | 4.0 and later | snmp |
| [syslocation](/momentum/4/config/ref-snmp) – Set the SNMP SysLocation option value | na | (*non-dynamic*) | 4.0 and later | snmp |
| [tcp_buffer_size](/momentum/4/config/ref-tcp-buffer-size) – Maximum tcp buffer size for outbound connections | sending | 32768 | 4.0 and later | cluster, global |
| **tcp_recv_buffer_size** – Sets the TCP receive buffer size. When set to 0, the operating system automatically manages the buffer size. | receiving | 4096 (ESMTP_Listener), 32768 (HTTP_Listener) | 4.0 and later | control_listener, eccluster_listener, ecstream_listener, esmtp_listener, http_listener, listen, xmpp_listener |
| [tcp_recv_buffer_size](/momentum/4/config/ref-tcp-recv-buffer-size) – Sets the TCP receive buffer size for inbound connections. When set to 0, the operating system automatically manages the buffer size. | receiving | 4096 (ESMTP_Listener), 32768 (HTTP_Listener) | 4.0 and later | control_listener, eccluster_listener, ecstream_listener, esmtp_listener, http_listener, listen, xmpp_listener |
| **tcp_send_buffer_size** – Sets the TCP send buffer size. When set to 0, the operating system automatically manages the buffer size. | receiving | 4096 (ESMTP_Listener), 32768 (HTTP_Listener) | 4.0 and later | control_listener, eccluster_listener, ecstream_listener, esmtp_listener, http_listener, listen, xmpp_listener |
| [threadpool](/momentum/4/config/ref-threadpool) *(scope)* – Configure thread pool specific options | na |   | 4.0 and later | global |
| [timeout](/momentum/4/control-listener#control_listener.config) – Timeout for idle control connections on Control_Listeners | receiving | 60 | 4.0 and later | control_listener |
Expand Down
6 changes: 4 additions & 2 deletions content/momentum/4/config/ref-tcp-buffer-size.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
lastUpdated: "03/26/2020"
lastUpdated: "09/14/2026"
title: "tcp_buffer_size"
description: "tcp buffer size maximum tcp buffer size for outbound connections tcp buffer size 32768 Momentum uses an auto scaling algorithm to ensure that the tcp buffer size is set optimally This option allows you to set an upper bound on the tcp buffer size selected The default is 32768 bytes..."
---
Expand All @@ -20,6 +20,8 @@ Momentum uses an auto-scaling algorithm to ensure that the tcp buffer size is se

The default is 32768 bytes.

This option applies to outbound connections only. The receive buffer of an inbound connection is governed by [tcp_recv_buffer_size](/momentum/4/config/ref-tcp-recv-buffer-size) on the listener.

### Warning

This is an advanced option. Setting the value too high can cause memory exhaustion. Thorough testing is recommended before deployment in a production environment.
Expand All @@ -32,4 +34,4 @@ tcp_buffer_size is valid in the global scope.
<a name="idp26736160"></a>
## See Also

[use_mmap](/momentum/4/config/ref-use-mmap)
[tcp_recv_buffer_size](/momentum/4/config/ref-tcp-recv-buffer-size), [use_mmap](/momentum/4/config/ref-use-mmap)
60 changes: 60 additions & 0 deletions content/momentum/4/config/ref-tcp-recv-buffer-size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
lastUpdated: "09/14/2026"
title: "tcp_recv_buffer_size"
description: "tcp recv buffer size sets the TCP receive buffer size for inbound connections tcp recv buffer size 4096 The receive buffer is applied to each inbound connection when it is accepted When set to 0 the operating system manages the buffer size and can grow the receive window automatically..."
---

<a name="conf.ref.tcp_recv_buffer_size"></a>
## Name

tcp_recv_buffer_size — sets the TCP receive buffer size for inbound connections

## Synopsis

`tcp_recv_buffer_size = 4096`

<a name="tcp_recv_buffer_size.description"></a>
## Description

The receive buffer size is applied with `SO_RCVBUF` to each inbound connection at the moment it is accepted, and stays in force for the whole connection. The default is 4096 bytes for the ESMTP_Listener and 32768 bytes for the HTTP_Listener.

When set to `0`, no buffer size is imposed and the operating system manages it. On Linux this leaves receive window autotuning enabled, so the kernel grows the window to suit the connection.

### Choosing a value

The receive buffer bounds the TCP receive window, and the receive window bounds throughput on a single connection:

```
maximum throughput = receive window / round-trip time
```

The default of 4096 bytes is large enough to go unnoticed on a low-latency path: on a sub-millisecond LAN even a small window sustains a high transfer rate. On a long path it may become a limit, leading the sending MTA to abandon the transaction on its own [body_timeout](/momentum/4/config/ref-body-timeout) before Momentum can acknowledge it.

Set `tcp_recv_buffer_size = 0` to let the operating system size the buffer, which is the best choice on paths whose latency varies or is not known in advance. Alternatively, size it from the bandwidth-delay product of the path — bandwidth multiplied by round-trip time.

Note that setting a value explicitly (any non-zero value) disables receive window autotuning for the life of the connection, because the kernel treats the buffer as caller-managed. A value chosen for one path is therefore also the ceiling for every other client of that listener.

### Operating system limits

`SO_RCVBUF` is capped by the operating system, so a value larger than the kernel limit is silently reduced. On Linux, check `/etc/sysctl.conf` and if necessary raise:

```
net.core.rmem_max # hard cap for an explicitly requested buffer
net.ipv4.tcp_rmem # min / default / max used by autotuning
```

Remember that Linux doubles the requested size internally to account for bookkeeping overhead, so a socket configured with 262144 reports a 524288-byte buffer.

### Warning

This is an advanced option. Setting the value too high across many concurrent connections can increase memory use significantly. Thorough testing is recommended before deployment in a production environment.

<a name="tcp_recv_buffer_size.scope"></a>
## Scope

`tcp_recv_buffer_size` is valid in the control_listener, eccluster_listener, ecstream_listener, esmtp_listener, http_listener, listen and xmpp_listener scopes.

<a name="tcp_recv_buffer_size.seealso"></a>
## See Also

[tcp_buffer_size](/momentum/4/config/ref-tcp-buffer-size), [disable_nagle_algorithm](/momentum/4/config/ref-disable-nagle-algorithm), [Configuring Inbound Mail Service Using SMTP](/momentum/4/esmtp-listener), [Adjusting /etc/sysctl.conf](/momentum/4/byb-sysctl-conf)
34 changes: 33 additions & 1 deletion content/momentum/4/esmtp-listener.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
lastUpdated: "08/03/2026"
lastUpdated: "09/14/2026"
title: "Configuring Inbound Mail Service Using SMTP"
description: "The ESMTP Listener is the listener that enables you to inject message using SMTP Momentum can listen on any number of Unix domain sockets and or IP port addresses for TCP IP service The ESMTP Listener supports all of the extended properties and extensions described below The ESMTP Listener is..."
---
Expand Down Expand Up @@ -45,6 +45,8 @@ ThreadPool accept-pool {

Listen stanzas map 1:1 to an underlying socket, this means that `:25` (which is the same as *:25) binds to IPv4 (and perhaps IPv6, depending on the kernel); for explicit IPv6, use `[*]:25` instead.

The buffer sizes shown above are the defaults. Before keeping `TCP_Recv_Buffer_Size` at 4096 on an endpoint that receives mail over a high-latency path, see [“Receive Buffers on High-Latency Links”](#esmtp_listener.recv_buffer) below.

The `Pool_Name` option associates the `accept-pool` ThreadPool with the listener. `Concurrency` should have a value that is equal to or less than the concurrency defined in the ThreadPool.

When using threaded accepts for listeners, you must provision the thread pool you intend to use via the ThreadPool directive. If the thread pool you name is not found or is unspecified, the IO pool will be used and a critical message will appear in your log.
Expand All @@ -67,6 +69,36 @@ ESMTP_Listener {
}
```

### <a name="esmtp_listener.recv_buffer"></a> Receive Buffers on High-Latency Links

[TCP_Recv_Buffer_Size](/momentum/4/config/ref-tcp-recv-buffer-size) sets the receive buffer of each inbound connection, and through it the TCP receive window, which bounds how fast a single message can be received: throughput is the receive window divided by the round-trip time.

The default of 4096 bytes is a legacy of the era before window scaling. It is harmless on a low-latency path, but it throttles a long one. A sending MTA typically gives up first: Momentum's own [body_timeout](/momentum/4/config/ref-body-timeout) is 600 seconds, after which it abandons the transaction and retries, even though the receiver went on to accept the message. The symptom on the sending side is a transient failure while reading the confirmation, and the same message being delivered more than once.

If a listener accepts mail across a WAN, a region-to-region relay hop or any path with a round-trip time in the tens or hundreds of milliseconds, either leave the buffer to the operating system:

```
ESMTP_Listener {
Listen ":25" {
TCP_Recv_Buffer_Size = 0 # let the OS autotune the receive window
}
}
```

or size it from the bandwidth-delay product of the path:

```
ESMTP_Listener {
Listen ":25" {
TCP_Recv_Buffer_Size = 262144
}
}
```

Check the operating system ceilings at the same time, since they cap what is actually granted — `net.core.rmem_max` for an explicitly requested buffer, and `net.ipv4.tcp_rmem` for autotuning.

Two caveats are worth knowing. A non-zero value disables receive window autotuning for the connection, so it is a ceiling for every client of that listener, not just the slow ones.

### <a name="esmtp_listener.concurrency"></a> Limiting Inbound Concurrency

You can cap the number of concurrent inbound sessions with two options:
Expand Down
Loading