问题
I want to know why WCF in streaming mode is really slow compared to the buffered mode.
Basically, I'm reading a lot of data from a server (database access) then transferring that huge data through WCF to other clients.
I was doing some tests and benchmarks by comparing the 2 different transfer modes.
I created 2 endpoints. The first one is using transferMode="Buffered" and the other one is using transferMode="StreamedResponse".
By loading the same 1 millions rows from a SQL server (Dummy table), here are the results:
- Buffered: 20447 milliseconds.
- Streaming: 109417 milliseconds.
The streaming is done like in that Q/A. Basically, the data is stored in an IEnumerable<T> and then streamed to the client that consumes it.
I can provide the WCF app.config files if needed.
By the way, I already had a look on other similar questions like those:
WCF NetTcpBinding Buffered vs Streamed performance problems
But they don't really give an appropriate answer.
来源:https://stackoverflow.com/questions/52085812/wcf-streaming-mode-is-really-slow