Pages

Showing posts with label OS. Show all posts
Showing posts with label OS. Show all posts

Thursday, May 8, 2014

Top and load average in Linux


It always practice to see top command output in the linux servers to identify the resource utilization.

We try to check load average and assume the performence of the system.

The top output looks like below

load average: 2.39, 1.70, 1.81

The same can be checked from 
$ cat  /proc/loadavg
2.70 2.45 2.13 1/450 6959

What are these 3 number?  how to analyze them ? What should be normal numbers?

The load average is computed based on CPU utilization, and includes the number of processes using or waiting to use the CPU,

The load average can be interpreted on a basic level as being a CPU core at full utilization has a system load average of one.

For a quad-core (4 core) machine, a system load average of 4 would mean that the machine had adequate resources to handle the work it needed to do, 

On the same quad-core system, a load average of 8 would mean that if the server had eight cores instead of four, 

It would have been able to handle the work, but it is now overloaded. 

So when you check load average, You also need to check the no of CPU cores on the server.

Use the below command to check the number of CPU cores on the server.

$ grep 'process' /proc/cpuinfo | wc -l
8

So the thumb rule is always load average should be less than the number of CPU (Cores), For 4 core server, Load average should be less than 4 always.


In case the system is showing high load average, but the CPU system and user utilization is low, it is time to start looking at IO wait.

IO wait shows up in system load on Linux because one or more of the cores is busy waiting on something having to do with either disk, or network input or output to finish before it can continue. 

Will post more on the IO waits and finding the IO issues in the next post.

Sunday, January 5, 2014

Changing absolute path for tar command in Solaris OS

Changing absolute path for tar command in Solaris OS


When we use tar command in Linux, The / is trimmed, So when we restore from tar file , It will extract the files to directory we wish to to extract without overwriting.

In Solaris, tar command contains the absolute path, When we try to restore , It will restore to the absolute path as source.

This is some times very dangarous where it can overrite the source files or when you need to restore it in other locations, You need to have same file system as source.

To avoid this , Use the below.

$ tar tvf backup_apps.tar

-rwxr-xr-x 205/100  34260 Jan 18 11:14 2006 /tstdp1/prg/oracle/R12/apps/tech_st/10.1.3/jdk/demo/plugin/jfc/Notepad/Notepad.jar
-rwxr-xr-x 205/100    339 Jan 18 11:14 2006 /tstdp1/prg/oracle/R12/apps/tech_st/10.1.3/jdk/demo/plugin/jfc/Notepad/README.txt
drwxrwx--- 205/100      0 Jan  2 21:17 2007 /tstdp1/prg/oracle/R12/apps/tech_st/10.1.3/jdk/demo/plugin/jfc/TableExample/
-rwxr-xr-x 205/100  22353 Jan 18 11:14 2006 /tstdp1/prg/oracle/R12/apps/tech_st/10.1.3/jdk/demo/plugin/jfc/TableExample/TableExample.jar
drwxrwx--- 205/100      0 Jan  2 21:17 2007 /tstdp1/prg/oracle/R12/apps/tech_st/10.1.3/jdk/demo/plugin/jfc/TableExample/src/
-rwxr-xr-x 205/100   8613 Jan 18 11:14 2006 /tstdp1/prg/oracle/R12/apps/tech_st/10.1.3/jdk/demo/plugin/jfc/TableExample/src/TableExample.java
-rwxr-xr-x 205/100   8790 Jan 18 11:14 2006 /tstdp1/prg/oracle/R12/apps/tech_st/10.1.3/jdk/demo/plugin/jfc/TableExample/src/JDBCAdapter.java
-rwxr-xr-x 205/100   3293 Jan 18 11:14 2006 /tstdp1/prg/oracle/R12/apps/tech_st/10.1.3/jdk/demo/plugin/jfc/TableExample/src/TableExample2.java
-rwxr-xr-x 205/100   5708 Jan 18 11:14 2006 /tstdp1/prg/oracle/R12/apps/tech_st/10.1.3/jdk/demo/plugin/jfc/TableExample/src/TableExample3.java
-rwxr-xr-x 205/100   9339 Jan 18 11:14 2006 /tstdp1/prg/oracle/R12/apps/tech_st/10.1.3/jdk/demo/plugin/jfc/TableExample/src/OldJTable.java


-- If you extract using tar -xvf backup_apps.tar command, It will restore to original directory structure if available or errors out if not avaibale.


The work around for this problem is , Use command pax to extract the files in solaris instead of tar -xvf command.


pax -r -s '=^/tstdp1/prg/oracle/R12=/usr/R12=' < backup_apps.tar


Now it will extract to  /usr/R12 folder. 

$ cd /usr/R12

$ls -ltr 
drwxr-xr-x   4 oracle   oinstall       4 Jan  5 15:01 apps