in reply to Re^3: A question of fork efficiency
in thread A question of fork efficiency

This version is slightly faster and much better on CPU time. My version wrecks the CPU. The only thing I need to do here is tweak this version to run with the same output as mine. I'll post the portion that actually runs the commands soon. I think something like this may make this tool run much better. Here is your code running with 1000 as max on the 7k+ servers:

real 0m56.481s user 0m2.515s sys 0m2.165s

Using my default fork value as max of 100:

real 1m26.502s user 0m2.537s sys 0m2.270s

Replies are listed 'Best First'.
Re^5: A question of fork efficiency
by tybalt89 (Monsignor) on Aug 07, 2019 at 15:40 UTC

    It's not much faster on wall clock time because the problem itself is dominated by timeouts.

    I'd be curious to see the wall clock times when run on only 'alive' servers.

      Ask and you shall receive.

      Output for your non blocking version:

      Good count is 3037 Bad count is 0 Total count is 3037 real 0m24.790s user 0m1.093s sys 0m1.046s

      Forking version

      Good count is 3037 Bad count is 0 Total count is 3037 real 0m15.358s user 0m10.870s sys 0m19.205s

      The forking version is faster up to a point but really puts the CPU through the ringer compared to what you came up with. Once you start hitting around 5k servers or so is when your version starts to shine.