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.
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.
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/
Setting Up Reseller Plans in Plesk Panel 10
To create a reseller plan:
1. Go to Service Plans > Reseller Plans tab.
2. Click Add New Plan.
3. Specify the plan name.
4. To allocate resources, on the Resources tab, specify the following:
Overuse policy. This defines what happens to the reseller subscription if the total disk space and traffic usage by the reseller’s service subscriptions (own reseller’s service subscriptions and those belonging to the reseller’s customers) reaches the limit values defined by the reseller plan.
Reference: http://www.parallels.com/
Setting global environment variables
Global environment variables are visible from any child processes created by the process that sets the global environment variable. The method used to create a global environment variable is to create a local environment variable, then export it to the global environment.
This is done by using the export command:
Example:
export http_proxy=http://192.168.1.1:3128/
You can also remove an existing environment variable. This is done by using the unset command.
Setting local environment variables
You can set your own environment variables directly from the bash shell.
Once you start a bash shell (or spawn a shell script), you’re allowed to create local variables that are visible within your shell process. You can assign either a numeric or a string value to an
environment variable by assigning the variable to a value using the equal sign:
root@dell:~# process=testing
root@dell:~# echo $process
testing
Now any time you need to reference the value of the test environment variable, just reference it by the name $process.
Control the MaxClients setting in Apache
A webserver should never ever have to swap, as swapping increases the latency of each request.
You can, and should, control the MaxClients* setting so that your server does not spawn so many children it starts swapping. This procedure for doing this is simple: determine the size of your average Apache process, by looking at your process list via a tool such as top
, and divide this into your total available memory, leaving some room for other processes.
*MaxClients [Maximum number of connections that will be processed simultaneously]