|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Polling a database - Performance questionI created a couple of custom performance monitor counters. Basically I have
a service that runs and updates the counter on an interval as often as once per second. So the question is, for performance on the SQL Server and the app itself, so I establish the connection once and maintain it until the service is stopped, or do I reconnect every time the counters get updated? (It's a small query, just reading blocks and database names from a couple of the master tables.) Thanks. Jerry Personally I would collect the information and cache it in the service and
then write it to the database every 30seconds or so. -- Show quoteBest regards Mark Baldwin "rlrcstr" <rlrc***@discussions.microsoft.com> wrote in message news:1B193E79-1FCD-44DB-B5E3-E63D18F911F9@microsoft.com... >I created a couple of custom performance monitor counters. Basically I >have > a service that runs and updates the counter on an interval as often as > once > per second. > > So the question is, for performance on the SQL Server and the app itself, > so > I establish the connection once and maintain it until the service is > stopped, > or do I reconnect every time the counters get updated? > > (It's a small query, just reading blocks and database names from a couple > of > the master tables.) > > Thanks. > > Jerry I'm not writing anything to the database. I'm reading statistics from the
database and updating performance monitor counters that I created. There's no caching or the stats would be invalid. Show quote "Mark" wrote: > Personally I would collect the information and cache it in the service and > then write it to the database every 30seconds or so. > > -- > Best regards > Mark Baldwin > > "rlrcstr" <rlrc***@discussions.microsoft.com> wrote in message > news:1B193E79-1FCD-44DB-B5E3-E63D18F911F9@microsoft.com... > >I created a couple of custom performance monitor counters. Basically I > >have > > a service that runs and updates the counter on an interval as often as > > once > > per second. > > > > So the question is, for performance on the SQL Server and the app itself, > > so > > I establish the connection once and maintain it until the service is > > stopped, > > or do I reconnect every time the counters get updated? > > > > (It's a small query, just reading blocks and database names from a couple > > of > > the master tables.) > > > > Thanks. > > > > Jerry > > > Connection pooling should take care of this in the background
for you. So, I doubt you'd notice much difference by opening and closing it each time. -- Show quoteRobbe Morris - 2004-2006 Microsoft MVP C# Earn money answering .NET questions http://www.eggheadcafe.com/forums/merit.asp "rlrcstr" <rlrc***@discussions.microsoft.com> wrote in message news:1B193E79-1FCD-44DB-B5E3-E63D18F911F9@microsoft.com... >I created a couple of custom performance monitor counters. Basically I >have > a service that runs and updates the counter on an interval as often as > once > per second. > > So the question is, for performance on the SQL Server and the app itself, > so > I establish the connection once and maintain it until the service is > stopped, > or do I reconnect every time the counters get updated? > > (It's a small query, just reading blocks and database names from a couple > of > the master tables.) > > Thanks. > > Jerry |
|||||||||||||||||||||||