Remoting large dataset - deserialization is slow



Hi,

We have a client/server application windows based application. The
client displays a number of data points to the user. We transfer all
the necessary data over remoting. The data is transferred as a dataset
containing all the required tables. We use the compression code given
in Chapter 13, Extending .Net Remoting, by Ingo Rammer. The compression
works fine and transfers the data over the remoting channel pretty fast
even for around 68369 rows. But even though remoting is fast, there are
other things which take time at the client side and server side.



For example, on the server side in the CompressioHelper class we have
the GetCompressedStreamCopy which takes some 4 to 5 seconds.



public static Stream GetCompressedStreamCopy(Stream inStream) {

Stream outStream = new System.IO.MemoryStream();

DeflaterOutputStream compressStream = new DeflaterOutputStream(

outStream,new Deflater(Deflater.BEST_COMPRESSION));

byte[] buf = new Byte[1000];

int cnt = inStream.Read(buf,0,1000);

while (cnt>0) {

compressStream.Write(buf,0,cnt);

cnt = inStream.Read(buf,0,1000);

}

compressStream.Finish();

compressStream.Flush();

outStream.Seek(0,SeekOrigin.Begin);

return outStream;

}



Here the loop takes time. If we remove the loop and do it in one go
like,



public static Stream getCompressedStreamCopy(Stream inStream) {

Stream outStream = new System.IO.MemoryStream();

DeflaterOutputStream compressStream = new
DeflaterOutputStream(outStream,

new Deflater(Deflater.DEFAULT_COMPRESSION));





int bufferSize = Convert.ToInt32(inStream.Length);





byte[] buf = new Byte[bufferSize];



int cnt = inStream.Read(buf,0,bufferSize);

//while (cnt>0) {

compressStream.Write(buf,0,cnt);

//cnt = inStream.Read(buf,0,bufferSize);

//}

compressStream.Finish();

compressStream.Flush();

return outStream;

}



Even this case there is a 4 second time to compress the data. The 4
second is just for the one statement
"compressStream.Write(buf,0,cnt);". Is there any way to improve this?
We want to bring up all the data on the client side in less than 10
secs. Though remoting over the wire doesnt take much time, data loading
+ plus this 4 secs makes it almost 20 secs on the server side alone.
The buffer size in the above code for which it took 4 secs was
35139484.



Client Side:

The client side decompression happens pretty fast. But after it gets
decompressed and moves through the call stack to the point where the
original method call was made, it takes almost a minute. The bulk of
the time is between two system calls:


The time taken to hit RemotingProxy.CallProcessMessage() after it hits
Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage() is 40
seconds. So we are loosing all the time saving we have made by
compressing the data. Basically you find it to be taking huge time to
deserialize, the surprise thing is serialization is faster. Any clues
as why all these are happening?

regards,

Catinat

.



Relevant Pages

  • Re: Remoting large dataset - deserialization is slow
    ... We use the compression code given ... in Chapter 13, Extending .Net Remoting, by Ingo Rammer. ... other things which take time at the client side and server side. ... Stream outStream = new System.IO.MemoryStream; ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: soapsuds
    ... pre-instantiated exe running in a singleton mode, for remoting, even if you ... Revised framework implementations will probably not break your application ... We can then compile the client using this code which allows us ... Both client and server are ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: Sending Messages and Sharing Objects
    ... RJ> are using CSLA framework by Rocky because it allows us to switch ... Web Service, Remoting or Simple ... RJ> since client requirements could vary. ... RJ> to use any of the channels - 2Tier, Web Service or Remoting ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: passing structs (setializable) object in web service
    ... The philosophy of webservices is different than that of remoting. ... follow Seely's advice as Christoph pointed out earlier - you have to modify ... > having total control over both client and server types. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Events in .Net Remoting
    ... I am writing with respect to the Events in .Net Remoting that I had ... another channel for the callbacks..both on client side. ... Then I force a method on the server end (through a GUI control on the ... >> the regular client side requests still work fine. ...
    (microsoft.public.dotnet.framework.remoting)