Re: Win32::Process - Limiting the number of processes launched from within a script

From: Chris (ceo_at_nospan.on.net)
Date: 01/28/04


Date: Wed, 28 Jan 2004 05:09:26 GMT

Patrick Paquet wrote:
> Hello everyone,
>
> I've been working on a script that fetches information from all
> workstations on our NT domain, the problem I've now run into at this
> point is that it takes a very long time to execute completely. The
> reason for this is probably simply because I'm checking each machine
> in sequence (I check machine A, and only when I'm done do I move on to
> B etc).
>
> I've been looking into running these checks in parallel, via the
> Win32::Process module, but I haven't found a way to control the
> number of simultaneous processes adequately. I can launch a certain
> number of them, but I can't figure out how to check the status of a
> process and to lower a counter when it's done, so that I can launch
> another one to replace it. What I'm looking to do is lauch no more
> then 10 (for example) instances of the script, and to stay as close to
> that without going over as long as there are machines to check.
> Making sense?
>
> [snipage]
> I'm running ActiveState Perl 5.005_02, and cannot upgrade it. Many
> scripts are run centrally and I don't have authority to do the upgrade
> on the script server.
>

Ewww. I tried using Perl 5.005_03 once (from Hip Communications - the
predecessor name to AS) and it was awful. I'd say as someone else said
that your options are limited with this version of Perl - very limited.
  Not even David Roth can help you with that and he's king of Perl Win32...

If it were me, I might try (roughly) writing a listener that I could put
on every end point (node) that listened on say port 9010 (or some other
port). Have a central listener on a central machine on port 9011 (or
some other port) to handle replies to requests sent to the listener port
of the end nodes. Have the central box run a request out to all the (or
a batch of) listeners on port 9010 and wait for the replies to come back
in on port 9011. You can batch your requests based on the capacity of
the central listener (on port 9011) to handle replies. When the central
node receives all the replies (or gives up trying/waiting due to end
node down, etc), then you are done.

The simplest way to write a listener in Perl on Windows (with the
version you have) IMO is to combine your listener code with SRVANY.EXE
(available on Windows RK CD) and create Windows service daemons.

Chris
-----
Chris Olive
chris +at+ technologEase +dot+ com
http://www.technologEase.com
(pronounced "technlogies")



Relevant Pages

  • Firewall Rules Summary
    ... Subject: Firewall Rules Summary ... This script is provided "as is" with no implied warranty. ... this came from various howtos and articles on iptables that existed around ... #specific port denies>1024 tcp ...
    (Focus-Linux)
  • Multiple listeners improve application.
    ... Users observe frequent error of ORA-12535 Operation Timed Out Error. ... The listener was on port 1525. ... CPU, 8 GB RAM ...
    (comp.databases.oracle.server)
  • Re: Veröffentlichung von zwei https Webservern
    ... die Anfrage auf Server 1 oder Server 2 umleiten soll? ... Meiner Meinung nach, kann ich im Listener ... How can I publish multiple SSL sites using the same IP address and port, ... Aber offensichtlich unterstützt das unsere Sonicwall ...
    (microsoft.public.de.german.isaserver)
  • Re: reverse ssh
    ... > logged into either box) can use the tunnel for whatever connects to it. ... > I suggest you connnect back to your home system's 'sshd' port and then you ... > will have to satisfy the home box's login authorization to get access ... > password from your script. ...
    (freebsd-questions)
  • Re: Delays and timeouts when telnetting to random open ports?
    ... I think you need to look at this at a lower level. ... I would check the behaviour is as you expect - run a snoop and check ... truss on the listener - compare good with bad bahaviour. ... You know what happens when you telnet to an open port on a system, ...
    (comp.unix.solaris)