Skip to main content

Spreadsheet Document Hibernation

  • 2 minutes to read

The DocumentManager can release server memory from inactive open documents and save them to the server file system. This behavior reduces server memory consumption and prevents the loss of unsaved document changes after IIS recycling. If a user interacts with a hibernated document, DocumentManager restores the document from the file system to the server’s RAM.

Hibernation Settings

EnableHibernation
Sets whether the document hibernation is enabled. The default value is false.
HibernationStoragePath
Sets the path to the server directory where open documents hibernate after the idle timeout period expires.
HibernateTimeout
Sets the idle timeout period before DocumentManager hibernates an open document. The default value is TimeSpan.FromHours(1).
HibernatedDocumentsDisposeTimeout
Sets how long DocumentManager stores a hibernated document on the server before disposal. The default value is TimeSpan.FromHours(24).
HibernateAllDocumentsOnApplicationEnd
Sets whether DocumentManager should hibernate all open documents if a planned IIS process recycling occurs.

Specify the hibernation settings in the Application_Start method handler in the global.asax file. In this instance, users are not required to reload the page with the Spreadsheet control and can continue to work with the open document even after a server failure.

The following code sample demonstrates how to define the hibernation settings:

<%@ Application Language="C#" %>
<%@ Import Namespace="DevExpress.Web.Office" %>
<script runat="server">
    void Application_Start(object sender, EventArgs e) {
        // Code that runs on application startup
        DocumentManager.HibernationStoragePath = Server.MapPath("~/App_Data/HibernationStorage/"); // Required setting
        DocumentManager.HibernateTimeout = TimeSpan.FromMinutes(30); // Optional setting
        DocumentManager.HibernatedDocumentsDisposeTimeout = TimeSpan.FromDays(1); // Optional setting
        DocumentManager.HibernateAllDocumentsOnApplicationEnd = true; // Optional setting
        DocumentManager.EnableHibernation = true; // Required setting to turn the hibernation on
    }
</script>

Limitation

The ASPxSpreadsheet control loses the undo/redo history after hibernation.