Modifying Linux Kernel Parameters

本文介绍如何在Red Hat和SUSE Linux系统中调整内核参数,包括共享内存限制、信号量限制及消息限制等,以满足数据库应用的需求。

本文转载自:http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.uprun.doc/doc/t0008238.htm

 

另外,http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.qb.server.doc/doc/t0008238.html 也解释了如何修改kernel的参数。

 

 

To update kernel parameters:

Red Hat and SUSE Linux
The following information can be used to determine if there are any necessary changes required for your system.

The following is the output from the ipcs -l command. Comments have been added following the // to show what the parameter names are.

   

Beginning with the first section on Shared Memory Limits, SHMMAX and SHMALL are the parameters that need to be looked at. SHMMAX is the maximum size of a shared memory segment on a Linux system whereas SHMALL is the maximum allocation of shared memory pages on a system.

For SHMMAX, the minimum required on x86 systems would be 268435456 (256 MB) and for 64-bit systems, it would be 1073741824 (1 GB).

SHMALL is set to 8 GB by default (8388608 KB = 8 GB). If you have more physical memory than this, and it is to be used for DB2, then this parameter should be increased to approximately 90% of the physical memory as specified for your computer. For instance, if you have a computer system with 16 GB of memory to be used primarily for DB2, then 90% of 16 GB is 14.4 GB divided by 4 KB (the base page size) is 3774873. The ipcs output has converted SHMALL into kilobytes. The kernel requires this value as a number of pages.

The next section covers the amount of semaphores available to the operating system. The kernel parameter sem consists of 4 tokens, SEMMSL, SEMMNS, SEMOPM and SEMMNI. SEMMNS is the result of SEMMSL multiplied by SEMMNI. The database manager requires that the number of arrays (SEMMNI) be increased as necessary. Typically, SEMMNI should be twice the maximum number of connections allowed (MAXAGENTS) multiplied by the number of logical partitions on the database server computer plus the number of local application connections on the database server computer.

The third section covers messages on the system.

MSGMNI affects the number of agents that can be started, MSGMAX affects the size of the message that can be sent in a queue, and MSGMNB affects the size of the queue.

MSGMAX should be change to 64 KB (that is, 65535 bytes), and MSGMNB should be increased to 65535 on Server systems.

To modify these kernel parameters, we need to edit the /etc/sysctl.conf file. If this file does not exist, it should be created. The following lines are examples of what should be placed into the file:

 

Run sysctl with -p parameter to load in sysctl settings from the default file /etc/sysctl.conf.

   sysctl -p

To make the changes effective after every reboot, boot.sysctl needs to be active on SUSE Linux. On Red Hat, the rc.sysinitinitialization script will read the /etc/sysctl.conf file automatically.

 

### Linux Kernel Reserved Memory Configuration and Purpose Reserved memory in the Linux kernel serves specific purposes that are critical for system stability and performance. This type of memory is set aside during boot time or through configuration parameters to ensure certain functionalities have dedicated resources. The primary role of reserved memory includes: - **System Stability**: Ensuring essential parts of the operating system always have access to necessary resources. - **Hardware Communication**: Facilitating communication with hardware components by reserving areas where direct interaction can occur without interference from other processes. - **Emergency Use Cases**: Providing a buffer against out-of-memory conditions which could otherwise lead to unpredictable behavior or crashes. Configuration options related to reserved memory often appear as command-line arguments passed at boot via GRUB settings or within `/etc/default/grub` file on many distributions. For example, one might encounter configurations like `memmap=exactmap` followed by mappings specifying exact regions to reserve[^1]. Additionally, when dealing with systems under heavy load or limited resource environments, adjustments may be made using parameters such as `vm.min_free_kbytes`. Setting this value appropriately ensures there's enough freeable RAM available even under pressure scenarios; values around 65536 KB (or higher depending on workload) are common recommendations but lower figures like 128 KB might apply specifically for very constrained setups. For managing permissions associated with accessing these special memory zones securely while still allowing privileged operations, capabilities provided by Linux play an important part after applying mechanisms similar to those demonstrated with setting SUID bits on executables[^2]. However, directly manipulating reserved memory typically requires elevated privileges beyond what standard user-space applications possess unless explicitly permitted through capability assignments. ```bash # Example of modifying vm.min_free_kbytes parameter temporarily echo 65536 > /proc/sys/vm/min_free_kbytes ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值