HADR_FILESTREAM_FILE_CLOSE SQL Server Wait Type

Wait Type HADR_FILESTREAM_FILE_CLOSE

The wait type HADR_FILESTREAM_FILE_CLOSE is ranked #219 by Stedman Solutions and Database Health Monitor.

Wait statistics, in the context of SQL Server, refer to the amount of time that a query spends waiting to access data in the database. When a client application requests data from the database, the request is placed in a queue and the client application must wait for its turn to access the data. The time that the query spends waiting is called a "wait" and is tracked by SQL Server. This information can be used to identify potential performance bottlenecks and optimize the performance of the database. Wait statistics are commonly used by database administrators to diagnose and troubleshoot performance issues in SQL Server.


In SQL Server, Always On Availability Groups are a powerful feature for ensuring high availability and disaster recovery. However, they introduce unique wait types, one of which is HADR_FILESTREAM_FILE_CLOSE. Knowing what this wait type represents can help you troubleshoot issues and optimize your Always On environment.

What is HADR_FILESTREAM_FILE_CLOSE?

The HADR_FILESTREAM_FILE_CLOSE wait type occurs when SQL Server is waiting for a FILESTREAM file operation to close as part of Always On Availability Group synchronization. This wait type is related to managing FILESTREAM data, which allows SQL Server to store large binary data (like images or videos) in the file system while maintaining transactional consistency.

In simpler terms, this wait indicates that SQL Server is ensuring FILESTREAM data changes are finalized and synchronized between the primary and secondary replicas. While occasional waits are normal, excessive delays could point to inefficiencies in your system.

Why Does HADR_FILESTREAM_FILE_CLOSE Happen?

There are several reasons why HADR_FILESTREAM_FILE_CLOSE waits might occur, including:

  • Large FILESTREAM operations, such as bulk updates or inserts.
  • Slow disk I/O on the server hosting the FILESTREAM data.
  • Network latency or bandwidth issues between the primary and secondary replicas.
  • Resource contention, such as limited CPU or memory capacity, impacting synchronization.
  • Heavy workloads or contention on the Always On Availability Group.

Understanding these factors is crucial for identifying and resolving performance bottlenecks.

How to Monitor HADR_FILESTREAM_FILE_CLOSE Waits

Monitoring HADR_FILESTREAM_FILE_CLOSE waits is key to diagnosing and addressing synchronization delays. The Database Health Monitor is an invaluable tool for this purpose. Its Historic Waits Monitoring feature provides detailed insights into when these waits occur and their frequency, helping you identify patterns and correlations with system activity.

Using Database Health Monitor, you can track how FILESTREAM operations impact your Always On Availability Group and pinpoint areas for improvement.

What Can You Do About HADR_FILESTREAM_FILE_CLOSE Waits?

If you notice frequent or prolonged HADR_FILESTREAM_FILE_CLOSE waits, consider the following steps:

  • Optimize your FILESTREAM usage by minimizing large or unnecessary operations during peak activity.
  • Improve disk performance by upgrading to faster storage or optimizing existing storage configurations.
  • Ensure network connections between the primary and secondary replicas are fast and reliable.
  • Allocate sufficient resources (CPU, memory, and I/O) to servers managing FILESTREAM data.
  • Distribute workloads across replicas to reduce contention and improve overall system performance.

These actions can help reduce the impact of this wait type, improving the efficiency of your Always On Availability Group.

How Stedman Solutions Can Help

At Stedman Solutions, we specialize in SQL Server performance optimization and troubleshooting, including resolving issues with wait types like HADR_FILESTREAM_FILE_CLOSE. Our managed services provide expert support and proactive monitoring to ensure your Always On Availability Groups are performing at their best. Additionally, our Database Health Monitor offers comprehensive tools for tracking and analyzing SQL Server waits, helping you maintain a reliable and efficient database environment.

If you’re experiencing performance challenges or want to optimize your SQL Server setup, contact us today. Let us help you achieve a high-performing, reliable database system!


Watch on YouTube


Find out more about our SQL Server Managed Services

Applies to

    Related Waits

    HADR_AG_MUTEX
    HADR_AR_CRITICAL_SECTION_ENTRY
    HADR_AR_MANAGER_MUTEX
    HADR_AR_UNLOAD_COMPLETED
    HADR_ARCONTROLLER_NOTIFICATIONS_SUBSCRIBER_LIST
    HADR_BACKUP_BULK_LOCK
    HADR_BACKUP_QUEUE
    HADR_CLUSAPI_CALL
    HADR_COMPRESSED_CACHE_SYNC
    HADR_CONNECTIVITY_INFO
    HADR_DATABASE_FLOW_CONTROL
    HADR_DATABASE_VERSIONING_STATE
    HADR_DATABASE_WAIT_FOR_RESTART
    HADR_DATABASE_WAIT_FOR_TRANSITION_TO_VERSIONING
    HADR_DB_COMMAND
    HADR_DB_OP_COMPLETION_SYNC
    HADR_DB_OP_START_SYNC
    HADR_DBR_SUBSCRIBER
    HADR_DBR_SUBSCRIBER_FILTER_LIST
    HADR_DBSEEDING
    HADR_DBSEEDING_LIST
    HADR_DBSTATECHANGE_SYNC
    HADR_FABRIC_CALLBACK
    HADR_FILESTREAM_BLOCK_FLUSH
    HADR_FILESTREAM_FILE_REQUEST
    HADR_FILESTREAM_IOMGR
    HADR_FILESTREAM_MANAGER
    HADR_GROUP_COMMIT
    HADR_LOGCAPTURE_SYNC
    HADR_LOGCAPTURE_WAIT
    HADR_LOGPROGRESS_SYNC
    HADR_NOTIFICATION_DEQUEUE
    HADR_NOTIFICATION_WORKER_EXCLUSIVE_ACCESS
    HADR_NOTIFICATION_WORKER_STARTUP_SYNC
    HADR_NOTIFICATION_WORKER_TERMINATION_SYNC
    HADR_PARTNER_SYNC
    HADR_READ_ALL_NETWORKS
    HADR_RECOVERY_WAIT_FOR_CONNECTION
    HADR_RECOVERY_WAIT_FOR_UNDO
    HADR_REPLICAINFO_SYNC
    HADR_SYNC_COMMIT
    HADR_SYNCHRONIZING_THROTTLE
    HADR_TDS_LISTENER_SYNC
    HADR_TDS_LISTENER_SYNC_PROCESSING
    HADR_TIMER_TASK
    HADR_TRANSPORT_DBRLIST
    HADR_TRANSPORT_FLOW_CONTROL
    HADR_TRANSPORT_SESSION
    HADR_WORK_POOL
    HADR_WORK_QUEUE
    HADR_XRF_STACK_ACCESS

    See Also


    All Wait Types
    HADR_FILESTREAM_FILE_CLOSE SQL Server Wait Type