Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize ulimit #2358

Merged
merged 1 commit into from
Nov 16, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,30 @@ This topic introduces the Kernel configurations in Nebula Graph.

## Resource control

### ulimit precautions

The `ulimit` command specifies the resource threshold for the current shell session. The precautions are as follows:

- The changes made by `ulimit` only take effect for the current session or child process.

- The resource threshold (soft threshold) cannot exceed the hard threshold.

- Common users cannot use commands to adjust the hard threshold, even with `sudo`.

- To modify the system level or adjust the hard threshold, edit the file `/etc/security/limits.conf`. This method requires re-login to take effect.

### ulimit -c

`ulimit -c` limits the size of the core dumps. We recommend that you set it to `unlimited`. The command is:
You may run the `ulimit` command to control the resource threshold. However, the changes made only take effect for the current session or sub-process. To make permanent changes, edit file `/etc/security/limits.conf`. The configuration is as follows:

```bash
ulimit -c unlimited
# <domain> <type> <item> <value>
* soft core unlimited
* hard core unlimited
* soft nofile 130000
* hard nofile 130000
```

### ulimit -n
!!! note

`ulimit -n` limits the number of open files. We recommend that you set it to more than 100,000. For example:
The configuration modification takes effect for new sessions.

```bash
ulimit -n 130000
```
The parameter descriptions are as follows.

|Parameter|Description|
|:--|:--|
|`domain`| Control Domain. This parameter can be a user name, a user group name (starting with `@`), or `*` to indicate all users.|
|`type`| Control type. This parameter can be `soft` or `hard`. `soft` indicates a soft threshold (the default threshold) for the resource and `hard` indicates a maximum value that can be set by the user. The `ulimit` command can be used to increase `soft`, but not to exceed `hard`.|
|`item`| Resource types. For example, `core` limits the size of the core dump file, and `nofile` limits the maximum number of file descriptors a process can open.|
|`value`| Resource limit value. This parameter can be a number, or `unlimited` to indicate that there is no limit.|

You can run `man limits.conf` for more helpful information.

## Memory

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,30 @@

## 资源控制

### ulimit 注意事项

命令`ulimit`用于为当前 shell 会话设置资源阈值,注意事项如下:

- `ulimit`所做的更改仅对当前会话或子进程生效。

- 资源的阈值(软阈值)不能超过硬阈值。

- 普通用户不能使用命令调整硬阈值,即使使用`sudo`也不能调整。

- 修改系统级别或调整硬性阈值,请编辑文件`/etc/security/limits.conf`。这种方式需要重新登录才生效。
### ulimit -c

`ulimit -c`用于限制 core 文件的大小,建议设置为`unlimited`,命令如下:
虽然可以用`ulimit`进行资源控制,但是所做的更改仅对当前会话或子进程生效。如果需要永久生效,请编辑文件`/etc/security/limits.conf`。配置如下:

```bash
ulimit -c unlimited
# <domain> <type> <item> <value>
* soft core unlimited
* hard core unlimited
* soft nofile 130000
* hard nofile 130000
```

### ulimit -n
!!! note

`ulimit -n`用于限制打开文件的数量,建议设置为超过 10 万,例如:
配置修改后会对新的会话生效。

```bash
ulimit -n 130000
```
参数说明如下。

|参数|说明|
|:--|:--|
|`domain`|控制域。可以是用户名称、用户组名称(以`@`开头),或者用`*`表示所有用户。|
|`type`|控制类型。可以是`soft`或`hard`。`soft`表示资源的软阈值(默认阈值),`hard`表示用户可以设置的最大值。可以使用`ulimit`命令提高`soft`,但不能超过`hard`。|
|`item`|资源类型。例如`core`限制核心转储文件的大小,`nofile`限制一个进程可以打开的最大文件描述符数量。|
|`value`|资源限制值。可以是一个数字,或者 unlimited 表示没有限制。|

可以执行`man limits.conf`查看更多帮助信息。

## 内存

Expand Down