sql server 2008 - wait for transactional replication in ADO.NET or TSQL -
my web app uses ado.net against sql server 2008. database writes happen against primary (publisher) database, reads load balanced across primary , secondary (subscriber) database. use sql server's built-in transactional replication keep secondary up-to-date. of time, couple of seconds of latency not problem.
however, have case i'd block until transaction committed @ secondary site. blocking few seconds ok, returning stale page user not. there way in ado.net or tsql specify want wait replication complete? or can i, publisher, check replication status of transaction without manually connecting secondary server.
[edit] 99.9% of time, data in subscriber "fresh enough". there 1 operation invalidates it. can't read publisher every time on off chance it's become invalid. if can't solve problem under transactional replication, can suggest alternate architecture?
there's no such solution sql server, here's how i've worked around in other environments.
use 3 separate connection strings in application, , choose right 1 based on needs of query:
- realtime - points directly @ 1 master server. writes go connection string, , mission-critical reads go here.
- near-realtime - points @ load balanced pool of subscribers. no writes go here, reads. used vast majority of oltp reads.
- delayed reporting - in environment right now, it's going point same load-balanced pool of subscribers, down road can use technology log shipping have pool of servers 8-24 hours behind. these scale out well, data's far behind. it's great reporting, search, long-term history, , other non-realtime needs.
if design app use 3 connection strings start, scaling lot easier, in case you're experiencing.
Comments
Post a Comment