Tuesday, October 6, 2015

Solaris 10 - CPU/Memory Allocation

How to add memory on LDOM

1. Login to your LDOM where you will be adding extra ram and find out the control domain.
# virtinfo -a
Control domain: "Name_of_Control_Domain"

2. Find the memory currently assigned to your system.
# prtdiag -v | grep -i mem
Memory size: 1234 Megabytes

3. Now, Login to your control domain and check if you have enough resource available to assign to LDOM

a. Check the memory allocation on all LDOM
# ldm list | awk '{print $1 "\t" $6}'
to see detail allocation
# ldm ls -o memory
# ldm ls -o cpu
# ldm ls -l <MY_LDOM>

b. Check available memory that you can assign to LDOM,
# ldm list-devices memory
0x13c0000000 16G
This output shows there is 16GB available space. If no value returned, that mean you don't have any memory available.

5. Now, assign 16GB of memory to LDOM
# ldm list
a. Set memory to 32GB
# ldm set-memory 32G <MY_LDOM>

b. Add 16 GB of ram
# ldm add-memory 16G <MY_LDOM>

c. Remove 16GB of ram
# ldm remove-memory 16G <MY_LDOM>

6. Now, go back to your LDOM and verify the added memory
# prtconf | grep -i mem


To work on CPU/Processor

1. Login to your LDOM and check the no of cpu assigned to the system.
# psrinfo | wc -l

2. Login to Control Domain and check the available CPU
a. Check available cpu,
# ldm list-devices cpu
# ldm list-devices vcpu | wc -l
You will see number of vcpus assigned.
VCPU - no of cpu display is a thread acts like a vpu
Note: Most systems (t4/5, not all) come with 1 core = 8 thread
Some place, they assign by core and some place its by thread.

b. To set to the specific no. of CPU
# ldm set-vcpu 32 <MY_LDOM>

c. To add 16 CPU
# ldm add-vcpu 16 <MY_LDOM>

d. To remove CPU
# ldm remove-vcpu 16 <MY_PDOM>

Some folks prefer to do this way,
1. Shutdown the LDOM
- Login to control domain, and login to LDOM through console
# ldm list
# telnet 0 5000
# init 0

2. Allocate cpu/mem from Control domain
# ldm set-vcpu 16 <MY-LDOM>
# ldm set-memory 32G <MY-LDOM>

3. Start LDOM and boot the system
# ldm start <MY_LDOM>
# telnet 0 5000
{ok} boot

Note: If you are using cores rather than thread (vcpu) then you can do this way as well.
a. First check the LDOM config
# ldm list-bindings <my_ldom> | more
Look at the value under CONSTRAINT, you will see something like this, cpu=whole core, then you can use core. Most environment 1 core = 8 vcpu.

# ldm remove-core 2 <my_ldom>
# ldm add-core 2 <my_ldom>

Resource capping
When you reduce the memory, I would suggest you to reboot the system if memory utilization is high. Say you have 32 GB of ram and you see 20 GB used and they want you to reduce by 16 than you would probably want to cap the memory. Most application run under specific user, find the user and cap the memory.

Whatever way you want to do, just add entry to /etc/projects. Lets say, you want to cap (10GB) to a user called wauser

10GB = 10x1024x1024x1024 = 10737418240 byte

# vi /etc/project

Set zfs arc size

vi /etc/system

* zfs arc setting 2g max, 64mb min
set zfs:zfs_arc_max=2684354560
set zfs:zfs_arcmin=67108864
* set max file descriptors
set rlim_fd_max=65536

A swap (or paging file) is an extension of RAM, but it is stored on the hard drive. The swap
file is rebuilt each time the system is rebooted

and reboot your system.

No comments:

Post a Comment