Summary: This article discusses Exchange 2000 CDO performance optimizations when creating appointments, calendar items, and messages. (2 printed pages)
Collaboration Data Objects (CDO) has made it significantly easier to write applications for the Microsoft Exchange 2000 Server. This article discusses performance optimizations that the application programmer can use to design the highest performance applications, particularly when working with appointments via HTTP/DAV, OLEDB, ADO, and CDO.
CDO Appointment Performance
Recurrence Expansion: Creation of Recurring Appointment Instances In Exchange 2000, recurring meetings and appointments are stored as a master appointment that contains information about the recurrence pattern and exceptions, as well as separate instances for each occurrence of the appointment. This storage allows users of HTTP/DAV, OLEDB, and ADO to access the individual appointment occurrences with a standard query. The instances of the appointment occurrences are only created when a non-MAPI client queries the calendar folder and specifies a range of dates in which the list of appointments is desired. When this query is handed to the Exchange 2000 store, the master appointment is opened and enough instances are created to provide the correct list of appointments to the client. Appointments are expanded on a month-by-month basis. Thus, a query with any part of a given month causes all of the recurring appointments in that month to be expanded.
The Recurrence Pattern of an appointment can, of course, directly affect the performance when expansion occurs. CDO is fully Icalendar-compliant (RFC 2445) so an almost unlimited number of recurrence patterns is possible, with granularity down to the level of a second. It is possible but not practical to have recurring appointments occur every second using CDO.
To limit the potential for significant performance problems from such recurrence patterns, the implementation of recurrence expansion in Exchange 2000 allows no more than 10 instances per day. A typical recurrence pattern occurs, at most, once per day (and, in fact, Microsoft Outlook 2000 and previous versions only permit one instance per day of a given recurring appointment). It is highly recommended that a scheduling application implement the minimal amount and simplest form of necessary recurrence rules.
As with other queries against Exchange 2000, it is optimal to reuse recent queries whenever possible to take advantage of queries that are cached on the server. Thus, when possible avoid using the current time (such as NOW in Visual Basic) in a query. This changes every second and its use in a query increases the number of search folders created. Instead, round off the time to some reasonable level, such as daily for monthly or weekly queries, or perhaps hourly for daily queries.
For example, the calendar should ideally be queried in monthly intervals to limit the overhead incurred during expansion of recurring appointments, to only those in the particular month. The date picker used in many scheduling applications is ideal for choosing the interval to query. For example, if the user picks the monthly view in a date picker for August, the query should reflect a consistent date interval within that month. The ideal query must use the first day of the month to the last day of the month (8/1/2000 to 8/31/2000). The results of the query will thus be cached in the server for each month and, consequently, any subsequent identical queries will be much less resource-intensive.
When deleting an entire recurring series of appointments, one should delete only the master. When the client deletes an appointment instance, an event in the Exchange 2000 store is triggered to create an exception for that appointment. Deleting the instances causes a series of these events, and each is quite resource-intensive. Instead, when a master appointment is deleted, the instances and exceptions associated with that master are removed immediately upon a date query in a single event.
Single appointments can be deleted individually without much overhead.
Creating Messages and Calendar Items Using CDO
There are three methods of sending a message using CDO: the SMTP Port, SMTP Pickup Directory, and the Exchange Server. The configuration fields of a message allow the user to specify this parameter in the SendUsingMethod. If an application is a bulk mailer or uses SMTP addresses, we highly recommend sending messages using a Port or Pickup Directory. The SendUsingExchange parameter will incur overhead on the Exchange Server because the message is saved in the Outbox, where the MTA picks it up.