WCF Dataportal Compression

WCF Dataportal Compression

Old forum URL: forums.lhotka.net/forums/t/4507.aspx


IMindZ posted on Monday, March 17, 2008

Has anybody tried G-Zip or any other compression for WCF Dataportal?
I pass large amount of data between the Dataportal and the client. Do you think  implemeting compression could make much difference?
I was trying to figure out the config settings to use for a G-Zip encoder.

Paul Czywczynski replied on Monday, March 17, 2008

We have implemented the SDK gzip sample with our dataportal. I don't have any stats saying its faster but I know it really didn't hurt performance. Your best bet is to give it a shot and see how you like it. It's not tough to set up.

    <system.serviceModel>

    <extensions>
      <bindingElementExtensions>
        <add name="gzipMessageEncoding" type="TWFX.Common.GZipMessageEncodingElement, TWFX.Common" />
      </bindingElementExtensions>
    </extensions>

    <services>
      <service behaviorConfiguration="TWfxServiceBehavior" name="TWFX.DataPortalService.WcfPortal">
        <endpoint binding="customBinding" bindingConfiguration="fxCompressionBinding" contract="TWFX.Common.IFxWcfPortal" />
      </service>
    </services>

    <bindings>
      <customBinding>
        <binding name="fxCompressionBinding">
          <gzipMessageEncoding innerMessageEncoding="binaryMessageEncoding">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          </gzipMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647" authenticationScheme="Ntlm" />
        </binding>
      </customBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="TWfxServiceBehavior">
          <serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" maxConcurrentInstances="1000" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

  </system.serviceModel>


IMindZ replied on Tuesday, March 18, 2008

Thanks. I had to modify the GZipEncoder in the SDK samples so that it read the readerQuotas out of the config. Did you do the same?

Paul Czywczynski replied on Tuesday, March 18, 2008

Yes I did. As I was typing up my post yesterday I was trying to remember the mods I had to make to it. That was is. :)

bspraguetx replied on Friday, March 21, 2008

I need to do the same thing.  Would you mind sharing the relevant code?

Paul Czywczynski replied on Friday, March 21, 2008

Files attached. You'll have to update the namespace to match yours.

bspraguetx replied on Friday, March 21, 2008

Thanks Paul

Copyright (c) Marimer LLC