How Many Bytes Sent From SQL Server To Client
We are troubleshooting an ancient application written in classic ASP which accesses an SQL Server 2005 database. This is an intranet application only.
The ASP page is set up to paginate through 200,000+ records, 10/20 or 30 records at a time. We're planning to move this app to a more current language, etc. In the mean time, we've been asked to determine how many bytes have been transfered开发者_运维问答 to the client.
The SQL query is as such:
db_server = "<server name>"
db_name = "<database name>"
db_username = "<user name>"
db_userpassword = "<password>"
connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword
With objCn
.CursorLocation = adUseClient
.ConnectionTimeout = 15
.CommandTimeout = 30
.ConnectionString = connectstr
.Open
End With
With objRs
.ActiveConnection = objCn
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.Source = sql
.PageSize = intPageSize
.Open
Set .ActiveConnection = Nothing 'Disconnect the recordset
End With
The ASP goes on to page through the return data and this is where we'd want to know how many bytes are actually received at the client. We're thinking its simply taking the pagesize and multiplying it by the data field lengths being returned as the cursor only returns one "page" at a time. Is it that simple? Are we missing any significant overhead in that calculation?
If the client and server are on different machines, fire up Wireshark to monitor the true bandwidth.
http://www.wireshark.org/
精彩评论