Platform SDK: Active Directory, ADSI, and Directory Services |
There are several dimensions on which mechanisms for tracking changes can differ:
Processing less timely data may be more efficient, because several changes may be collapsed into one. For instance, if an attribute changes three times within a one hour interval, an application that is satisfied with changes that have accumulated over an hour will see just one attribute change, not three.
When thinking about timeliness it is important to consider the effect of replication latency. An update that originates on one domain controller does not replicate to another domain controller instantly. Requiring change-tracking timeliness much better than the expected replication latency often gives no real benefit to the application.
The overhead of polling is obvious: The application may request change tracking information when nothing of interest has changed. The overhead of notification is more subtle. The server must maintain information about notification requests and must consult this information to decide whether or not to send a notification. This can add overhead to normal update requests. In effect, normal updates pay some of the price of notifications.
If the expression of the application's knowledge can be persisted (that is, stored recoverably, as in a file or database), application restart is less expensive and simpler than if it cannot. In the example above, the expression of the application's knowledge can be persisted by recording the DC d and the time t. Some change notification mechanisms don't allow this information to be persisted. The server and application must synchronize with some other mechanism when the application starts. This is expensive if many objects are involved, and can involve complicated programming.
You can use the following techniques to track changes in Active Directory.
The change notification control is designed for programs or services that want reasonably prompt notification of infrequent changes. An example is a service or program that stores configuration information in Active Directory™ and wants to be notified promptly when a change occurs. Note that there are limitations of the notification control.
The DirSync and USNChanged search techniques are designed for applications that maintain consistency between data in Active Directory™ and corresponding data in some other storage. These techniques are used by applications that periodically poll for changes. The DirSync technique is based on an LDAP server control that you can use through ADSI or LDAP APIs. The disadvantages of the DirSync control are that it can only be used by a highly privileged account, such as a domain administrator
The USNChanged technique does not have these limitations, although it is somewhat more complicated to use than DirSync.