Loupe - Log - Monitor - Resolve
Loupe / Developer's Guide / For .NET Framework / Loupe Architecture / Developer's Reference - Session File Pruning
In This Topic
    Developer's Reference - Session File Pruning
    In This Topic

    To keep the amount of disk space used for log data under control you can specify parameters that control session file retention:

    You can see a description of how to set these parameters at Developer's Reference - Session File Configuration.

    When is Pruning Performed

    Each Loupe Agent will run a maintenance routine to prune files based on a random delay from when it starts a new file. 

    A maintenance cycle is not performed after the end of a session.

    Why the random delays?

    These delays are designed to reduce contention and improve efficiency in situations where multiple copies of the same application are started about the same time.  This can happen in Terminal Server scenarios where many people launch the same application at the start of the work day or after lunch or in batch background processing scenarios.  By using a random delay there will tend to be just one performing maintenance at a time, eliminating threads waiting around for exclusive access to the maintenance routine.  The longer delay at initial startup is designed to put the maintenance work firmly outside of the busy application startup time so that it isn't contending for resources.

    How Loupe Decides to Prune Files

    File pruning is always performed on a separate thread from both the host application and routine logging.  Logging will continue while pruning is performed.  When pruning:

    1. First, the Loupe Agent performs pruning based on age.  It will get rid of files that were closed more than the allowed number of days in the past, even if they are part of ongoing sessions. 
    2. Once age pruning has been performed it checks the remaining files to see if they fit within the allowed maximum local disk usage.  If not, it will remove all files that would have it exceed the limit, provided they have not been updated in the last two minutes.  Files are removed first with a preference to removing those related to older, closed sessions and finally by removing fragments of active sessions.

    Additionally:

    When will Loupe Exceed the Maximum Local Disk Usage

    There are several cases where, for safety reasons, the Agent will allow more than the Maximum Local Disk Usage to be taken up for a single Product & Application:

    1. When it would require deleting session files that have been closed in the last two minutes.
    2. When a file that is targeted for deletion is locked and can't be removed. 
    3. When several copies of your application are running at the same time and have collectively logged more than your maximum local disk usage.
    4. When a previous session has crashed and the new session hasn't been running long enough to perform maintenance.

    Tips for Picking Good Pruning Options

    First, consider that local computer storage is generally very large.  With the smallest new desktops coming with 80GB drives it isn't necessary to watch over every MB.  In general, you want to err on the side of ensuring you can get the session data you need to support your customers.  There are safeties built into the Packager and Server to guard against sending too much data.

    Even in a minimal configuration it's a good idea to set the maximum local disk usage at least 3x the expected size of a session file.  This allows enough space to have a complete session file of a previous crashed session to send at the end of the next session.  If you aren't using the Loupe Server then using a higher multiplier is advisable to provide a better picture of problems over time when a user reports an issue.

    If the Maximum Local Disk Usage is very close to or less than the typical session size then sessions will be deleted very rapidly, possibly before a crashed session can be reported. 

    Specifying a Maximum File Size

    The Agent can automatically roll over a session file based on the duration the file has been open or how large it is.  The size setting is primarily useful when it's necessary to be able to purge part of a session while it is still running and it isn't feasible to roll over just by time.  In general, there is little reason to change this setting.  It isn't recommended that a setting higher than 50MB be used since it can reduce performance of session analysis.  If not specified the maximum file size will be automatically set to be one third of the maximum local disk usage. 

    See Also