For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > March 2007 > Solaris application take more cpu -- how to control









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Solaris application take more cpu -- how to control
Sheth Raxit

2007-03-13, 8:31 am

regret me if it appears multiple times, but before 4-5 hours i have
posted and still it is not appeared here. !


OS : Sun OS 10, sparc,

Problem :

--My process (network + multithreaded + disk-i/o intensive) becomes
hungry for cpu.
--User level program
--non repeatable.
--program run fines for few (35-40 hr) and then (not always) taking
more cpu (checked with top)
--Program is compiled with 32-bit
--Any Strategy to debug cpu hungry process. My admin kill the process
by signal 9 when it access more than 95%cpu
--gdb helpful here ?
--Is there any option by which instead of killing by -9 i can kill the
process and force it to dump core. ?
--Is there any check-list to avoid excessive cpu usage during
coding. ?
--any other strategy to cop with this ?



--Raxit Sheth

Rainer Temme

2007-03-13, 8:31 am

A truss/strace output of the process (before killing it)
would be helpful.

Rainer
Mark Holland

2007-03-14, 7:12 pm


"Sheth Raxit" <raxitsheth2000@yahoo.co.in> wrote in message
news:1173781637.241340.259020@j27g2000cwj.googlegroups.com...

> --My process (network + multithreaded + disk-i/o intensive) becomes
> hungry for cpu.


<snip>

> --Is there any option by which instead of killing by -9 i can kill the
> process and force it to dump core. ?


Various signals will typically cause a core dump, for instance SEGV or ABRT
signals.
However, there is a utility on some Solaris machines called "gcore", which
will actually get a dump of the process and (I believe) still leave the
program running.

> --any other strategy to cop with this ?


Similarly to gcore, there is another utility called "pstack" which typically
lives in /usr/proc/bin. You can use this program to print a stack dump for
each thread of your program at the moment the utility is called. If you
write a script or something to repeatedly call this several times and dump
the output to a file, you can see which areas your program is spending time
in. Once you know this you will be able to focus your efforts on fixing the
problem.

Mark


Giorgos Keramidas

2007-03-14, 7:12 pm

"Mark Holland" <kenshin_40@htomail.com> writes:
>"Sheth Raxit" <raxitsheth2000@yahoo.co.in> wrote in message
>news:1173781637.241340.259020@j27g2000cwj.googlegroups.com...
>
> <snip>
>
>
> However, there is a utility on some Solaris machines called "gcore", [...]
>
>
> Similarly to gcore, there is another utility called "pstack" [...]


FWIW, on recent Solaris releases, there's also DTrace, which is an
excellent tool for tracking down where time is spent.

If the original poster has access to the source code for the application
too, then compiling with with "profiling" enabled is a good idea too.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com