Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Matti, you're asking multiple questions that point to the best structure for your application. I would summarize your questions as:</p> <ul> <li>How do I pre-load data needed by my service prior to handling any legitimate requests?</li> <li>How do I ensure the pre-loaded data is loaded "once"?</li> <li>How do I refresh the pre-loaded data on a schedule, i.e. every 24 hours?</li> </ul> <p>Understanding the Asp.Net pipeline and event structure will help you understand the answers to these questions.</p> <p>First, the Asp.Net pipeline provides a one-time execution region in Application_Start. This is fired once per application cycle. This would also fire in 'iisreset', which cycles every application for a given server. However, application cycles themselves will recycle on their own, based on their configuration. All of which are controlled through IIS settings.</p> <p>Second, Asp.Net is a request system; it won't fire refresh events for you, nor can you use it by itself as a scheduler. You need an outside agent to act on that for you.</p> <p>Here's what you <strong><em>could</em></strong> do:</p> <ol> <li>Add your pre-loaded data routine to Application_Start.</li> <li>Configure your web site's Application cycle settings for every 24 hours.</li> </ol> <p>This would ensure your data is loaded once, via Application_Start. It would ensure your data is loaded prior to your site serving any requests. Last, it would ensure your data is refreshed every 24 hours.</p> <p>Here's what I <strong><em>would</em></strong> do:</p> <ol> <li>Add pre-loaded data routine to Application_Start.</li> <li>Modify pre-loaded data routine to use Asp.Net Cache, instead of static usage.</li> <li>Modify lookup data to retrieve data from cache, and re-load if data is not found.</li> <li>Provide capability for diagnostic/monitoring system, i.e. nagios, to refresh data asynchronously via web method call, i.e. "preload_refresh()".</li> </ol> <p>This would provide essentially the same forward effect as the above solution, but with better reliability for your service.</p> <p>As always, your mileage may vary. Hope this helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload