[Israel.pm] performance problems - Win32::Process which runs perl

Sagiv Barhoom sagivba at 012.net.il
Fri Sep 15 08:01:59 PDT 2006


On Friday 15/9/2006 00:26, guy keren wrote:
> On Thu, 2006-09-14 at 00:08 +0300, Sagiv Barhoom wrote:
> did you actually measure this (not on _your_ program. on a minimal
> 'hello world' perl program), or just guessed?
No, but AFAIK Linux Process menagment is much better.
but you gave me aa idea, tou remind me that when I had such a problem on Linux 
machine I added a sleep(1) at the child process and that lowered the CPU by 
more then 30% .
for heuman user adding 1 sec at the begininig of the runtime is OK in that 
case - so I think this will solve the problem.
use SOMe::PM ();
helped to get it to 95%-98% CPU usage.
 I will try that next week.
 

> changing your design. don't generate a script per record in the database
> table. since i don't know what your code does, how can i suggest
> alternative designs?
>
Yet I will be happy to read alternatives.
the progrem  work like this:
Start:
	Get records for DB
	foreach $rec (@records){
		create from the record  a script;
		wait until less then $MAX_NUMBER_AT_SAME_TIME chidren scripts are running
			(at the same time)
		run that script you have just created;
	} 
End;

> if you are trying to execute 1000 programs you can:
>
> 1. execute them 1 by 1.
> 2. execute them all at once.
> 3. anything in between.

as you can see I am doing No. 3

> in general, when running CPU-bound programs on a machine with N CPUs,
> executing more then N programs at once is stupid.

yes - but since I got IO here - I belive Parallelizm is te smart choise in 
that case.

> further, if you have a given amount of RAM X, executing processes in a
> number that'll require more then X at once, is stupid too.
RAM is not the problem here since I use only 40%-60% of the RAM

> (when i say stupid, i didn't say you are stupid. i say this action is
> stupid. stupid things might be done by smart people).
:-)

 Regards Sagiv



More information about the Perl mailing list