Checking my database updates every second

iknowyou

Active member
Joined
Jun 14, 2011
Messages
37
Programming Experience
1-3
How can I check my updates on database every second and display the updates without harassing my applications memory consumption?

I want to know this because I want to develop a computer monitoring system. Atleast I have 50 client computers to monitor their time consumption.

When timer ticks and check every second to the database. Is that suitable for this kind of application. Thanks.
 
Last edited:
You have to consider how long it's going to take to actually query the database and return the results. If that's going to take longer than a second then it's absolutely not realistic to initiate such an operation every second. We'd have to know more about the database structure and exactly what data you're retrieving.

Also, you'd want to ensure that you weren't retrieving the same data over and over. To that end, you'd probably want all your records to have a timestamp, so that you could retrieve only those records that have been added or altered since the last query.
 
My server needs to retrieve the total time usage of my application on the clients computer. And when client exits on the application the server needs the update that the application exited.

Many thank jmcilhinney..
 
In that case you only need two values: the start time and the end time. Each time you check, you record the current time and look for records where the start time is greater than the last check time or the end time is not null and the end time is greater than the last check time. That way, you'll only be retrieving data for sessions that have either started or ended since the last time you checked, which will usually be none at all. You can then calculate the total time for each session locally, i.e. the end time minus the start time for those sessions that have ended and the current time minus the start time for those that are still running.
 
Back
Top