I have WCF service. I have done some testing with basichttp binding and tcp binding.
In a console client i created hundreds of threads and hit the service with tcp and http binding. Turned out TCP is twice faster than http.
Then i made a web client that runs on IIS and hits the service. Turned out that http is faster then TCP.
How does this happen? isnt TCP supposed to be faster than basichttp? COde is like the one below. similar.
stopwatch start here
Thread[] ts = new Thread[100];
for(int i= 0; i< ts.lenght;i++){
ts[i] = new Thread(foo); // replace with bar for the second test.
ts[i].start();
}
for(int i 0;i< ts.lenght;i++){
ts[i].join();
}
stopwatch stop here.
public static void foo(){
MyServiceClient myclient = new MyServiceClient("netTcpBinding");
myclient.GetResult(1);
}
public static void bar(){
MyServiceClient myclient = new MyServiceClient("basicHttpBinding");
myclient.GetResult(1);
}