summaryrefslogtreecommitdiffstats
path: root/health/guides/tcp/tcp_memory.md
blob: 99223c224e590d775617727c88256c4a121bc9ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
### Understand the alert

This alert is triggered when the TCP memory usage on your system is higher than the allowed limit. High TCP memory utilization can cause applications to become unresponsive and result in poor system performance.

### Troubleshoot the alert

To resolve the TCP memory alert, you can follow these steps:

1. Verify the current TCP memory usage:

   Check the current values of TCP memory buffers by running the following command:

   ```
   cat /proc/sys/net/ipv4/tcp_mem
   ```

   The output consists of three values: low, pressure (memory pressure), and high (memory limit).

2. Monitor system performance:

   Use the `vmstat` command to monitor the system's performance and understand the memory consumption in detail:

   ```
   vmstat 5
   ```

   This will display the system's statistics every 5 seconds. Pay attention to the `si` and `so` columns, which represent swap-ins and swap-outs. High values in these columns may indicate memory pressure on the system.

3. Identify high memory-consuming processes:

   Use the `top` command to identify processes that consume the most memory:

   ```
   top -o %MEM
   ```

   Look for processes with high memory usage and determine if they are necessary for your system. If they are not, consider stopping or killing these processes to free up memory.

4. Increase the TCP memory:

   Follow the steps mentioned in the provided guide to increase the TCP memory. This includes:

   - Increase the `tcp_mem` bounds using the `sysctl` command.
   - Verify the change and test it with the same workload that triggered the alarm originally.
   - If the change works, make it permanent by adding the new values to `/etc/sysctl.conf`.
   - Reload the sysctl settings with `sysctl -p`.

### Useful resources

1. [man pages of tcp](https://man7.org/linux/man-pages/man7/tcp.7.html)