The Scavenger Service

As you create more messages. the Hydra database will fill up. CouchDb's compaction facility will reclaim unused space, but the database file will obviously keep growing. At some point you will probably want to delete or archive old messages to keep the database size down.

The Scavenger Service is a .NET Windows service to do this. It polls the database at regular intervals, deletes all messages older than a specified duration and/or deletes old messages to keep the total number of documents in the database below a given total. As deletions are replicated, these messages will be deleted from all replicas as well.

To use the service, go to the DotNet/HydraScavengerService directory, open the solution there, adjust the values in App.config, and compile. Then put the DLLs in the directory where you want the service to live e.g. C:\Program Files\Hydra\HydraScavengerService Then open a Visual Studio Command Prompt, go to the directory containing your executable, and run:

installutil HydraScavengerService.exe

Unfortunately there is no support for setup projects in VS11, so there is no installer for the service at the moment.

The scavenger deletes documents using CouchDb's bulk document facility, deleting them in batches of 1,000 at a time until it has deleted all the ones it needs to. You can adjust the number of documents per batch and the polling interval using the DeleteBatchSize and PollIntervalSeconds App.config settings.

Hydra version 0.4

Last edited Jun 17, 2012 at 4:14 PM by NickNorth, version 4


No comments yet.