WCF Why HttpsTransport with WebSocket=Always faster than Never

59 Views Asked by At

As the title says, could someone explain to me why WCF HttpsTransport using Websocket (transportUsage=Always), are faster than not using Websocket (transportUsage=Never) even when doing sessionless request-replies? My thinking was that not using Websockets in such case would be faster since we don't use a persistent connection and doing multiple short lived Websocket connect\disconnect are expensive. When I run our app though, the database lookups (using WCF) is slightly faster when transportUsage=Always that when Never. Using WCF tracing I can see the durations when transportUsage=Never are maybe 3x the durations when Always. Everything works with either setting but I don't understand why "Always" is faster even when using the websockets "incorrectly" such as in our case?

I was expecting HttpsTransport with transportUsage=Never to be faster in our case since we use the Websocket in a "sessionless" way.

1

There are 1 best solutions below

2
Jiayao On

As far as I know, websocket is used in wcf scenarios where duplex communication is used. As you mentioned, the connection or disconnection will cost resources, and I think it will also affect efficiency.