Web Connection
Load cursors on startup - or elsewhere?
Gravatar is a globally recognized avatar based on your email address. Load cursors on startup - or elsewhere?
  Michael Hogan (Ideate Hosting)
  All
  Feb 9, 2018 @ 10:38am

I have a webconnect 5.x application that relies on a bunch of cursors which I am creating in MAIN but it's taking a fair amount of time to load all my tables and create the lookup cursors and such.

I think this seems to be causing IIS to think my app is timing out during startup, causing it to launch additional instances. Could that be true?

If so, what I'm considering is to check a flag or do an IF USED() AFTER the instance is loaded - perhaps in OnProcessInit().

Question 1: Is my assumption about startup times correct? Question 2: Is OnProcessInit() the right place to do this?

Gravatar is a globally recognized avatar based on your email address. re: Load cursors on startup - or elsewhere?
  Rick Strahl
  Michael Hogan (Ideate Hosting)
  Feb 9, 2018 @ 02:41pm

Yes that could definitely be true.

Are you on the latest versions? Web Connection 6.17+ adds a new feature that has servers load without firing your Load() code until the first hit comes in. IOW, servers load only firing the OnInit() code and the OnLoad() code is delayed until the first hit comes in. This lets IIS get the objects loaded very quickly and delay any startup delays until the first hit comes in which is considerably more lenient in terms of length for request timeout vs. COM load timeout.

That said - I would not worry about loading up data up front honestly. I don't see the benefit - just load and leave open. I would load it on as needed basis and then leave the ones you want to 'cache' open. There's no real benefit to loading all that stuff up up front. Use functions (or a App.Global object) to have a generic routine to load each thing and call these things as needed to ensure the tables are available (if you're not using queries).

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Load cursors on startup - or elsewhere?
  Michael Hogan (Ideate Hosting)
  Rick Strahl
  Feb 9, 2018 @ 03:03pm

Still using 5.x - I generally code with the use-and-keep-open principle, but in this case we need most of it up front for every hit anyway. We do plan to migrate to 6.x when we have the time (Good to know your Load() tip for when that time comes).

So... in 5.x is OnProcessInit() the best place to do this?

Gravatar is a globally recognized avatar based on your email address. re: Load cursors on startup - or elsewhere?
  Rick Strahl
  Michael Hogan (Ideate Hosting)
  Feb 11, 2018 @ 03:49pm

OnProcessInit() works just make sure to set a flag so that you only do it on the first hit since this method fires on every request. 😃

+++ Rick ---

© 1996-2024