If you’ve used transactional replication you’re probably familiar with the
step in the wizard where you have to pick either continuous or scheduled for the
distribution agent. I would guess that most subscriptions are set up to
replicate continuously – mainly because it is the default option. Changing to
use scheduled can reduce the overhead on your server, but with a corresponding
trade off in latency.
Interestingly, regardless of which you pick the log reader runs in continuous
mode. This is the command line from a job for a scheduled subscription:
|-Publisher [ANDY] -PublisherDB [DEADLOCK]
-Distributor [ANDY] -DistributorSecurityMode 1 -Continuous
Note the ‘-Continuous’ parameter. This means that even though you have
scheduled the subscription to distribute transactions to the subscriber, the log
reader is always monitoring the log and writing transactions to the Distribution
database. Each log reader agent (logread.exe, one per publication) consumes about 1700k of
memory. It’s not a huge savings, but shutting these down will free up some
memory and further reduce the load on the server.
But if you turn off the log reader won’t you lose transactions? No, even if
you have the log set to truncate on checkpoint the transactions remain in the
log until the log reader has had a chance to process them.
If you can afford the latency, just edit each log reader job and remove the
‘-continous’ from the end of step #2. Then take a look at all of your log reader
and distribution agent jobs that will be running non-continuously. Ideally you
want to adjust the schedule so that the log reader runs, then the distribution
agent, then the next log reader, etc. By doing so you keep the lowest possible
load on your server while still keeping your subscribers updated fairly often,
just not instantly. If you have a large number of subscriptions scheduling can
get pretty complicated, a subject I’ll address in a future article.