c# - WCF hosting and Performance -
i have wcf service. have done testing basichttp binding , tcp binding.
in console client created hundreds of threads , hit service tcp , http binding. turned out tcp twice faster http.
then made web client runs on iis , hits service. turned out http faster tcp.
how happen? isnt tcp supposed faster basichttp? code 1 below. similar.
stopwatch start here thread[] ts = new thread[100]; for(int i= 0; i< ts.lenght;i++){ ts[i] = new thread(foo); // replace bar second test. ts[i].start(); } for(int 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); }
did know wcf has throttling turned on by default. before run these tests, should turn off using bit of config in web.config's servicemodel section:
<behaviors> <servicebehaviors> <behavior> <!-- can omit name in .net 4 --> <servicethrottling maxconcurrentcalls="10000" maxconcurrentsessions="100000" maxconcurrentinstances="100000" /> </behavior> </servicebehaviors> </behaviors>
the defaults vary version around 16, 10, 100 or along lines in .net 4. lower defaults applied even if have no throttling entry in web.config / app.config.
good luck.
Comments
Post a Comment