Running SQL Server 2014
with FilestreamEffectiveLevel
set to 3. Thus, I can easily retrieve files using SQLFileStream in C#
:
using (var stream = new SqlFileStream(path, transactionContext,
FileAccess.Read, FileOptions.SequentialScan, 0))
{
byte[] data = new byte[stream.Length];
stream.Read(data, 0, data.Length);
}
This works, but it looks like this piece of code causes the network to be overwhelmed by TCP
packages marked with the PSH
flag. What this essentially means is that the TCP buffers are not used efficiently. Instead of utilizing our MTU
of 1500 bytes, it mostly uses 54 bytes (empty ACK
) or 200-300 bytes. (We ran some tests using WireShark
.)
What is causing this? Is it a driver problem or do we need to change the C#
code to somehow optimize the network utilization?
Turned out to be another part of the code. SqlFileStream
performs well.