Skip to main content
Ian McGowan
Participating Frequently
Aug 1, 2024 1:22 AM UTC
Question

PORT.STATUS performance impacts

For a conversion project at a customer with 4000 custom programs written over 30 years we're trying to get a handle on which programs are actively used.  One idea that's been floated is running a monitoring program as root from the demo account that does the pseudo code below.

By definition we'll be running this in production for a month or three, and there's some justified nervousness about any potential performance impacts.  I don't think the monitoring program will be a performance hog itself, but not sure if doing PORT.STATUS on the probed program has any effect - does it "pause" the probed program so the stack collected is consistent for example?  We're not expecting to get 100% coverage from this, but even 80% would be a huge help.

Anyone ever done something like this for real?  Any war stories or hard-won words of wisdom to share?  Thanks for reading!

LOOP
  EXECUTE 'LISTUSER'
  LOOP FOR EACH ROW IN LISTUSER
    RUN "PORT.STATUS PID <ROW.PID> CALL.STACK
    PARSE THE CALL STACK, EXTRACT PROGRAM NAMES
    WRITE NEW PROGRAM NAMES TO A LOG FILE
  REPEAT
REPEAT

    15 replies

    Aug 9, 2024 4:52 PM UTC

    For a conversion project at a customer with 4000 custom programs written over 30 years we're trying to get a handle on which programs are actively used.  One idea that's been floated is running a monitoring program as root from the demo account that does the pseudo code below.

    By definition we'll be running this in production for a month or three, and there's some justified nervousness about any potential performance impacts.  I don't think the monitoring program will be a performance hog itself, but not sure if doing PORT.STATUS on the probed program has any effect - does it "pause" the probed program so the stack collected is consistent for example?  We're not expecting to get 100% coverage from this, but even 80% would be a huge help.

    Anyone ever done something like this for real?  Any war stories or hard-won words of wisdom to share?  Thanks for reading!

    LOOP
      EXECUTE 'LISTUSER'
      LOOP FOR EACH ROW IN LISTUSER
        RUN "PORT.STATUS PID <ROW.PID> CALL.STACK
        PARSE THE CALL STACK, EXTRACT PROGRAM NAMES
        WRITE NEW PROGRAM NAMES TO A LOG FILE
      REPEAT
    REPEAT

    we have noticed several undocumented features with PORT.STATUS that you need to be aware of especially when running PORT.STATUS repeatedly.  If you are doing running PORT.STAUS and it encounters a "stuck" process it can cause the process to move by pushing the process past the internal lock that is set basically skipping past the set internal lock.  The conditions that allow this to happen are very rare, the lock isn't a normal uniVerse lock that you will be setting, it has something to with unix code pending waiting on a condition.

    Be aware that if you are running PORT.STATUS and a second copy of the code starts it's possibly going to run into the 1st PORT.STATUS.  uniVerse doesn't allow 2 to run at the same time.  i would run a single PORT.STATUS and save the output to a file, then parse the file.  Not sure how to do that with using the "CALL.STACK"  option (LAYER.STACK) , but what you are trying to do is avoid the reputative PORT.STATUS executions.  interesting problem.  we only have 1200 programs in production.  we do have a logging process we run, but's not for every program  (Subroutines are excluded).

    Ian McGowan
    Participating Frequently
    Aug 9, 2024 5:58 PM UTC

    For a conversion project at a customer with 4000 custom programs written over 30 years we're trying to get a handle on which programs are actively used.  One idea that's been floated is running a monitoring program as root from the demo account that does the pseudo code below.

    By definition we'll be running this in production for a month or three, and there's some justified nervousness about any potential performance impacts.  I don't think the monitoring program will be a performance hog itself, but not sure if doing PORT.STATUS on the probed program has any effect - does it "pause" the probed program so the stack collected is consistent for example?  We're not expecting to get 100% coverage from this, but even 80% would be a huge help.

    Anyone ever done something like this for real?  Any war stories or hard-won words of wisdom to share?  Thanks for reading!

    LOOP
      EXECUTE 'LISTUSER'
      LOOP FOR EACH ROW IN LISTUSER
        RUN "PORT.STATUS PID <ROW.PID> CALL.STACK
        PARSE THE CALL STACK, EXTRACT PROGRAM NAMES
        WRITE NEW PROGRAM NAMES TO A LOG FILE
      REPEAT
    REPEAT

    Felix, thanks for the further confirmation about PORT.STATUS.   It seems like a generally bad idea to be mis-using it to aggressively poll running programs.  I'm still trying to get the Unix team to enable AIX file logging on files that match _* per Joe's excellent suggestion.  It seems like the perfect solution to the problem - use the OS auditing tools that are built to do this kind of thing.

    John Jenkins
    Participating Frequently
    Aug 10, 2024 9:37 AM UTC

    For a conversion project at a customer with 4000 custom programs written over 30 years we're trying to get a handle on which programs are actively used.  One idea that's been floated is running a monitoring program as root from the demo account that does the pseudo code below.

    By definition we'll be running this in production for a month or three, and there's some justified nervousness about any potential performance impacts.  I don't think the monitoring program will be a performance hog itself, but not sure if doing PORT.STATUS on the probed program has any effect - does it "pause" the probed program so the stack collected is consistent for example?  We're not expecting to get 100% coverage from this, but even 80% would be a huge help.

    Anyone ever done something like this for real?  Any war stories or hard-won words of wisdom to share?  Thanks for reading!

    LOOP
      EXECUTE 'LISTUSER'
      LOOP FOR EACH ROW IN LISTUSER
        RUN "PORT.STATUS PID <ROW.PID> CALL.STACK
        PARSE THE CALL STACK, EXTRACT PROGRAM NAMES
        WRITE NEW PROGRAM NAMES TO A LOG FILE
      REPEAT
    REPEAT

    All,

    If you need to aggressively block concurrent use of PORT.STATUS, consider making it a remote verb with a 'security subroutine' that uses a 'soft lock' on a control file based on User Number or PID. The soft lock can be manually cleared by deleting or editing editing the lock record(s)  in the file if needed and it allows a controlled 'gateway' with optional timeouts to the command.

    Regards

    JJ

    JJ
    Chuck Stevenson
    Participating Frequently
    Aug 12, 2024 9:27 AM UTC

    For a conversion project at a customer with 4000 custom programs written over 30 years we're trying to get a handle on which programs are actively used.  One idea that's been floated is running a monitoring program as root from the demo account that does the pseudo code below.

    By definition we'll be running this in production for a month or three, and there's some justified nervousness about any potential performance impacts.  I don't think the monitoring program will be a performance hog itself, but not sure if doing PORT.STATUS on the probed program has any effect - does it "pause" the probed program so the stack collected is consistent for example?  We're not expecting to get 100% coverage from this, but even 80% would be a huge help.

    Anyone ever done something like this for real?  Any war stories or hard-won words of wisdom to share?  Thanks for reading!

    LOOP
      EXECUTE 'LISTUSER'
      LOOP FOR EACH ROW IN LISTUSER
        RUN "PORT.STATUS PID <ROW.PID> CALL.STACK
        PARSE THE CALL STACK, EXTRACT PROGRAM NAMES
        WRITE NEW PROGRAM NAMES TO A LOG FILE
      REPEAT
    REPEAT

    Basic Profiling was introduced at UV11.4 & UV12.2.

    IIRC UD and PIOpen had/have something similar.  I think it can tell you which lines of code are being executed & how often.   The UV one claims to have "minimal performance impact."   I find that hard to swallow,  but with today's hardware & being able to bump performance on virtual machines, it might not be dangerous.

    Here's the quick blurb from the Release Notes:

    "BASIC Profiling
    With applications that have millions of lines of BASIC code, it is challenging to add features while
    maintaining performance. UV BASIC Profiling provides application performance analysis and insight to
    help you quickly determine bottlenecks and performance improvement areas."

    Described in Basic User Guide, Chapter 7 pg 75-87.

    We recently went to UV11.4 and I haven't had a chance/necessity to try it yet.

    Chuck Stevenson
    Participating Frequently
    Aug 12, 2024 9:50 AM UTC

    For a conversion project at a customer with 4000 custom programs written over 30 years we're trying to get a handle on which programs are actively used.  One idea that's been floated is running a monitoring program as root from the demo account that does the pseudo code below.

    By definition we'll be running this in production for a month or three, and there's some justified nervousness about any potential performance impacts.  I don't think the monitoring program will be a performance hog itself, but not sure if doing PORT.STATUS on the probed program has any effect - does it "pause" the probed program so the stack collected is consistent for example?  We're not expecting to get 100% coverage from this, but even 80% would be a huge help.

    Anyone ever done something like this for real?  Any war stories or hard-won words of wisdom to share?  Thanks for reading!

    LOOP
      EXECUTE 'LISTUSER'
      LOOP FOR EACH ROW IN LISTUSER
        RUN "PORT.STATUS PID <ROW.PID> CALL.STACK
        PARSE THE CALL STACK, EXTRACT PROGRAM NAMES
        WRITE NEW PROGRAM NAMES TO A LOG FILE
      REPEAT
    REPEAT

    Tangential:

    I turned on performance monitor (a uvconfig param, xAdmin Performance Monitor,  & *RECORDPERFMONDATA) & run it in the background, saving 15 minute snapshots.

    Then I can get a baseline of what's normal & watch for abnormalties.

    That's not program-specific.  Looks system-wide for  writes/sec, locks/sec,  that sort of thing.