Solaris 10’s Resource Management and Shell Limit(ulimit)
Solaris 10’s Resource Management
One of the best known features in Solaris is Resource management. This mechanism allows controlling resource for each and every process which is big advantage in system administration.System precious resources like CPU & memory also can be controlled by using projects and newtask feature.
Resource Management:
basic:
Can be modified by owner of calling process.
Experiment:
A resource controls are identified by following prefix
1.
zone (Ex:zone.cpu-shares)
2.
project (Ex:project.max-shm-memory)
3.
task (Ex:task.max-lwps)
4.
process (Ex:process.max-stack-size)
Resource controls can be observed on a system-wide basis and possible to update resource control values on a running system. In older system we need to deal with ulimit command and most of the time we use to set in /etc/profile file to take effect for all users. But in Solaris 10, we can easily manage shell limits using simple prctl command.
(In older term, we call it as Soft limit.These settings can be viewed using ulimit -Sa )
privileged:
Only modifiable by superuser
(In older term, we call it as Hard limit.These settings can be viewed using ulimit -Ha )
system:
Fixed for the duration of the operating system instance
(System’s maximum value.You can’t set the privileged more than system value)
Actions:
It is possible to use rctladm to specify one of the following actions on a process that violates the control:
·
none:
No action taken. (Useful for monitoring.)
·
deny:
Denies a request.
·
signal:
Enable a signal.(i.e
SIGTERM
,
SIGKILL
)
To check current soft shell limits, enter the following command:
$ ulimit -Sa
Ex:To find the Maximum open files soft limit
bash-3.00# ulimit -Sn
8192
To check maximum hard limits, enter the following command:
$ ulimit -Ha
Ex:To find the Maximum open files hard limit.
bash-3.00# ulimit -Hn
61921
We can find the same using prctl
,
bash-3.00# prctl -n process.max-file-descriptor $$
process: 6414: bash
NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
process.max-file-descriptor
basic 8.19K – deny 6414—–>8.19K is soft limit(Basic).It can be increased by user.
privileged 61.9K – deny – —–>61.9k is hard limit(
privileged
). Only Root
modify this.
system 2.15G max deny – ——>2.15G is system maximum limit. Otherwords privileged max value.
To Display default resource control value:
bash-3.2# prctl -n process.max-file-descriptor $$
process: 12372: bash
NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
process.max-file-descriptor
basic 256 - deny 12372
privileged 65.5K - deny -
system 2.15G max deny -
bash-3.2# prctl -n process.max-stack-size $$
process: 12372: bash
NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT
process.max-stack-size
basic 8.00MB - deny 12372
privileged 8.00EB - deny -
system 8.00EB max deny -
bash-3.00# useradd -m -d /export/home/linges -s /bin/bash linges 64 blocks bash-3.00# cat /etc/project system:0:::: user.root:1:::: noproject:2:::: default:3:::: group.staff:10::::
Creating the new project called “limitedusers”
bash-3.00# projadd limitedusers bash-3.00# cat /etc/project system:0:::: user.root:1:::: noproject:2:::: default:3:::: group.staff:10:::: limitedusers:100::::
Adding the newly created user to in to “limitedusers” project.
bash-3.00# projmod -U linges limitedusers bash-3.00# cat /etc/project system:0:::: user.root:1:::: noproject:2:::: default:3:::: group.staff:10:::: limitedusers:100::linges::
Here i am setting maximum openfile’s softlimit to 8192 and maximum hard limit to 61921 using below command.
bash-3.00# projmod -s -K 'process.max-file-descriptor=(basic,8192,deny),(privileged,61921,deny)' limitedusers
Method :1 to verify the new values To check the current project.
bash-3.00# id -p uid=0(root) gid=0(root) projid=1(user.root)
We can gain new project using below command.
bash-3.00# newtask -p limitedusers bash bash-3.00# id -p uid=0(root) gid=0(root) projid=100(limitedusers)
Now we can check new values using prctl command.
bash-3.00# prctl -n process.max-file-descriptor $$ process: 6414: bash NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT process.max-file-descriptor basic 8.19K - deny 6414 privileged 61.9K - deny - system 2.15G max deny -
you can verify Using ulimit ,
bash-3.00# ulimit -Ha core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited open files (-n) 61921 pipe size (512 bytes, -p) 10 stack size (kbytes, -s) unlimited cpu time (seconds, -t) unlimited max user processes (-u) 16245 virtual memory (kbytes, -v) unlimited bash-3.00# ulimit -Sa core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited open files (-n) 8192 pipe size (512 bytes, -p) 10 stack size (kbytes, -s) 1347 cpu time (seconds, -t) unlimited max user processes (-u) 16245 virtual memory (kbytes, -v) unlimited bash-3.00# ulimit -Sn 8192 bash-3.00# ulimit -Hn 61921
Method :2 to verify the new values
Otherwise, we can login to user which is part of project “limitedusers” to verify the settings.
bash-3.00# su - linges Oracle Corporation SunOS 5.10 Generic Patch January 2005 -bash-3.00$ prctl -n process.max-file-descriptor $$ process: 7369: -bash NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT process.max-file-descriptor basic 8.19K - deny 7369 privileged 61.9K - deny - system 2.15G max deny - -bash-3.00$ ulimit -Sn 8192 -bash-3.00$ ulimit -Hn 61921
Setting Unlimited:
In older days we use to set value “unlimited” for shell limits. But in Resource Management you can’t use the word “unlimited” as the resource controls have no concept of “unlimited”. Instead, you just need to set the value to the maximum allowed system value. For example, to see the maximum stack size, use:
bash-3.00# prctl -P -t system -n process.max-stack-size $$ process: 29525: bash process.max-stack-size system 137988707188736 max deny -
Here i am setting stack size hardlimit as system’s stack size.(Which is equal to unlimited value)
bash-3.00# projmod -s -K "process.max-stack-size=(basic,10MB,deny),(privileged,137988707188736,deny)" limitedusers -bash-3.00$ prctl -n process.max-stack-size $$ process: 7605: -bash NAME PRIVILEGE VALUE FLAG ACTION RECIPIENT process.max-stack-size basic 10.0MB - deny 7605--------------->Soft Limit privileged 125TB - deny - -------------->Hard Limit system 125TB max deny - -------------->Maximum System Limit -bash-3.00$ ulimit -Ha core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited open files (-n) 61921 pipe size (512 bytes, -p) 10 stack size (kbytes, -s) unlimited cpu time (seconds, -t) unlimited max user processes (-u) 16245 virtual memory (kbytes, -v) unlimited -bash-3.00$ ulimit -Sa core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited open files (-n) 8192 pipe size (512 bytes, -p) 10 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 16245 virtual memory (kbytes, -v) unlimited -bash-3.00$ ulimit -Ss 10240 -bash-3.00$ ulimit -Hs unlimited -
Here I tried to set value which is higher that than the system value and its end up with error “exceeds system limit”.Which means you can’t set value higher than the system value.
bash-3.00# projmod -s -K "process.max-stack-size=(privileged,9223372036854775807,deny)" limitedusers projmod: rctl "process.max-stack-size" value "9223372036854775807" exceeds system limit
We can verify using root account also by gaining access via newtask
bash-3.00# newtask -p limitedusers bash bash-3.00# id -p uid=0(root) gid=0(root) projid=100(limitedusers) -bash-3.00# ulimit -Ss 10240 -bash-3.00# ulimit -Hs unlimited
Important parameters in IPC in solaris
-
project.max-shm-ids
: Maximum shared memory IDs for a project.
-
project.max-sem-ids
: Maximum semaphore IDs for a project.
-
project.max-msg-ids
: Maximum message queue IDs for a project.
-
project.max-shm-memory
: Total amount of shared memory allowed for a project.
-
process.max-sem-nsems
: Maximum number of semaphores allowed per semaphore set.
-
process.max-sem-ops
: Maximum number of semaphore operations allowed per semop.
-
process.max-msg-messages
: Maximum number of messages on a message queue.
-
process.max-msg-qbytes
: Maximum number of bytes of messages on a message queue.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31397003/viewspace-2220047/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ulimit: core file size: cannot modify limit: Operation not permittedMIT
- profile的resource limits和資源計劃resource_manager_plan的limitMIT
- k8s resource的管理K8S
- 《Effective C++》第三版-3. 資源管理(Resource Management)C++
- ocp 19c考題,科目082考試題(31) - resource_limitMIT
- ulimit詳解MIT
- Linux ulimit使用LinuxMIT
- Solaris 10下遷移10G RAC (六)
- Solaris 10下遷移10G RAC (八)
- Solaris 10下遷移10G RAC (四)
- Solaris 10下遷移10G RAC (二)
- Solaris 10下遷移10G RAC (七)
- Solaris 10下遷移10G RAC (三)
- Solaris 10下遷移10G RAC (一)
- Solaris 10下遷移10G RAC (五)
- Solaris10怎麼更改子網掩碼?Solaris10更改子網掩碼的方法
- Ubuntu 永久修改 ulimit -nUbuntuMIT
- 【CentOS7】ulimit 使用CentOSMIT
- win10系統computer management怎麼開啟_win10系統computer management如何開啟Win10
- Mrs. Beeton's Book of Household Management The 1861 Classic with Advice on Cooking, Cleaning, Chi...
- S/4HANA for Customer Management裡的搜尋分頁處理
- Customer Management
- SAP S/4HANA Customer Management(CRM)模組的Partner模型設計模型
- SharePlex 基於Solaris 10 Linux自動巡檢指令碼Linux指令碼
- solaris10中安裝oracle核心引數的調整Oracle
- 關於 ulimit 的兩個天坑MIT
- Memory Management in RustRust
- linux limit限制LinuxMIT
- 極限limitMIT
- Laravel Resource Routes和API Resource Routes講解LaravelAPI
- Solaris常用命令
- 系統管理指南:Oracle Solaris Containers-資源管理和 Oracle Solaris ZonesOracleAI
- solaris10使用projadd進行資源限制的新增(seminfo_*)
- Oracle Cluster Time ManagementOracle
- ASM(Automatic Storage Management)ASM
- 【譯】Resource Hints
- 10種反彈shell方式
- vue 基礎入門筆記 10:vue-resource、axiosVue筆記iOS