Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set the ulimit value in Linux system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to set the ulimit value in the Linux system, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Max_conn

Description: maximum number of TCP connections allowed to be maintained by the server

Note: when this parameter is set, when the number of existing connections to the server reaches this value, new connections will be rejected. In addition, the value of this parameter cannot exceed the value of the operating system ulimit-n, and this value should not be set too high, because swoole_server will request a large block of memory to store the information of each connection at one time. This value also affects the maximum number of concurrency of the server. In fact, Linux is limited by file handle, and Linux is not very high by default, which is usually 1024. It is easy for production servers to reach this number.

The steps to correctly set the value of ulimit-n for Linux are as follows:

1. First use the command ulimit-n to view the current value

2. Vim / etc/security/limits.conf

It is recommended that you set both of the following to 65535

* soft nofile 65535

* hard nofile 65535

(the preceding * asterisk represents the global, for all users; nofile represents the number of file handles; the value of soft nofile cannot exceed the value of hard nofile)

3. Restart the Linux system

Command: shutdown-r now means to restart immediately

The method for the Linux system to check the number of physical CPU, core and logical CPU is as follows:

When learning swoole, it is recommended that the number of worker processes opened is 1-4 times the number of cpu cores. So I learned how to check the CPU audit.

# check the number of physical CPU

Cat / proc/cpuinfo | grep "physical id" | sort | uniq | wc-l

# View the number of cores per physical CPU

Cat / proc/cpuinfo | grep "cpu cores" | uniq

# check the number of logical CPU

Cat / proc/cpuinfo | grep "processor" | wc-l # View CPU information (model) cat / proc/cpuinfo | grep name | cut-f2-d: | uniq-c

After reading the above, do you have any further understanding of how to set the ulimit value in the Linux system? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report