Showing posts with label Troubleshooting. Show all posts
Showing posts with label Troubleshooting. Show all posts

Friday, October 16, 2015

CPU Statistics

                                                           CPU Statistics
There are several different ways to see the various CPU statistics. The most common is probably using the top command.

To start the top command you just type top at the command line:

The output from top is divided into two sections. The first few lines give a summary of the system resources including a breakdown of the number of tasks, the CPU statistics, and the current memory usage. Beneath these stats is a live list of the current running processes. This list can be sorted by 
PID, CPU usage, memory usage, and so on.

The CPU line will look something like this:
%Cpu(s): 30.8 us,  0.5 sy,  0.0 ni, 67.9 id,  0.6 wa,  0.0 hi,  0.2 si,  0.0 st

30.8 us
- (user cpu time (or) % CPU time spent in user space) This tells us that the processor is spending 30.8% of its time running user space processes. A user space program is any process that doesn't belong to the kernel. Shells, compilers, databases, web servers, and the programs associated with the desktop are all user space processes. If the processor isn't idle, it is quite normal that the majority of the CPU time should be spent running user space processes.

67.9 id
- (idle cpu time (or) % CPU time spent idle) Skipping over a few of the other statistics, just for a moment, the id statistic tell us that the processor was idle just over 67% of the time during the last sampling period. The total of the user space percentage - us, the niced percentage - ni, and the idle percentage - id, should be close to 100%. Which it is in this case. If the CPU is spending a more time in the other states then something is probably awry - see the Troubleshooting section below.

0.5 sy
- (system cpu time (or) % CPU time spent in kernel space) This is the amount of time that the CPU spent running the kernel. All the processes and system resources are handled by the Linux kernel. When a user space process needs something from the system, for example when it needs to allocate memory, perform some I/O, or it needs to create a child process, then the kernel is running. In fact the scheduler itself which determines which process runs next is part of the kernel. The amount of time spent in the kernel should be as low as possible. In this case, just 0.5% of the time given to the different processes was spent in the kernel. This number can peak much higher, especially when there is a lot of I/O happening.

0.0 ni
- (user nice cpu time (or) % CPU time spent on low priority processes)As mentioned above, the priority level a user space process can be tweaked by adjusting its niceness. The ni stat shows how much time the CPU spent running user space processes that have been niced. On a system where no processes have been niced then the number will be 0.

0.6 wa
- (io wait cpu time (or) % CPU time spent in wait (on disk))Input and output operations, like reading or writing to a disk, are slow compared to the speed of a CPU. Although this operations happen very fast compared to everyday human activities, they are still slow when compared to the performance of a CPU. There are times when the processor has initiated a read or write operation and then it has to wait for the result, but has nothing else to do. In other words it is idle while waiting for an I/O operation to complete. The time the CPU spends in this state is shown by the wa statistic.

0.0 hi
& 0.2 si - (hardware irq (or) % CPU time spent servicing/handling hardware interrupts) & (software irq (or) % CPU time spent servicing/handling software interrupts)These two statistics show how much time the processor has spent servicing interrupts. hi is for hardware interrupts, and si is for software interrupts. Hardware interrupts are physical interrupts sent to the CPU from various peripherals like disks and network interfaces. Software interrupts come from processes running on the system. A hardware interrupt will actually cause the CPU to stop what it is doing and go handle the interrupt. A software interrupt doesn't occur at the CPU level, but rather at the kernel level.

0.0 st
- (steal time - - % CPU time in involuntary wait by virtual cpu while hypervisor is servicing another processor (or) % CPU time stolen from a virtual machine)This last number only applies to virtual machines. When Linux is running as a virtual machine on a hypervisor, the st (short for stolen) statistic shows how long the virtual CPU has spent waiting for the hypervisor to service another virtual CPU running on a different virtual machine. Since in the real-world these virtual processors are sharing the same physical processor(s) then there will be times when the virtual machine wanted to run but the hypervisor scheduled another virtual machine instead.



Friday, March 21, 2014

Connection lost between oracle server and client.(ORA-03135: connection lost contact,Fatal NI connect error 12170,TNS-12535: TNS:operation timed out,TNS-00505: Operation timed out)

                                 Connection lost between oracle server and client.


#~~#Error :- 
-1-At client side have received error code & message :- ORA-03135: connection lost contact
-2-In alert log file have received below error traces:-
Fatal NI connect error 12170.
  VERSION INFORMATION:
        TNS for Linux: Version 11.2.0.1.0 - Production
        Oracle Bequeath NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
        TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
  Time: DD-MON-YYYY HH:MM:SS
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12535

TNS-12535: TNS:operation timed out
    ns secondary err code: 12560
    nt main err code: 505

TNS-00505: Operation timed out
    nt secondary err code: 110
    nt OS err code: 0
  Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=X.X.X.X)(PORT=XXXX))

Note:- The "nt secondary err code" will be different based on the operating system.
Linux x86 or Linux x86-64: "nt secondary err code: 110"
HP-UX Server: "nt secondary err code: 238"
AIX: "nt secondary err code: 78"
Solaris system: nt secondary err code: 145:

RCA:-These timeouts shown in the alert log above is caused by an unexpected disconnect with the connected client.
There are two cases for this i.e Either the client has terminated the session abnormally or there was a network interruption that terminated the session.
The 110 in the error stack is the Operating System detected error, indicating a problem at the TCP layer.

Solution :-
1_ Check the client seen in the client address to see if the client caused this. If not check the network.
2_ It could be that the client was idle and often there are network devices such as firewalls that terminate idle sessions.
In this case the following can be set in the database sqlnet.ora file in an effort to keep the session alive.
sqlnet.expire_time=1

Ref Next Post :- Resolving Problems with Connection Idle Timeout With Firewall.