Please don't take this the wrong way. You are hitting me with the clue stick and I want to make sure I understand everything here.
As I understand your code, it gives each machine in the machines list a thread and then runs through each of the commands in the commands list sequentially.
What I don't understand is why your statement: "Making multiple connections to each machine from different threads to run single commands is both inefficient and the source of your problems." is true. Except for the last part because we both agree there. When I look at it, let's say I have three commands per device each of which take on average 15 seconds to retrieve. If I create a thread for each command, I wait 15 seconds to finish all three commands for that machine. That is, of course, given a high enough allowed running thread count. If I do it your way I no longer have the synch issues but I am now waiting an extra 30 seconds to finish each machine. Granted you have 10 machines threads running sequentially.
We agree about the source of my problems. I am trying to further wrap my head around why saving a possible 30 seconds per device in this scenario was a less than optimal approach. That is other than the fact that it causes me a lot of synchronization issues. So be it if that is the answer. At least I found out the right way to go about the problem even if it takes a bit longer to get all the output.
I do appreciate the comments.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||