c# - WCF Streamed Download - High CPU Utilization Hosted in IIS vs Console -


i've looked @ couple of seemingly related posts don't offer solution (or solution helps situation):

cpu usage goes upto 75% while stream 300 mb file using wcf service

high cpu load using wcf streaming

so i'm hoping out there can help.

i have put wcf service using .net 4.5 facilitate uploading , downloading of large files (hundreds of mbs gbs.)

i using "streamed" transfermode on basichttpbinding no security.

everything works fine, however, have noticed huge disparity in cpu utilization of service when hosted in iis vs self-hosting in console application.

in console application, utilization below 20%, once in iis utilization on 80% - single instance download.

the service configured same way in both scenarios , both running on same box.

my binding configured so:

<binding name="unsecuredstreambinding"                  receivetimeout="00:30:00"                  sendtimeout="00:30:00"                  transfermode="streamed"                  maxreceivedmessagesize="53687091200" maxbuffersize="65536" /> <!--50gb-->  

the service code simple:

... var filestream = file.openread(filename); var size = filestream.length;  var response = new downloadresponse     {        filestream = filestream,        size = size,     };  return response; 

where downloadresponse defined messagecontract.

i've done little alter default iis environment (iis 8.5 on windows server 2012 r2) logging/diagnostics turned off aren't adding overhead.

this first foray web service development, know there lot don't know , i'm hoping i'm missing simple account huge difference in cpu utilization i'm seeing.

i have figured out happening...

under iis section of iis 8.5 control panel there "compression" feature. in there, there 2 options checked default;

  • enable dynamic content compression
  • enable static content compression

it appear "dynamic content compression" blame, un-checking option resulted in similar cpu utilization of console application.

when re-checking option, warned can result in higher cpu utilization.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -