Examples for Monitoring


CPUs

View CPU type

lscpu

cat /proc/cpu


Processes

List number of processes (including threads) for all users:

ps h -Led -o user | sort | uniq -c | sort -n


List the number of running processes for one user

ps h -Lu oracle | wc -l


I/O Scheduler


IO Schedulers

The IO scheduler determines when and for how long IO operations run on a storage device. This is also known as the IO elevator. There are three schedulers for RHEL 7, and there is a large performance difference between the three schedulers, so picking the correct one is very important for performance.

deadline -- In RHEL7, this is the default scheduler for all block devices other than SATA. This scheduler attempts to keep latency as low as possible, and is the best choice for most use cases. Queued IO operations are put into two categories, read and write. Read IO queues are scheduled more often than write IO since read IO typically causes applications to block while the read is happening.

cfq -- Completely Fair Queueing is the default scheduler for SATA devices. CFQ divides processes into three classes: real time, best effort and idle. Real Time processes are always performed before processes in the Best Effort class, which are performed before processes in the Idle class.

Because of the way that CFQ uses historical data to determine scheduling, there is often a lot of idling going on. CFQ is not efficient at handling SSDs, or large raid arrays. This scheduler should really not be used any more, deadline is almost always the best bet.

noop -- This scheduler uses a simple FIFO (first in, first out) algorithm. This can be the best scheduler for CPU bound systems that use very fast storage.

To find the scheduler of a device.

 [email protected] [~]# cat /sys/block/vda/queue/scheduler 
 noop anticipatory deadline [cfq] 


Setting the default IO scheduler -- This is the scheduler that is used by default if no scheduler is specified in a device's mount options. To change this on boot, edit /etc/grub2.conf and append this to the kernel command line:

elevator=scheduler_name

Configure IO scheduler on per device basis -- If you wish to use different schedulers for different devices, you can modify the following file to change this on the fly.

echo deadline > /sys/block/$hda/queue/scheduler

$hda should be replaced with the actual device.


Links

https://wiki.mikejung.biz/Performance_Analysis       



Memory

View memory overview

free
cat /proc/meminfo

list memory used by a process

pmap <pid>

View infos about huge pages

cat /proc/sys/vm/nr_hugepages

cat /proc/meminfo | grep Huge

To set the number of huge pages:

echo $amount_of_huge_pages > /proc/sys/vm/nr_hugepages

Alternatively, to make the setting persistent, modify the vm.nr_hugepages value in /etc/sysctl.conf. Make sure you run sysctl -p after you make the changes.

By allowing all free memory to be used as cache, performance is increased. Transparent Hugepages are used by default if /sys/kernel/mm/redhat_transparent_hugepage/enabled is set to always.