Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

Monitoring Memory and Processor

Linux Tips by Burleson Consulting

Linux Hardware

At times, the need will arise to determine some information about the hardware components on the Linux system or check some of the parameter settings that configure the operating system. Often, hardware and software configurations need to be investigated as prerequisites to adding a new application or piece of hardware.

This chapter will introduce some of the basic commands used to investigate the configuration of a Linux server.  We will also look into some commands used to evaluate the status of the system.

It may also be necessary to determine the effects of adding new hardware or software to the server. Some examples of questions that might arise are:

* What are the top resource consumers on the system?

* Is the system I/O bound or CPU bound?

* How did adding disk and distributing the data affect I/O throughput?

* Did adding memory to the system improve memory performance?

First let's look at how to view the processor information in a Linux box.

CPU Related Information

Linux keeps information regarding the processor(s) in a server in a file called /proc/cpuinfo. The following are sample contents of the /proc/cpuinfo file from a basic Linux system:

# cat /proc/cpuinfo

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 5
model name      : Pentium II (Deschutes)
stepping        : 1
cpu MHz         : 398.273
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr
bogomips        : 794.62

The important information here is the vendor, model, CPU speed in MHz and cache size of this processor.  These are the factors most likely to affect performance.  Other information, like whether the processor is susceptible to some known CPU-related bugs, and whether it has a floating point unit (fpu) may also be useful, but have less effect on overall performance. The bogomips reference is an ambiguous speed rating calculated during boot-up. If the server contained multiple processors, the information in this listing would be repeated for each processor.

Display the Number of Processors in the Server

If we want to know how many processors a system has we can just look to see how many individual entries there are in the /proc/cpuinfo file.  If we wanted an easier way to check the number of processes we can use grep and wc to check the file for us like this:

# cat /proc/cpuinfo | grep processor | wc ?l
1

Here we have output the /proc/cpuinfo file with the cat command then used grep to eliminate all lines from teh output which do not contain the string 'processor'.  We then use wc ?l to count the number of lines left in the output.  The count is 1 so we know this system only has one processor.

Displaying the Total RAM on the Linux system

Linux stores memory related information in a file called /proc/meminfo. The meminfo file can be listed to see the current state of system memory:

# cat /proc/meminfo

MemTotal:       257124 kB
MemFree:         67388 kB
Buffers:         20516 kB
Cached:         124140 kB
SwapCached:          0 kB
Active:          51736 kB
Inactive:       108328 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       257124 kB
LowFree:         67388 kB
SwapTotal:      524152 kB
SwapFree:       524152 kB
Dirty:               0 kB
Writeback:           0 kB
Mapped:          27752 kB
Slab:            26424 kB
Committed_AS:    64300 kB
PageTables:       1044 kB
VmallocTotal:  3874808 kB
VmallocUsed:      1260 kB
VmallocChunk:  3873360 kB
HugePages_Total:     0
HugePages_Free:      0

Some of the key points to this output are the MemTotal which is the total amount of memory in the system and the MemFree which shows how much unused memory is available.  The SwapTotal and SwapFree lines represent the same information but for swap (disk currently being used as memory.)

The Linux free command extracts and formats pertinent information from the meminfo.  While not as detailed free displays some big-picture information about the system:

# free -k

             total       used       free     shared    buffers     cached
Mem:        257124     189736      67388          0      20572     124140
-/+ buffers/cache:      45024     212100
Swap:       524152          0     524152

Some information in the above display is extracted directly from the meminfo file while other information is calculated. The display shows how much memory is being used in kilobytes, because the -k option has been specified.  If you prefer to see the information in megabytes you can use the ?m option.

Top Memory and CPU Users

Previously, the process status (ps) command was introduced. When the -u option is specified with the ps command, columns representing the percentage of CPU and the percentage of memory that a process is using are displayed as represented below by columns  %cpu and %mem.

# ps u

USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
terry     4968  0.0  0.5  5644 1320 pts/6    S    11:21   0:00 -bash
terry     5120  0.0  0.2  3440  756 pts/6    R    11:42   0:00 ps u

The aux options can be added to the ps command to include all processes, not just the user?s own and build a complex command to display the commands using the most memory or CPU. 

An example of each complex command is included below:

Display Top CPU User:

# ps -aux | sort ?n +2 | tail -1

root      2201  0.2  3.2 36564 8464 ?        S    Oct17   2:18 /usr/X11R6/bin/X :0 -audit 0 -auth /var/gdm/:0.Xauth -nolisten tcp vt7

Display Top Memory User:

# ps -aux | sort -n +3 | tail -1

gdm       3718  0.0  3.5 20744 9012 ?        S    00:09   0:36 /usr/bin/gdmgreeter

In the example above that can be used for displaying the top memory user, all processes are displayed then sorted in ascending sequence using the numeric value found in column 4 (sort defaults to the first column and the +3 tells sort to look three columns to the right of that.)  It then displays the last and highest value in the sorted list.  If you wanted to see the top five memory or CPU users we could just change the tail -1 to tail -5, just remember they will be sorted from least to greatest of the top 5.  We'll talk more about building complex commands like this in the chapter on shell scripting.


This is an excerpt from "Easy Linux Commands" by Linux guru Jon Emmons.  You can purchase it for only $19.95 (30%-off) at this link.


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational