|
| 1 | +--- |
| 2 | +lastUpdated: "09/30/2020" |
| 3 | +title: "dnsbuf – Configure the DNS UDP Buffer Sizes" |
| 4 | +description: "Configuration Change This feature is available in Momentum 4 8 and later" |
| 5 | +--- |
| 6 | + |
| 7 | +<a name="idp21140416"></a> |
| 8 | + |
| 9 | +**Configuration Change.** This feature is available in Momentum 4.8 and later. |
| 10 | + |
| 11 | +Momentum does not manipulate the size of UDP sockets it creates and uses for DNS queries; instead, it will use the default sizes configured by the Operating System. This can create problems for clients with too many domains (e.g., tens of thousands) in the system. Responses may be dropped, causing unnecessary DNS failures and retries, thus further increasing the DNS query volume. The `dnsbuf` module enables the client to configure the DNS buffer sizes at the service startup. |
| 12 | + |
| 13 | +### <a name="modules.dnsbuf.configuration"></a> Configuration |
| 14 | + |
| 15 | +The `dnsbuf` module is configured as follows: |
| 16 | + |
| 17 | +<a name="example.dnsbuf"></a> |
| 18 | + |
| 19 | +``` |
| 20 | +dnsbuf { |
| 21 | + sndbuf_size = "65536" # Default value is 131072 |
| 22 | + rcvbuf_size = "65536" # Default value is 131072 |
| 23 | +} |
| 24 | +``` |
| 25 | + |
| 26 | +<dl class="variablelist"> |
| 27 | + |
| 28 | +<dt>sndbuf_size</dt> |
| 29 | + |
| 30 | +<dd> |
| 31 | + |
| 32 | +The SO_SNDBUF value is set to this value for all UDP DNS sockets. Minimum value is 1024\. Note that in Linux the value in the kernel is automatically doubled; e.g., when a value of 65536 is configured in the module, the kernel will implement a buffer size of 131072. |
| 33 | + |
| 34 | +</dd> |
| 35 | + |
| 36 | +<dt>rcvbuf_size</dt> |
| 37 | + |
| 38 | +<dd> |
| 39 | + |
| 40 | +The SO_RCVBUF value is set to this value for all UDP DNS sockets. Minimum value is 1024\. Note that in Linux the value in the kernel is automatically doubled; e.g., when a value of 65536 is configured in the module, the kernel will actually implement a buffer size of 131072. |
| 41 | + |
| 42 | +</dd> |
| 43 | + |
| 44 | +</dl> |
| 45 | + |
| 46 | +### <a name="modules.dnsbuf.subtleties"></a> Subtleties |
| 47 | + |
| 48 | + |
| 49 | +* Changes in the values require a service restart to take effect. They are *not* applied in a configuration reload. |
| 50 | +* The buffer cannot be set beyond the **sysctl**-defined maximums in Linux: |
| 51 | + |
| 52 | + ``` |
| 53 | + net.core.rmem_max |
| 54 | + net.core.wmem_max |
| 55 | + ``` |
| 56 | + |
| 57 | + Note that those values are the post-doubled values; e.g., if `net.core.wmem_max` is set to 65536, the maximum value that will work in the `dnsbuf` module is `sndbuf_max` = 32768. |
| 58 | + |
| 59 | +### <a name="modules.dnsbuf.dropped"></a> Determining that DNS Responses are Being Dropped |
| 60 | + |
| 61 | +To determine whether the DNS responses are being dropped because the DNS UDP socket buffer is full, look for a corresponding increase in the "Pending DNS Queries" statistic from Momentum and the UDP packet errors from netstat, e.g.: |
| 62 | + |
| 63 | +``` |
| 64 | +while sleep 1; do (netstat --udp -s | grep error; echo summary | |
| 65 | + /opt/msys/ecelerity/bin/ec_console | grep DNS); echo; done |
| 66 | +``` |
| 67 | + |
| 68 | +The following is an example in which Momentum started with ~30,000 unresolvable domains in the queue. Notice that the "packet receive errors" number has increased, and there are a high number of pending DNS queries. |
| 69 | + |
| 70 | +``` |
| 71 | +1559857 packet receive errors |
| 72 | + DNS A Queries: 924801 |
| 73 | + DNS AAAA Queries: 0 |
| 74 | + DNS MX Queries: 907577 |
| 75 | + Pending DNS Queries: 312 |
| 76 | +
|
| 77 | + 1559857 packet receive errors |
| 78 | + DNS A Queries: 924803 |
| 79 | + DNS AAAA Queries: 0 |
| 80 | + DNS MX Queries: 907849 |
| 81 | + Pending DNS Queries: 43 |
| 82 | +
|
| 83 | + 1560125 packet receive errors |
| 84 | + DNS A Queries: 924803 |
| 85 | + DNS AAAA Queries: 0 |
| 86 | + DNS MX Queries: 908388 |
| 87 | + Pending DNS Queries: 311 |
| 88 | +``` |
0 commit comments