Archive for the tag 'CPU'

SBDavid

Setting CPU affinity with taskset

Setting CPU affinity with taskset

taskset retrieves and sets the CPU affinity of a running process (by process ID). It can also be used to launch a process with a given CPU affinity, which binds the specified process to a specified CPU or set of CPUs. However, taskset will not guarantee local memory allocation.

CPU affinity is represented as a bitmask. The lowest-order bit corresponds to the first logical CPU, and the highest-order bit corresponds to the last logical CPU. These masks are typically given in hexadecimal, so that 0×00000001 represents processor 0, and 0×00000003 represents processors 0 and 1.

To set the CPU affinity of a running process, execute the following command, replacing mask with the mask of the processor or processors you want the process bound to, and pid with the process ID of the process whose affinity you wish to change.

# taskset -p mask pid

To launch a process with a given affinity, run the following command, replacing mask with the mask of the processor or processors you want the process bound to, and program with the program, options, and arguments of the program you want to run.

# taskset mask — program

Instead of specifying the processors as a bitmask, you can also use the -c option to provide a comma-delimited list of separate processors, or a range of processors, like so:

# taskset -c 0,5,7-9 — myprogram

Further information about taskset is available from the man page: man taskset and http://redhat.com/

Yesterday, we have found an insane cpu overload generated from nowhere on several machines we manage, this was related to The leap second that was inserted on Saturday night, this can cause permanent high CPU loads on Linux computers (Debian and CentOS/RHEL mainly). Among other examples, the behaviour is documented in the blog of the Mozilla Foundation, where strange peak loads on one Mozilla server were observed from the time the leap second was added.

A quick fix to solve this is by performig a quick reboot of the server (Notice that rebooting server services such as httpd, mysqld, even tomcat will not work). If you found a reboot it is impossible because of downtime issues, you can solve the issue by stopping the NTP daemon and executing a Perl script that reset the leap second bit in the kernel, the perl script can be found on the following article,

http://my.opera.com/marcomarongiu/blog/2012/06/01/an-humble-attempt-to-work-around-the-leap-second

The root of the behaviour is located in the Linux kernel, where a leap second that is triggered by the NTP subsystem results in a deadlock situation. The problem appears to affect all kernel versions from 2.6.26 up to and including 3.3.

A further topic discussion concerning this behaviour can be followed on the link below,

http://serverfault.com/questions/403732/anyone-else-experiencing-high-rates-of-linux-server-crashes-during-a-leap-second

Should you require further support to patch/upgrade your kernel or solve this issue, please submit a Hour of Support,

http://www.serverbuddies.com/hour-server-support.php

cPanel Daily Process Log (formerly CPU/Memory/MySQL Usage)

(Main –>> Server –>> Daily Process Log)

This feature displays information about your server’s consumption of processing power and memory, averaged over the course of the selected day.

The information is divided into rows and columns. Each row represents a different process running on your server while each column represents the processes’ associated parameters.

The processes running on your server will depend on how you have configured WHM and what other daemons and applications you install on your server.

The column information is divided into 5 categories:

User — Displays the name of the user running the process. For example, if you are logged into your server as “root,” then that username will appear in this field for any processes you initiate.
Domain — Displays the domain name associated with your cPanel user accounts.
%CPU — Displays the average daily percentage of the CPU’s processing power used by the corresponding process.
%MEM — Displays the average daily percentage of RAM used by the corresponding process.
MySQL Processes — Displays the average number of MySQL processes associated with the corresponding process for today.

How to check if CPU supports hardware virtualization (VT technology)

To run KVM, you need a processor that supports virtualization. For Intel processors this extension has name INTEL-VT, for AMD processors it has name AMD-V.

To see if your processor supports one of these technologies, please run the following command under Linux:

# egrep ‘(vmx|svm)’ /proc/cpuinfo

If nothing is printed, it means that your CPU does not support hardware virtualization. Otherwise, it does – but you still need to make sure that virtualization is enabled in the BIOS. If the svm flag is returned then your processor supports AMD-V or if the vmx flag is returned then your processor supports Intel VT.

Find If Processor CPU is 64 bit or 32 bit

Try this to find out if your CPU/Processor is 32 bit or 64 bit

~$ getconf LONG_BIT
32

NAME
getconf - Query system configuration variables

SYNOPSIS
getconf [-v specification] system_var

getconf [-v specification] path_var pathname

DESCRIPTION
-v

Indicate the specification and version for which to obtain
configuration variables.

system_var

A system configuration variable, as defined by sysconf(3) or
confstr(3).

path_var

A system configuration variable as defined by pathconf(3). This
must be used with a pathname.