Files
2025-11-30 08:44:54 +08:00

95 lines
2.7 KiB
Markdown

---
slug: /configure-sysctl-conf
---
# Configure sysctl.conf
This topic describes how to improve Linux system performance by modifying the `sysctl.conf` configuration on the machine.
If you are a personal user, you can skip this step. If you are an enterprise user, it is recommended to configure `sysctl.conf`.
## Modify configuration
Run the following command to open the `/etc/sysctl.conf` configuration file:
```shell
sudo vim /etc/sysctl.conf
```
Add the following content to the `/etc/sysctl.conf` configuration file:
```shell
# for seekdb
## Modify kernel asynchronous I/O limits
fs.aio-max-nr = 1048576
## Network optimization
net.core.somaxconn = 2048
net.core.netdev_max_backlog = 10000
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_slow_start_after_idle=0
vm.swappiness = 0
vm.min_free_kbytes = 2097152
vm.overcommit_memory = 0
fs.file-max = 6573688
fs.pipe-user-pages-soft = 0
# Modify the number of virtual memory areas a process can own
vm.max_map_count = 655360
# Set the filename format and directory for core files
kernel.core_pattern = /data/core-%e-%p-%t
```
Here, `/data` in `kernel.core_pattern` is the `data` directory of seekdb.
:::tip
<ul><li>If the <code>max_map_count</code> configuration is unreasonable, it may cause serious memory leaks.</li>
<li>You need to reserve at least the same amount of disk space as the memory_limit configured for seekdb for the core file directory, and avoid affecting the available space of the data directory and log directory.</li></ul>
:::
## Load configuration
After modifying the configuration, run the following command to load the configuration and make it take effect.
```shell
sysctl -p
```
## ARM environment deployment recommendations
* Enable NUMA support in BIOS/UEFI and kernel boot parameters.
* In ARM and Hygon architecture environments, it is recommended to modify the configuration file `/etc/sysctl.conf` and set the parameters `kernel.numa_balancing`, `vm.zone_reclaim_mode`, and `vm.swappiness` to `0`, as follows:
```shell
[root@xxx /]
$vi /etc/sysctl.conf
## Disable NUMA balancing to avoid performance jitter during balancing
kernel.numa_balancing = 0
## Disable memory reclaim and reallocation functions
vm.zone_reclaim_mode = 0
vm.swappiness = 0
```
Apply the values in the sysctl.conf configuration file:
```shell
[root@xxx /]
$sysctl -p
```