In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to view the file opening number of all processes on the Linux server". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
File is the existence form of everything in Linux system. Data and hardware in computer are managed in the form of file. Linux files mainly include ordinary files, folders, device files, link files, pipe files, socket files (interface for data communication) and so on. Things in Linux, such as documents, folders, keyboards, monitors, hard drives, removable media devices, printers, modems, virtual terminals, and so on, are byte streams defined in the file system space.
Therefore, in the web program on the Linux system, when making a TCP connection, the system creates a socket handle for each TCP connection, and each handle is also a file handle, so the operation of the web program on files is an important indicator that affects the performance of the server. For example, the exception of "Too many open files" occurs on a website in a scenario of high traffic and high concurrency because the number of files opened exceeds the limit. On the other hand, the requests for resources (including pictures, audio and video resources), web pages, and interfaces in the program are represented as file access in the Linux system. If the number of files opened exceeds the system limit (system level and user level), the next file access will be denied.
The current limit on the number of files at the user level can be viewed through ulimit-n, as shown below:
The file count limit at the system level can be viewed through sysctl-a, as shown below:
In general, the number of * files in the system will be calculated based on hardware resources. If necessary, * the number of files opened can be modified through ulimit-n 10240. If this method is only valid for the current process, you need to modify / etc/security/limits.conf (restart the system takes effect) if you need to *, as shown below:
Where:
Root: specify a user, such as for all users, write *
Soft: soft limit
Hard: hardware limitation
Nofile represents the number of file openings.
In addition, the following are some instructions related to the open file count operation, for reference only:
1. View the number of file openings for all processes:
Lsof | wc-l
2. View the number of files opened by a process:
Lsof-p pid | wc-l
3. Check the number of handles opened by each process in the system:
Lsof-n | awk'{print $2}'| sort | uniq-c | sort-nr | more
This is the end of the content of "how the Linux server views the file openings of all processes". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.