12 Replies Latest reply on Dec 16, 2011 6:31 AM by Bill Robinson

    NSH console and JLI scripts


      We are having performance & memory problems with our development.

      We use JLI scripts in order to execute jobs and do some other queries against Bladelogic, in order to automatize software provisioning.

      This is how we execute the JLI scripts:

      nsh -c "bljython script.py user password authProfile arguments";

      So, every time we need to execute a JLI script, we open a NSH console and we connect to Bladelogic using this code (jython):

      jli = blcli.CLI()





      When we execute more than 5 scripts at once, the server runs out of memory (error: cannot allocate memory).

      Is there any way to connect just once and then re-use this connection with the following scripts? is it possible to execute scripts by openning just 1 nsh console (i.e. using the one already open)? Any suggestions? Any improvements?


      By the way, we are executing those scripts through command line adapter in a BMC Atrium Orchestrator workflow --> we are not using Bladelogic's adapter because we cannot perform some actions by BLCLI and we need to use JLI scripts.



      • Bladelogic v8.0 SP 11


      Thanks in advance.


        • 1. NSH console and JLI scripts

          Everytime you invoke  bljyhton, it launches a new JVM for itself to execute your jython code.

          What is the JVM memory configuration for bljython ? What kind of scripts are these ?

          What is the underlying total memory available on the server ?


          If you write a wrapper NSH script job to execute your scripts, and create a NSH job in BladeLogic for that, then use the Blade adapter to run that job with parameters passed as name of the script you need to execute, you will not have to authenticate everytime, the credentials should be taken from the appserver environment, the user and role that runs this job.

          But this will not effectively solve  your problem of memory .

          • 2. Re: NSH console and JLI scripts
            Bill Robinson

            How much physical memory in your system?


            This is running from your workstation or the appserver?


            If the appserver, how many appserver instances and what is the maxheap setting per instance?


            In the bljython file what do you have for the Xmx setting ?

            • 3. Re: NSH console and JLI scripts

              Hello everyone, thanks for answering.


              I answer some of your questions:


              • Server's Total Memory: 16GB

              • The process is running from the BMC Atrium Ochestrator server (BAO & Bladelogic are in different servers)

              • File bljython.cfg has this configuration (only Xmx, not Xms):


              • Kind of JLI scripts: for example, we retrieve the list of jobs from a particular group --> we couldn't find the way to do this using plain blcli commands.


              We have terrible perfomance issues (not only memory issues), I am sure it is because of Bladelogic configuration at BAO's server:

              If I execute the same exact command in a shell script using blcli commands and in a jli script, the execution time differs in 4 minutes.


              For example:


              1. get_classes.sh --> it takes 10secs aprox

              blcred cred -acquire -profile $PROFILE_NAME -username $USER -password $PWD

              blcli_setoption serviceProfileName $PROFILE_NAME

              blcli_setoption roleName $ROLE_NAME


              blcli_execute PropertyClass listAllSubclassNames "Class://SystemObject/"



              2. get_classes.py --> it takes 4min aprox

              os.system('blcred cred -acquire -profile "'+vProfileName+'" -username "'+vUser+'" -password "'+vPwd+'"')

              jli = blcli.CLI()




              cmd = ['PropertyClass','listAllSubclassNames']




              The connection time is too high in JLI scripts, why could it be?

              Any thoughts?

              Is there any way to set JVM options inside jython script?

              Thanks in advance.


              • 4. Re: NSH console and JLI scripts
                Bill Robinson

                Is this a linux system?  what version of bbsa?

                • 5. Re: NSH console and JLI scripts

                  Linux Redhat 2.6.18-128.el5 and Bladelogic v8.0 SP 11

                  • 6. NSH console and JLI scripts

                    What version of Jython is this ?

                    when you use bljython, the JVM sizes are taken from bljython.cfg, thats how you specify what to use for all your JLI scripts.


                    How much time does your Bljython takes up to start ? Try starting bljython on command line.

                    Again to confirm you are not using BladeLogic Adapter ? Are you ?

                    • 7. Re: NSH console and JLI scripts

                      I am not using BLadelogic Adapter for executing JLI scripts, i am using a command line adapter in BAO.

                      The script does not take much to start, the connection does.

                      • bljython.cfg has this configuration:




                      • 8. Re: NSH console and JLI scripts
                        Bill Robinson

                        if the system running jython is linux - look at the NSH/br/java/lib/security/java.security file.  is the securerandom /dev/urandom ?  if so, change it to /dev/./urandom


                        what else is running on this box?  also - it's the 'client' box that is running the scripts that is running out of memory right ?

                        • 9. Re: NSH console and JLI scripts

                          Thanks Bill! the JLI script execution time decreased from 4min to 10secs, just by changing that option from java security file.

                          I will run some other tests and I will let you know.

                          Thanks again!


                          • 10. NSH console and JLI scripts

                            Hi Bill,


                            Is it a bug with Java ??





                            • 11. Re: NSH console and JLI scripts

                              I've read It is a Java bug under Linux OS (it is suppossed to work ok in Windows OS), but we have this property setted to "/dev/urandom" in another Linux with Bladelogic and it works ok.

                              The only difference between both Linux servers is the NSH version:


                              • Server Linux #1 (works with "/dev/urandom") :


                              BladeLogic RSCD Agent (Release) [Jul 30 2010 20:10:44]

                              Copyright (C) 1996-2009 BladeLogic Inc.

                              BladeLogic Network Shell (Release) [Jul 30 2010 20:10:44]

                              Copyright (C) 1996-2009 BladeLogic Inc.


                              • Server Linux #2 (works with "/dev/../urandom")  --> this was the problematic one


                              BladeLogic Network Shell (Release) [Sep  6 2011 15:32:51]

                              Copyright (C) 1996-2011 BladeLogic Inc.


                              Both servers :

                              • Linux 2.6.18-128.el5
                              • Java version "1.6.0_21"
                              • 12. Re: NSH console and JLI scripts
                                Bill Robinson

                                It’s a problem w/ linux and java.  The rscd agent doesn’t use java so this problem doesn’t affect targets, just systems running the blcli.