0

I'm currently working on windows service code, I'm facing the delay in reading the next request data from SQL server database, If I didn't make request for few hours, So I'm force to insert some data and deleting it from DB. How can I avoid this?

  • Are you saying that you getting a delay reading from SQL if a few hours has elapsed since the last DB operation? if so, just maintain a true and small pool of connections that you can keep alive with non data altering commands –  Jan 06 '17 at 12:42
  • If you are getting a delay, then it is probably a credential check which is done against a password server. How much of a delay are you getting and is it critical. Keeping the connection open like Micky suggested is one solution. – jdweng Jan 06 '17 at 12:50
  • Are you using entity framework? If so, maybe this: http://stackoverflow.com/questions/13250679/how-to-warm-up-entity-framework-when-does-it-get-cold – Crowcoder Jan 06 '17 at 13:18
  • Thanks. like @MickyD said, I'm already maintaining small pool of connections to keep alive, Why its happening and what can I do to avoid this. – Priya Kumar Jan 07 '17 at 12:01
  • It's an expense that happens when your app first starts or when you haven't used the resource in a while. The OS ultimately releases the resource which is expensive to re-create later. You can observe this phenomena whether it is a database connection (we had this back in the 90s for ODBC); network connections such as WCF. It most likely falls under the category of _deferred initialisation_ –  Jan 07 '17 at 12:40

0 Answers0