Share via


Automatically Purge a Database

The purpose of the Windows Server AppFabric automatic purge feature is to automatically and regularly check the growth of an AppFabric monitoring database on disk and reduce its disk footprint when needed. This ensures that a monitoring database does not grow uncontrollably and consume too much space on disk. This feature essentially turns the database into a circular buffer by deleting the oldest events to make room for the newest events when the database reaches its configurable limit. The circular buffer approach has been taken by many logging mechanisms including Event Tracing for Windows (ETW). Without the automatic purge feature, the administrator would have to regularly use the built-in database purge and archive capabilities of the database to ensure it does not grow too large and consume too much space on disk. For more information about manual purging and archiving, refer to Archive and Purge a Database.

The automatic database purging functionality is useful when you want to purge a percentage of the oldest events when a configurable size threshold is reached, or when events have been stored in the database for a configurable amount of time. Configuring either of these values can significantly assist with management of disk space. Automatic purging frees up storage space on disk for storing new monitoring events. By default, AppFabric users will always have access to approximately the most recent (default size) 1.5 GB of monitoring data. Additionally, a consumer of the data may query the operations table in the database to determine when the purge operations occur.

Configuring Automatic Purging

The automatic purge operations are driven by a SQL Server stored procedure that AppFabric installs when it initializes the ApplicationServerMonitoring database during setup. The stored procedure runs at regular intervals and reads the values you configure in the Dbo.ConfigurationPropertiesTable table to drive the logic of its automatic purge operations. There is no user interface within AppFabric with which to configure this table. You can use SQL Server Management Studio to directly modify the values described in the following table to settings you feel are appropriate to meet your database purge requirements.

Column Name Column Type Default Description

ArchiveServer

Nvarchar(128)

NULL

The name of a SQL server that is hosting a monitoring database.  This database will be used for archiving monitoring data.

ArchiveDatabase

Nvarchar(128)

NULL

The name of a monitoring database.  This database will be used for archiving monitoring data.

APEnabled

bit

1

Enables or disabled automatic purging of monitoring data.  When set to 1, the database will automatically purge data based on the other auto-purge configuration properties.

APThreshold

int

1500

This property is only read if APEnabled is set to 1.  When the size of the database exceeds this threshold (approximated in megabytes), the automatic purge is engaged and monitoring data will be deleted in accordance with the APTrimPercentage configuration property.

APMaxEventAge

float

NULL

This property is only read if APEnabled is set to 1.  Any monitoring event in the database that is older than this property’s value (in days) will be deleted.

APTrimPercentage

int

10

This property is only read if APEnabled is set to 1.  When the APThreshold purge mechanism engages, approximately APTrimPercantage percent of the oldest monitoring data will be deleted, making room for new data. The default value of this is 10 percent.

The oldest events are purged when the purge conditions are met and the stored procedure is triggered. If during one if its regular invocations the stored procedure finds that the size on disk of the specific monitoring database has exceeded the size of the APThreshold value, the percentage (APTrimPercentage value) of the oldest database entries are written over by the newest entries. Also, if during one of its regular invocations the stored procedure finds events that are older than APMaxEventAge then those events are deleted.

Note

The current disk size of the database and amounts of data to purge are both approximated based on the configuration properties. AppFabric removes "approximately" X percent of the oldest events in the database. The actual limit to which the database can grow may vary based upon hardware and event throughput.

Note

The AppFabric automatic database purge feature can be used only for AppFabric installations configured to use Microsoft SQL Server to store its monitoring database. Also, the monitoring database is the only AppFabric database for which the automatic purge functionality exists. It cannot be configured to use with the persistence database.

See Also

Concepts

Archive and Purge a Database