In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
The purpose of this article is to share with you what the commonly used kernel parameters of linux refer to. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
The common parameters are as follows:
1) / proc/sys/kernel/ctrl-alt-del
The file has a binary value that controls how the system reacts when it receives a combination of ctrl+alt+delete keys. These two values are:
A zero (0) value, which means that the ctrl+alt+delete is captured and sent to the init program; this allows the system to shut down and restart safely, just like typing the shutdown command.
A value of one (1) means that the ctrl+alt+delete is not captured and an abnormal shutdown will be performed, just as if the power was turned off directly.
Default setting: 0
Recommended setting: 1 to prevent accidental pressing of ctrl+alt+delete from causing abnormal restart of the system.
2) proc/sys/kernel/msgmax
This file specifies the maximum length (bytes) of messages sent from one process to another. Inter-process messaging takes place in the kernel's memory and is not exchanged to disk, so increasing this value increases the amount of memory used by the operating system.
Default: 8192
3) / proc/sys/kernel/msgmnb
This file specifies the maximum length of a message queue (bytes).
Default: 16384
4) / proc/sys/kernel/msgmni
This file specifies the maximum number of message queue identities, that is, the maximum number of message queues within the system.
Default: 16
5) / proc/sys/kernel/panic
This file indicates the amount of time (in seconds) that the kernel waits before rebooting if a "kernel critical error (kernel panic)" occurs.
Zero (0) seconds, which means that automatic reboot is disabled in the event of a serious kernel error.
Default setting: 0
6) proc/sys/kernel/shmall
This file represents the total amount of shared memory (bytes) that can be used on the system at any given time.
Default: 2097152
7) / proc/sys/kernel/shmmax
This file represents the maximum size of shared memory segments allowed by the kernel (bytes).
Default: 33554432
Recommended setting: physical memory * 50%
The actual maximum available shared memory segment size = shmmax * 98%, of which about 2% is used for shared memory structure.
You can verify this by setting shmmax and then executing ipcs-l.
8) / proc/sys/kernel/shmmni
This file represents the maximum number of shared memory segments used for the entire system.
Default: 4096
9) / proc/sys/kernel/threads-max
This file represents the maximum number of threads that the kernel can use.
Default: 2048
10) / proc/sys/kernel/sem
This file is used to control kernel semaphores, which are the methods used by System VIPC for interprocess communication.
Recommended setting: 250 32000 100 128
The first column represents the maximum number of semaphores in each signal set.
The second column represents the total number of system-wide maximum semaphores.
The third column represents the maximum number of system operations when each signal occurs.
The fourth column represents the system-wide maximum total number of signal sets.
So, (first column) * (fourth column) = (second column)
The above settings can be verified by executing ipcs-l.
11) to be continued.
3. / proc/sys/vm/ optimization
1) / proc/sys/vm/block_dump
This file indicates whether Block Debug mode is turned on and is used to record all read-write and Dirty Block write-back actions.
Default: 0, disable Block Debug mode
2) / proc/sys/vm/dirty_background_ratio
This file represents the percentage of dirty data reaching the overall memory of the system, which triggers the pdflush process to write the dirty data back to disk.
Default: 10
3) / proc/sys/vm/dirty_expire_centisecs
This file indicates that if dirty data stays in memory for longer than this value, the pdflush process will write the data back to disk next time.
Default setting: 3000 (1amp 100 seconds)
4) / proc/sys/vm/dirty_ratio
This file indicates that if the dirty data generated by the process reaches the percentage of the overall memory of the system, the process writes the dirty data back to disk on its own.
Default: 40
5) / proc/sys/vm/dirty_writeback_centisecs
This file indicates how often the pdflush process periodically writes dirty data back to disk.
Default setting: 500 (1 stroke 100 seconds)
6) / proc/sys/vm/vfs_cache_pressure
This file indicates the kernel's tendency to recycle memory for directory and inode cache; the default value of 100 indicates that the kernel will keep directory and inode cache at a reasonable percentage based on pagecache and swapcache; lowering this value below 100 will cause the kernel to tend to retain directory and inode cache; by more than 100, which will cause the kernel to tend to recycle directory and inode cache.
Default: 100
7) / proc/sys/vm/min_free_kbytes
This file represents the minimum amount of free memory (Kbytes) that forces Linux VM to reserve.
Default: 724 (512m physical memory)
8) / proc/sys/vm/nr_pdflush_threads
This file indicates the number of pdflush processes currently running, and the kernel will automatically add more pdflush processes when the load is high.
Default: 2 (read-only)
9) / proc/sys/vm/overcommit_memory
This file specifies the kernel's policy for memory allocation, which can be 0, 1, 2.
0, which means that the kernel will check whether there is enough memory available for the application process; if there is enough memory available, the memory request is allowed; otherwise, the memory request fails and the error is returned to the application process.
1, which means that the kernel allows all physical memory to be allocated, regardless of the current memory state.
2, indicating that the kernel allows more memory to be allocated than the sum of all physical memory and swap space (see overcommit_ratio).
Default setting: 0
10) / proc/sys/vm/overcommit_ratio
The file indicates that if overcommit_memory=2, the percentage of memory can be overloaded, and the following formula is used to calculate the overall available memory of the system.
System allocable memory = swap space + physical memory * overcommit_ratio/100
Default: 50 (%)
11) / proc/sys/vm/page-cluster
This file represents the number of pages written when writing once to the swap area. 0 represents 1 page, 1 represents 2 pages, and 2 represents 4 pages.
Default: 3 (2 to 3, 8 pages)
12) / proc/sys/vm/swapiness
This file represents the extent to which the system is swapping, and the higher the value (0-100), the more likely it is that disk swapping will occur.
Default: 60
13) legacy_va_layout
This file indicates whether to use the latest 32-bit shared memory mmap () system call. The shared memory allocation methods supported by Linux include mmap () and Posix,System VIPC.
0, using the latest 32-bit mmap () system call.
1. Use the system calls provided by the 2.4 kernel.
Default setting: 0
14) nr_hugepages
This file represents the number of hugetlb pages reserved by the system.
15) hugetlb_shm_group
This file represents the system group ID that allows the creation of System VIPC shared memory segments using hugetlb pages.
16) to be continued.
IV. / proc/sys/fs/ optimization
1) / proc/sys/fs/file-max
This file specifies the maximum number of file handles that can be allocated. If the user gets an error message declaring that due to the open
The maximum number of files has been reached, so they cannot open more files, so they may need to increase this value.
Default: 4096
Recommended setting: 65536
2) / proc/sys/fs/file-nr
This file is related to file-max and has three values:
Number of allocated file handles
Number of file handles used
Maximum number of file handles
The file is read-only and is used to display information only.
3) to be continued.
5. / proc/sys/net/core/ optimization
The configuration files in this directory are mainly used to control the interaction between the kernel and the network layer.
1) / proc/sys/net/core/message_burst
The time it takes to write a new warning message (in 1x10 seconds); other warning messages received by the system during this time are discarded. This is used to prevent denial of service (Denial of Service) attacks used by some people who attempt to "flood" the system with messages.
Default: 50 (5 seconds)
2) / proc/sys/net/core/message_cost
This file represents the cost value associated with writing each warning message. The higher the value, the more likely it is to ignore warning messages.
Default setting: 5
3) / proc/sys/net/core/netdev_max_backlog
This file represents the maximum number of packets allowed to be sent to the queue when each network interface receives packets faster than the kernel processes them.
Default: 300
4) / proc/sys/net/core/optmem_max
This file represents the maximum buffer size allowed for each socket.
Default: 10240
5) / proc/sys/net/core/rmem_default
This file specifies the default value (in bytes) for the size of the receive socket buffer.
Default: 110592
6) / proc/sys/net/core/rmem_max
This file specifies the maximum size of the receive socket buffer in bytes.
Default: 131071
7) / proc/sys/net/core/wmem_default
This file specifies the default (in bytes) of the send socket buffer size.
Default: 110592
8) / proc/sys/net/core/wmem_max
This file specifies the maximum size of the send socket buffer in bytes.
Default: 131071
9) to be continued.
VI. / proc/sys/net/ipv4/ optimization
1) / proc/sys/net/ipv4/ip_forward
This file indicates whether IP forwarding is turned on.
0, forbidden
1, forward
Default setting: 0
2) / proc/sys/net/ipv4/ip_default_ttl
This file represents the life cycle (Time To Live) of a Datagram, that is, the maximum number of routers it passes.
Default: 64
Increasing this value degrades system performance.
3) / proc/sys/net/ipv4/ip_no_pmtu_disc
This file indicates that path MTU detection is turned off globally.
Default setting: 0
4) / proc/sys/net/ipv4/route/min_pmtu
This file represents the size of the minimum path MTU.
Default: 552
5) / proc/sys/net/ipv4/route/mtu_expires
This file represents how long PMTU information is cached (in seconds).
Default setting: 600 (seconds)
6) / proc/sys/net/ipv4/route/min_adv_mss
This file represents the smallest MSS (Maximum Segment Size) size, depending on the router MTU of the first hop.
Default: 256 (bytes)
6.1 IP Fragmentation
1) / proc/sys/net/ipv4/ipfrag_low_thresh/proc/sys/net/ipv4/ipfrag_low_thresh
The two files represent the lowest and highest memory allocation values for reorganizing IP segments, respectively. Once the maximum memory allocation value is reached, the other segments will be discarded until the minimum memory allocation value is reached.
Default: 196608 (ipfrag_low_thresh)
262144 (ipfrag_high_thresh)
2) / proc/sys/net/ipv4/ipfrag_time
This file represents how many seconds an IP segment remains in memory.
Default: 30 (seconds)
6.2 INET Peer Storage
1) / proc/sys/net/ipv4/inet_peer_threshold
INET peer memory has an appropriate value, and when the threshold is exceeded, the entry will be discarded. The threshold also determines survival.
The time and the interval between the passage of waste collection. The more entries, the lower the lifetime and the shorter the GC interval.
Default: 65664
2) / proc/sys/net/ipv4/inet_peer_minttl
The minimum survival time of the entry. There must be sufficient fragment lifetime on the recombination side. This is the lowest.
The survival period must ensure that the buffer pool volume is less than inet_peer_threshold. The value is in jiffies
Unit measurement.
Default: 120
3) / proc/sys/net/ipv4/inet_peer_maxttl
The maximum lifetime of the entry. After this period, if the buffer pool does not run out of pressure (for example, slow
The number of entries in the punch pool is very small), and unused entries will time out. This value is measured in jiffies.
Default setting: 600
4) / proc/sys/net/ipv4/inet_peer_gc_mintime
The shortest interval for the passage of waste collection (GC). This interval affects the high pressure of memory in the buffer pool. This value
Measured in jiffies.
Default: 10
2006-10-31 16:33 floating duckweed
5) / proc/sys/net/ipv4/inet_peer_gc_maxtime
The maximum interval through which waste collection (GC) passes, which affects the low pressure of memory in the buffer pool. This value
Measured in jiffies.
Default: 120
6.3 TCP Variables
1) / proc/sys/net/ipv4/tcp_syn_retries
This file indicates that the number of timeout retransmissions of TCP SYN connections initiated by the machine should not be higher than 255; this value is only for outgoing connections and is controlled by tcp_retries1 for incoming connections.
Default setting: 5
2) / proc/sys/net/ipv4/tcp_keepalive_probes
This file represents the maximum number of TCP keepalive detections before dropping the TCP connection. Stay connected only when
The SO_KEEPALIVE socket option is not sent until it is turned on.
Default setting: 9 (times)
3) / proc/sys/net/ipv4/tcp_keepalive_time
This file represents the number of seconds between never transmitting data again and sending a keep-alive signal to the connection.
Default: 7200 (2 hours)
4) / proc/sys/net/ipv4/tcp_keepalive_intvl
This file represents the frequency at which TCP probes are sent, multiplied by tcp_keepalive_probes to indicate when there is no corresponding TCP connection disconnected.
Default: 75 (seconds)
5) / proc/sys/net/ipv4/tcp_retries1
This file indicates the number of retransmissions before abandoning the response to an TCP connection request.
Default setting: 3
6) / proc/sys/net/ipv4/tcp_retries2
This file represents the number of times a TCP packet has been retransmitted before it was abandoned in the established communication state.
Default: 15
7) / proc/sys/net/ipv4/tcp_orphan_retries
How many retries must be made before the near-end discards the TCP connection. The default value is 7, which is equivalent to 50 seconds-
16 minutes, depending on RTO. If your system is a heavily loaded web server, you may need to
To lower this value, such sockets can consume a lot of resources. Additional reference
Tcp_max_orphans .
8) / proc/sys/net/ipv4/tcp_fin_timeout
For locally disconnected socket connections, the amount of time that the TCP remains in the FIN-WAIT-2 state. The other party may
The connection will be disconnected or the connection will not end or the unexpected process will die. The default value is 60 seconds. In the past
Version 2.2 of the kernel is 180 seconds. You can set this value, but be aware that if your machine is negative
With a heavily loaded web server, you may run the risk of memory being filled with a large number of invalid datagrams
FIN-WAIT-2 sockets is less dangerous than FIN-WAIT-1 because they only eat 1.5K at most.
, but they last longer. Also refer to tcp_max_orphans.
Default: 60 (seconds)
9) / proc/sys/net/ipv4/tcp_max_tw_buckets
The maximum number of timewait sockets processed by the system at the same time. If it exceeds this number,
The time-wait socket is immediately cut and a warning message is displayed. The reason for setting this limit is pure
In order to defend against those simple DoS attacks, do not artificially lower this limit, but if
If the network condition needs to be more than the default, you can improve it (and perhaps more memory).
Default: 180000
10) / proc/sys/net/ipv4/tcp_tw_recyle
Turn on Fast TIME-WAIT sockets Recycling. Please do not follow unless advised or requested by a technical expert
Meaning to modify this value.
Default setting: 0
11) / proc/sys/net/ipv4/tcp_tw_reuse
This file indicates whether to allow socket in the TIME-WAIT state to be reapplied for new TCP connections.
Default setting: 0
12) / proc/sys/net/ipv4/tcp_max_orphans
The maximum number of TCP sockets that the system can handle that does not belong to any process. If it exceeds this amount, then
Connections that do not belong to any process are immediately reset with a warning message. The reason for setting this
Just to resist those simple DoS attacks, don't rely on this or artificial health.
Lower this limit.
Default: 8192
13) / proc/sys/net/ipv4/tcp_abort_on_overflow
When the daemon is too busy to accept a new connection, it sends a reset message to the other party. The default value is false.
This means that when the cause of the overflow is due to an accidental burst, then the connection will resume its state. Only if you do.
This option is turned on only when the letter daemon is really unable to complete the connection request, which affects the use of the customer.
Default setting: 0
14) / proc/sys/net/ipv4/tcp_syncookies
This file indicates whether to open the TCP synchronization tab (syncookie), and the kernel must have the CONFIG_SYN_COOKIES entry open for compilation. Synchronization tags (syncookie) prevent a socket from overloading when there are too many attempts to connect to it.
Default setting: 0
15) / proc/sys/net/ipv4/tcp_stdurg
Use the host request interpretation function in the TCP urg pointer field. Most mainframes use old ones.
BSD explains that if you open it in Linux, you may not be able to communicate with them correctly.
Default setting: 0
16) / proc/sys/net/ipv4/tcp_max_syn_backlog
For those connection requests that have not yet been confirmed by the client, you need to save the maximum number in the queue. For
The default value is 1024 for systems that exceed 128Mb memory and 128for systems that are lower than 128Mb. If
The server is often overloaded, so you can try to increase this number. Warning! If you set this value to greater than
1024, it is best to modify the TCP_SYNQ_HSIZE in include/net/tcp.h to keep
TCP_SYNQ_HSIZE*16 0) or bytes-bytes/ 2 ^ (- tcp_adv_win_scale) (such as
If tcp_adv_win_scale 128Mb 32768-610000), the system will ignore all messages sent to itself.
ICMP ECHO requests or those requests for broadcast addresses
Default: 1024
17) / proc/sys/net/ipv4/tcp_window_scaling
This file indicates whether the sliding window size of the set tcp/ip session is variable. The parameter value is a Boolean value, a value of 1 means variable, and a value of 0 means immutable. The window commonly used by tcp/ip can be up to 65535 bytes, which may be too small for high-speed networks. If this feature is enabled, the sliding window size of tcp/ip can be increased by several orders of magnitude, thus improving the ability of data transmission.
Default setting: 1
18) / proc/sys/net/ipv4/tcp_sack
This file indicates whether selective reply (Selective Acknowledgment) is enabled, which improves performance by selectively responding to messages received out of order (which allows the sender to send only missing segments); this option should be enabled (for WAN communications), but it will increase the footprint of CPU.
Default setting: 1
19) / proc/sys/net/ipv4/tcp_timestamps
This file indicates whether to enable the calculation of RTT in a more precise way than timeout resend (see RFC 1323); this option should be enabled for better performance.
Default setting: 1
20) / proc/sys/net/ipv4/tcp_fack
This file indicates whether to turn on FACK congestion avoidance and fast retransmission.
Default setting: 1
21) / proc/sys/net/ipv4/tcp_dsack
This file indicates whether to allow TCP to send "two identical" SACK.
Default setting: 1
22) / proc/sys/net/ipv4/tcp_ecn
This file indicates whether to turn on the direct congestion notification function of TCP.
Default setting: 0
23) / proc/sys/net/ipv4/tcp_reordering
This file represents the maximum number of datagrams reordered in the TCP stream.
Default setting: 3
24) / proc/sys/net/ipv4/tcp_retrans_collapse
This file indicates whether compatibility for some printers with bug is provided for their bug.
Default setting: 1
25) / proc/sys/net/ipv4/tcp_wmem
The file contains three integer values, namely: min,default,max
Min: the minimum memory value reserved for send buffering for TCP socket. It can be used by every TCP socket.
Default: the amount of memory reserved for sending buffers for TCP socket. By default, this value affects the value of default in net.core.wmem used by other protocols, which is generally lower than the value of default in net.core.wmem.
Max: set aside the maximum memory for send buffering for TCP socket. This value does not affect net.core.wmem_max, and today's selection of the parameter SO_SNDBUF is not affected by this value. The default value is 128K.
Default: 4096 16384 131072
26) / proc/sys/net/ipv4/tcp_rmem
The file contains three integer values, namely: min,default,max
Min: set aside the amount of memory for receive buffering for TCP socket, and TCP socket will have at least this amount of memory for receive buffering even if memory is tight.
Default: the amount of memory reserved for receiving buffers for TCP socket, which by default affects the value of default in net.core.wmem used by other protocols. This value determines that the TCP window size is 65535 at the default values of tcp_adv_win_scale, tcp_app_win, and tcp_app_win.
Max: set aside the maximum memory for receiving buffers for TCP socket. This value does not affect the value of max in net.core.wmem, and today's selection of the parameter SO_SNDBUF is not affected by this value.
Default: 4096 87380 174760
27) / proc/sys/net/ipv4/tcp_mem
The file contains three integer values, namely: low,pressure,high
Low: when TCP uses less than this value of memory pages, TCP does not consider freeing memory.
Pressure: when TCP uses more than this value of memory pages, TCP tries to stabilize its memory usage, enters pressure mode, and exits the pressure state when memory consumption is lower than the low value.
High: allows all tcp sockets to queue up the number of pages used to buffer datagrams.
In general, these values are calculated according to the amount of system memory when the system is started.
Default: 24576 32768 49152
28) / proc/sys/net/ipv4/tcp_app_win
This file represents the number of windows reserved for max (window/ 2 ^ TCP _ app_win, mss) due to the application of buffering. A value of 0 means no buffering is required.
Default: 31
29) / proc/sys/net/ipv4/tcp_adv_win_scale
This file represents the calculation buffer cost bytes/ 2 ^ TCP _ adv_win_scale (if tcp_adv_win_scale >; 0) or bytes-bytes/ 2 ^ (- tcp_adv_win_scale) (if tcp_adv_win_scale)
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: 204
*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.