Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.


In reply to Re^6: Program Design Around Threads by aeaton1843
in thread Program Design Around Threads by aeaton1843

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-24 00:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found