WaitType:ASYNC_NETWORK_IO

官方文档的定义,是指SQL Server 产生的结果集需要经过Network传递到Client,Network不能很快将结果集传输到Client,导致结果集仍然驻留在SQL Server的Session中,可能的原因是结果集非常大,或者Network带宽小,传输慢。

ASYNC_NETWORK_IO:Occurs on network writes when the task is blocked behind the network. Verify that the client is processing data from the server.

引用《Wait statistics, or please tell me where it hurts

ASYNC_NETWORK_IO : This is usually where SQL Server is waiting for a client to finish consuming data. It could be that the client has asked for a very large amount of data or just that it’s consuming reeeeeally slowly because of poor programming – I rarely see this being a network issue. Clients often process one row at a time – called RBAR or Row-By-Agonizing-Row – instead of caching the data on the client and acknowledging to SQL Server immediately.

使用Resource Monitor 查看Server的Network Activity

The ASYNC_NETWORK_IO wait indicates that one of two scenarios are happening. The first scenario is that the session (i.e., SPID) is waiting for the client application to process the result set and send a signal back to SQL Server that it is ready to process more data. The second is that there may be a network performance issue.

Reducing SQL Server waits / wait times

If there are significant wait times on ASYNC_NETWORK_IO you have the following options:

  • Review the queries and identify large result sets. Verify that the client application is consuming data as efficiently as possible. For example, if the application is asking for a million rows of data but only processing one row at a time.
  • Review that all rows being requested are necessary. Often times it is the case that you can reduce this wait by filtering the result set for only the rows that are needed. Using the TOP clause may be an option as well. Client applications such as Microsoft Access may benefit from querying a view instead of pulling data from an entire table.

If the above tuning tips are reviewed and applied, but the server is still encountering high wait times, then ensure there aren’t any network-related issues:

  • Validate the network components between the application/clients and the SQL Server instance (router, for example).
  • Look at your NIC configuration on the server to make sure there are no issues with the physical card. Also, check if autodetect is picking the fastest speed.
  • Check network adapter bandwidth: 1 Gigabit is better than 100 megabits, and 100 megabits is better than 10 megabits.

Also worth mention is the common practice of performing data loads on the server. It is possible that you may be seeing the ASYNC_NETWORK_IO wait during the times that the data loads are occurring.If this is the case then make sure the shared memory protocol is enabled for the SQL Server instance and the session is connected using net_transport = ‘Shared memory’.

You can determine the net_transport for the connection by looking at the DMV – sys.dm_exec_connections.

参考文档:

Wait statistics, or please tell me where it hurts

sys.dm_os_wait_stats

时间: 2024-10-14 00:36:27

WaitType:ASYNC_NETWORK_IO的相关文章

在SQL Server 2012中,对存在ColumnStore Index的Table进行查询,出现WaitType:HTMEMO 和 HTBUILD

DW中有两个表,LittleTable和BigTable,BigTable上创建了Nonclustered ColumnStore Index,对着两个表进行查询,如下面的Scirpt.在查询时,出现WaitType:HTMEMO 和 HTBUILD,查询速度极其慢,十几个小时都不能出结果. select a few columns,,, from dbo.LittleTable lt with(nolock) inner join dbo.BitTable bt with(nolock) on

WaitType:ASYNC_IO_COMPLETION

项目组有一个数据库备份的Job运行异常,该Job将备份数据存储到remote server上,平时5个小时就能完成的备份操作,现在运行19个小时还没有完成,backup命令的Wait type是 ASYNC_IO_COMPLETION: 根据MSDN 官方文档的定义:Occurs when a task is waiting for asynchronous I/O operations to finish. 该等待类型表示:Task在等待异步IO操作的完成.进程申请了一个IO操作,但是系统(D

WaitType:ASYNC

项目组有一个数据库备份的Job运行异常,该Job将备份数据存储到remote server上,平时5个小时就能完成的备份操作,现在运行19个小时还没有完成,backup命令的Wait type是 ASYNC_IO_COMPLETION: 根据MSDN 官方文档的定义:Occurs when a task is waiting for asynchronous I/O operations to finish. 该等待类型表示:Task在等待异步IO操作的完成.进程申请了一个IO操作,但是系统(D

ASYNC_NETWORK_IO和PREEMPTIVE_OS_WAITFORSINGLEOBJECT等待事件

背景环境: SQL Server 2005或以上 Select * from 某个表,表的数据量约为30万行,在执行语句时通过观察sys.dm_exec_requests中的wait_type列发现是ASYNC_NETWORK_IO等待,在本地MSSQL2012上测试时发现了PREEMPTIVE_OS_WAITFORSINGLEOBJECT等待,在本地2008R2测试时发现只有ASYNC_NETWORK_IO等待. 可以使用如下语句查询相关等待的等待时间: 1 2 3 4 5 6 7 8 9 s

select * from sys.sysprocesses

MSDN:包含正在 SQL Server 实例上运行的进程的相关信息.这些进程可以是客户端进程或系统进程. 视图中主要的字段: 1. Spid:Sql Servr 会话ID 2. Kpid:Windows 线程ID 3. Blocked:正在阻塞求情的会话 ID.如果此列为 Null,则标识请求未被阻塞 4. Waittype:当前连接的等待资源编号,标示是否等待资源,0 或 Null表示不需要等待任何资源 5. Waittime:当前等待时间,单位为毫秒,0 表示没有等待 6. DBID:当前

带您理解SQLSERVER是如何执行一个查询的

原文地址:http://www.cnblogs.com/lyhabc/p/3367274.html 看这篇文章之前,阁下可以先看一下下面的文章 SQLSERVER独特的任务调度算法"SQLOS" SQL Server SQLOS 的任务调度[转] 翻译自: http://rusanu.com/2013/08/01/understanding-how-sql-server-executes-a-query/ http://www.codeproject.com/Articles/6303

SQL技术内幕-13 SQL优化方法论之分析实例级别的等待

优化方法论的第一步是在实例级别上找出什么类型的等待占用了大部分的等待时间,这可以通过查询动态管理图(DMV,dynamic management view)sys.dm_os_wait_stats 运行一下查询,将返回你的系统中的等待信息,并按类型排序. SELECT wait_type , waiting_tasks_count , wait_time_ms , max_wait_time_ms , signal_wait_time_ms FROM sys.dm_os_wait_stats O

SQL Server 性能调优(一)——从等待状态判断系统资源瓶颈

原文:SQL Server 性能调优(一)--从等待状态判断系统资源瓶颈 通过DMV查看当时SQL SERVER所有任务的状态(sleeping.runnable或running) 2005.2008提供了以下三个视图工详细查询: DMV 用处 Sys.dm_exec_requests 返回有关在SQL Server中执行的每个请求的信息,包括当前的等待状态 Sys.dm_exec_sessions 对于每个通过身份验证的会话都返回相应的一行.此时图是服务器范围的视图.此视图首先可以查到服务器负

sys.sysprocesses视图的使用小结

Sys.SysProcesses 系统表是一个很重要的系统视图,主要用来定位与解决Sql Server的阻塞和死锁包含正在 SQL Server 实例上运行的进程的相关信息.这些进程可以是客户端进程或系统进程. 视图中主要的字段: 1. Spid:Sql Servr 会话ID 2. Kpid:Windows 线程ID 3. Blocked:正在阻塞求情的会话 ID.如果此列为 Null,则标识请求未被阻塞 4. Waittype:当前连接的等待资源编号,标示是否等待资源,0 或 Null表示不需