- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- perl script taking too much cpu time
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 04:48 PM
02-01-2006 04:48 PM
what could be the reason ? how to fix it ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 04:51 PM
02-01-2006 04:51 PM
Re: perl script taking too much cpu time
Post the script if you wish.
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 04:51 PM
02-01-2006 04:51 PM
Re: perl script taking too much cpu time
Which version of Perl you are using ? Try with
# swlist |grep -i perl.
Also, are you looping infinitely inside the Perl script ?
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 04:56 PM
02-01-2006 04:56 PM
Re: perl script taking too much cpu time
This could be helpful,
http://www.ccl4.org/~nick/P/Fast_Enough/
When perl is not quite fast enough
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 05:12 PM
02-01-2006 05:12 PM
Re: perl script taking too much cpu time
Try to use the latest Perl version around for HP-UX,
http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=PERL
For PA & IPF : 5.8.3 and 5.8.7 are available.
Also, you can download Procura's perl depots,
http://mirrors.develooper.com/hpux/downloads.html
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 05:12 PM
02-01-2006 05:12 PM
Re: perl script taking too much cpu time
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 05:40 PM
02-01-2006 05:40 PM
Re: perl script taking too much cpu time
It is advised to use shell script or java, if u feel Perl is using lot of memory.
Also, post your code, can we can try to fix if any memory leak issues are there.
HTH,
Prabu.S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 06:10 PM
02-01-2006 06:10 PM
SolutionPerl will take memory. As much as it needs or as much as it can get, at least for the operations you tell it to do. Memory is also much faster than process switches, something that will be done extremely often when using shell scripting.
Unless you can use unix utilities that do exactly what you need (cut, join, sort, comm, ...) perl is almost always faster and easier in use than a shell script, and in 99.99% of the cases (much) faster than java.
Unless you cannot do without, I'd advice to never use java.
When parsing a large log, compare these two:
while (
...
}
and
for (
...
}
different? no? yes? I'll tell you, you'll notice.
The first reads the log line by line. The second reads the complete log at once, and thus taking extremly more memory, which it will not free till after the loop.
But you said you were using a lot of CPU, which can easily be caused by a less than optimally written regex in which backtracking occurs. So if CPU is the bottleneck, try find some complicated regular expressions in your code and post them here.
Enjoy, Have FUN! H.Merijn [ who writes perl instead of shell for everything that would take more than 5 lines ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 07:04 PM
02-01-2006 07:04 PM
Re: perl script taking too much cpu time
I hope Perl will generally use more cpu than other utilities for code execution. But it is more faster.... than other.
But will the code change in perl will reduce in cpu usage.. May be regular expression is using memory for () operation right.
I feel for cpu usage, we have to move to base level utilities in shell itself.
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 07:09 PM
02-01-2006 07:09 PM
Re: perl script taking too much cpu time
As far as perl concerned, it is quite faster than other core utils when parsing log files. This is proven and many organizations are moving to perl now a days due to gain performance.
But, when you do a small (basic) operations, shell (unix core utils) are faster.
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2006 07:34 PM
02-01-2006 07:34 PM
Re: perl script taking too much cpu time
I don't think going to a different version of perl is going to have a significant impact on resource use.
If there is a specific bug causing this issue, going to a current version of perl will help.
The real issue is the code, which should be reviewed. The way you are doing this may be improved. There are good language forums here and I've had perl code review several times with excellent results.
As far as 94% cpu use.
This may not be a problem at all. If a system is idle and you run a script, there is absolutely nothing wrong with that script using 100% of CPU. After all the system isn't doing anything else important anyway.
We have several unix/linux servers here which run at 100% all day and all night. There is nothing wrong with that.
Bill Hassell has recommended looking at other parameters to determine whether or not we have a problem. I agree:
1) Are the users having a response problem?
2) Is the system slow in doing normal administration tasks?
Examples. If the system is running correctly and user response is acceptable, the entire premise of this question may not be valid. If the system is fine, its not broke, so don't try and fix it.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com