What is the best technique to keep all of the clients of the database server synchronized?

The scenario involves a database server along with a dynamic quantity of clients that connect with it, viewing and modifying the information.

I want real-time synchronization from the data across all of the clients - if information is added, erased, or up-to-date, I would like all of the clients to determine the alterations in tangible-time without putting an excessive amount of stress on the database engine by continuous polling for alterations in tables with a few million rows.

Now i'm utilizing a Firebird database server, but I am prepared to adopt the very best technology to do the job, so I wish to determine if there's any type of already established framework with this type of scenario, what database engine will it use and exactly what does it involve?

Firebird includes a feature known as EVENT that you might have the ability to use to inform clients of changes towards the database. The concept is the fact that when data inside a table is transformed, a trigger posts a celebration. Firebird takes proper care of notifying all clients who've registered a desire for the big event by title. Once informed, each client accounts for refreshing its very own data by querying the database.

The customer can't get info in the event concerning the new or old values. This really is by design, due to there being not a way to solve this with transaction isolation. Nor can the consumer sign up for occasions using wildcards. So you've to create your server-to-client notification pretty broadly, and allow the client update to determine just what transformed.

See http://www.firebirdsql.org/doc/whitepapers/events%5Fpaper.pdf

You do not mention what client platform or language you are using, and so i can't recommend the particular API you would employ. It is best to google for example "firebird event java" or "firebird event php" or similar, in line with the language you are using.

Because you say inside a comment that you are using WPF, here is a connect to a code sample of some .Internet application code signing up for notification of the event:


Re your comment: Yes, the Firebird event mechanism is restricted in being able to carry information. This really is necessary because any information it could carry might be canceled or folded back. For example if your trigger posts a celebration however the operation that created the trigger violates a constraint, eliminating the operation although not the big event. So occasions are only able to be considered a type of "hint" that something of great interest might have happened. Another clients have to refresh their data in those days, however they aren't told things to search for. This really is a minimum of much better than polling.

So you are essentially explaining a publish/subscribe mechanism -- a message queue. I am unsure I'd make use of an RDBMS to implement a note queue. It is possible, but you are essentially reinventing the wheel.

Listed here are a couple of message queue items which are well-regarded as:

Which means that when one client modifies data in ways that others might need to learn about, that client also needs to publish a note towards the message queue. When consumer clients begin to see the message they are thinking about, they are fully aware to refresh their copy of some data.

SQL Server 2005 and greater support notification based databases caching expiry.