Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-17-2018, 10:19 AM
ngrison ngrison is offline
Registered User
 
Join Date: Aug 2017
Posts: 21
crt.Session.SetStatusText() Performance

Hi all,

I have a script that imports thousands of sessions to SecureCRT. When running, I update crt.Session.SetStatusText() on each sessions with a % information. However, I have noticed that most of the time when my script runs it slows down.

I have added timers to all parts of my loop and it looks like crt.Session.SetStatusText() takes longer and longer as the script progresses. Has anyone else noticed a performance impact when running lots of SetStatusText updates?

The attached screenshot shows the evolution of the time required for the command to complete as it iterates through the loop. It is lightning fast at the beginning but as the number of iterations increase it can take up to 600 ms for it to complete. It was done by measuring time just before and just after crt.Session.SetStatusText(). If I remove the crt.Session.SetStatusText() command, the script runs fast again so it is clearly it slowing things down.

Running SecureCRT 8.3.3 on High Sierra.

Thanks.
Attached Images
File Type: png Screen Shot 2018-05-17 at 17.15.00.png (39.7 KB, 53 views)
Reply With Quote
  #2  
Old 05-17-2018, 10:44 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 526
Hi ngrison,

I'm sorry you're having trouble. Is this still with SecureCRT 8.3.2 on OS X as indicated in your previous thread?

To get a better idea of what is happening, it would be beneficial if we could review the script you are running. Are you able to provide a copy of the full script? Please redact any sensitive information and either attach the file to a forum post or email it to Support@VanDyke.com for review.
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 05-17-2018, 11:14 AM
ngrison ngrison is offline
Registered User
 
Join Date: Aug 2017
Posts: 21
Hi Eric,

In fact I upgraded to 8.3.3 earlier today before doing the measurements so this post is based on 8.3.3. I will email the script, it's a complicated one. Thank you.
Reply With Quote
  #4  
Old 08-09-2018, 06:15 AM
ogun ogun is offline
Registered User
 
Join Date: Sep 2013
Posts: 10
I also have this exact same problem.

I've got a script that imports sessions from a JSON source. Once I added status bar updates to indicate progress it slows down tremendously.

As far as I can tell, updating the status bar seems to trigger a re-read of all the sessions, causing it to slow down as the count of sessions increases.

Personally I would like an API call to trigger a session database reload manually and maybe even one to turn off automatic re-reads for this type of scripts.
Reply With Quote
  #5  
Old 08-09-2018, 08:16 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,529
Hi ogun,

Are you also, by chance, doing an objConfig.Save() within that same loop where you write to the status bar?

What are your results if Session Manager is closed (not just in auto hide)?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #6  
Old 09-03-2018, 04:04 AM
ogun ogun is offline
Registered User
 
Join Date: Sep 2013
Posts: 10
Hi bgagnon.

I've run some extra tests on this with my setup. You are correct, I'm running session.Save() in a loop, this is an automated session distribution setup that I wrote.

The relevant code is similar to:
Code:
    # Create sessions that need to be creates, clone the default as template
    if to_create:
        default_session = crt.OpenSessionConfiguration('Default')
        for idx, device in enumerate(to_create):
            if idx%10 == 0:
                crt.Session.SetStatusText('SCRT-Infoblox: Creating session {0}/{1}'. format(
                    idx,
                    len(to_create)))
            create_session(devices[device], default_session)
The create_session function will set some parameters and save a new session.

Running this with no status bar updates will give the following:
Code:
2018-09-03 11:39:25,360 DEBUG    ----- Start -----
2018-09-03 11:39:25,375 DEBUG    Sessions to create: 1466
2018-09-03 11:39:39,435 DEBUG    ----- Finish -----
So 1466 sessions created in 14 seconds. Not great but acceptable.

Running with status bar updates enabled:
Code:
2018-09-03 11:41:08,297 DEBUG    ----- Start -----
2018-09-03 11:41:08,311 DEBUG    Sessions to create: 1466
2018-09-03 11:41:50,353 DEBUG    ----- Finish -----
Same amount of sessions created, now takes 42 seconds.

One again with status bar updates and the session manager closed:
Code:
2018-09-03 11:42:50,996 DEBUG    ----- Start -----
2018-09-03 11:42:51,010 DEBUG    Sessions to create: 1466
2018-09-03 11:43:32,700 DEBUG    ----- Finish -----
Takes the same time still. This testing was done on my linux workstation, the same result is also evident on our windows machines where it is made worse by the corporate antivirus adding a lot of extra processing.


Also readily noticable when the status bar updates are enabled is that each block of 10 new sessions makes it slower and slower. This for me would seem to indicate that it re-reads the session database each time even if the session manager is closed.
Reply With Quote
  #7  
Old 09-04-2018, 07:05 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,529
Hi ogun,

Thanks for the verification.

Our developers are investigating this issue. Should progress be made toward a resolution, or further information be requested, I will post in this thread.

If you prefer direct e-mail notification, contact support@vandyke.com and include "Bug Report - Forum Thread #13112" in the subject line.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:22 AM.