Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Multithreaded Script CPU Usage

by renodino (Curate)
on Aug 25, 2008 at 17:21 UTC ( #706725=note: print w/replies, xml ) Need Help??


in reply to Re^2: Multithreaded Script CPU Usage
in thread Multithreaded Script CPU Usage

Your "use threads" should do the trick, or any of the alternatives described in the "THREAD STACK SIZE" section of the threads POD...just do it as early as possible. I'd suggest that 64 * 4096 is probably a lot more than you need, as Perl has its own notion of a runtime stack, and in reality doesn't use that much process/thread stack (unless you're using very large/complex regexes, and even that issue goes away in 5.10). Note that once stack size is set, its set for all the threads/modules, so you don't need to do anything in Thread::Pool.

Also keep in mind that each thread has its own Perl interpretter, so memory size may be an unavoidable issue, esp if the threads are spawned from another thread that already has a lot of context (due to the interpretter cloning).

Update:
I just realized your issue has 2 parts: memory and CPU; note that my comments thus far have been entirely about the memory issue. However, given the size of the Perl process, might the CPU issue be related to paging/swapping ?


Perl Contrarian & SQL fanboy

Replies are listed 'Best First'.
Re^4: Multithreaded Script CPU Usage
by Zenshai (Sexton) on Aug 25, 2008 at 17:37 UTC
    Re your update:
    Thats interesting, you might be right. This box has 2GB ram, so I didn't think I was in danger of running out... Unless WinServer2k3 decided to page/swap even when there is memory available... How would I check this?

    The reason I think you're right is that my kernel times tend to be rather high when running this script. Here's an example.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://706725]
help
Chatterbox?
[marto]: "Eugenie Scott, executive director of the National Center for Science Education, dubbed this approach the Gish gallop, describing it as "where the creationist is allowed to run on for 45 minutes or an hour, spewing forth torrents of error that the
[marto]: evolutionist hasn't a prayer of refuting in the format of a debate." She also criticized Gish for failing to answer objections raised by his opponents"
[erix]: one would hope evolutionists haven't any prayers anyway
[marto]: obviously someone could be religious, but not creationist
[erix]: "Nothing in Intelligent Design makes sense except in the light of Creationism" <-- I made that one up myself (free after Dobzhansky )
[erix]: yes. Deplorable marto, deplorable.
[marto]: the situation seemed similar to this one, majority of the contributrions are nonsense, doesn't address any questions ...
[marto]: meh, I've been called worse :P

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2017-07-28 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (431 votes). Check out past polls.