Re: Remoting large dataset - deserialization is slow



Hi, All:

See our free remote database service at
http://www.udaparts.com/document/articles/dialupdb.htm

I estimate our remote database service can send your 68369 rows to a new
machine in less than 5 seconds.


"tanitack" <tanitack@xxxxxxxxx> wrote in message
news:1162794993.167204.159640@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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

  • 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: Repeatable compression is possible and easy to do, heres how...
    ... Establish three streams of pseudo-random data, ... love with disallows not only repeatable compression but regular ... values for a b c client. ...
    (comp.compression)
  • Re: HTTP Compression issues with IIS 5
    ... Thanks for your response. ... it simply tells client the local cache still can be used ... Specify Additional Document Types for HTTP Compression ...
    (microsoft.public.inetserver.iis)
  • Re: HTTP Compression issues with IIS 5
    ... "Won't this expire all content on the client immediately including ... clients when using HTTP compression. ... I previously suggest you select 'expire immediately' to see if this ... Specify Additional Document Types for HTTP Compression ...
    (microsoft.public.inetserver.iis)
  • Remoting and Serialization
    ... I already posted this issue on the remoting NG, but didn't get an answer, so ... I have a client/server app., that communicates via .NET remoting and I need ... For performance reasons I need to change the serialization algorithm, ... context.State parameter, doing compression if the ...
    (microsoft.public.dotnet.general)