Hello Monks, I need your expert suggestions. Let me explain what I am doing and then will present my questions:

I am working on a Perl project where my Perl script will monitor any new server being plugged into the datacenter. The moment it detects a new server in the datacenter, it will run a bunch of other security hardening Perl scripts in a particular sequence on those server to bring ‘em to our security standards.

The script which is doing this job is called Orchestrator.

Now, the whole flow is working fine however I am not able to process multiple servers at the same time.

e.g. If the 5 new servers are plugged in the datacenter, the script will pick one of them, run the flow and then pick the second one and run the flow…then pick third one and run the flow ….so on and so forth.

This is time consuming as each server customizations will take about 2 hrs to complete. So 5 servers will take 10 hrs and I don’t want this.

Question: How to make my orchestrator script to process multiple servers simultaneously?

I am a Linux sys admin who knows good amount of Perl and my knowledge of programming/development is extremely limited. I have googled about this and came with below 3 options:

Use threading in perl << I don’t know anything about threading and stu +ff. Use fork in perl script and fork a new instance of the same script whi +ch will work independently on each individual server. Run multiple instances of the script so that each will process a new s +erver simultaneously and independantly.

And I am absolutely not sure which one the best fit for my use case or is there anything else obvious which I missed out. Also have no idea how to practically incorporate any of above three options in my script.

Could you provide your suggestions on how to make my orchestrator work on multiple servers simultaneously.

Thanks.


In reply to How to make perl script work simltaneously on multiple objects by slayedbylucifer

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



  • 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:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.