HighTechTalks DotNet Forums  

Performance Problem with AppDomains

Dotnet Framework (Performance) microsoft.public.dotnet.framework.performance


Discuss Performance Problem with AppDomains in the Dotnet Framework (Performance) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old   
AT
 
Posts: n/a

Default Re: Performance Problem with AppDomains - 10-10-2005 , 02:55 AM






Hi Cristian,

Thanks for your response. For the Custom ISerializable interface, in the
GetObjectData method, generally, it will let us add the serilization data
of our class into the SerilizationInfo through AddValue method. For
example, which a class contains string, int and other type members, we can
only add some of them, as for string content, we can perform encoding and
compression on it. There is no means for us to convert a object instance
directly into byte array without use binaryFormatter , this is unlike in
c++. So what's your class's members, just byte array? If most of them are
string contents, we can perform encoding and compression on them. If only
binary datas, I'm afraid, we haven't any good means to compress them. Also,
to get byte[] from the object instance on the fly, we could only use the
BinaryFormatter inside our custom ISerializable interface.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security



--------------------
Quote:
Thread-Topic: Performance Problem with AppDomains
thread-index: AcXLR9Xz5KAMQVh3RhG4L7YzFQDgYg==
X-WBNR-Posting-Host: 85.36.120.90
From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com
<c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl>
<#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl>
<VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl>
<rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
Quote:
Subject: Re: Performance Problem with AppDomains
Date: Fri, 7 Oct 2005 07:03:04 -0700
Lines: 326
Message-ID: <94D4A41E-8BEE-4F74-B006-EA69C024F709 (AT) microsoft (DOT) com
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.performance
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.performance:3740
X-Tomcat-NG: microsoft.public.dotnet.framework.performance

Hi steven.
Yeah, your advice proven to be precious.
I'm trying to implement my own ISerializable using compression, but I
found
a problem

Implementing the GetObjectData, it would be usefull to get a byte array
rappresenting the class, and Isually do so using this code

System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter
formatter
= new
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter();
formatter.Serialize(buffer, this);
Byte[] ByteObject=new Byte[buffer.Length];
buffer.Read(ByteObject,0,buffer.Length]

however, since I'm implementing my own ISerializable I cannot call
formatter.Serializable since it would end up in a mess.

Could you give me any other advice?

Thanks
Cristian Mori

implementing the GlobalObjec

"Steven Cheng[MSFT]" wrote:

Thanks for your followup Cristian,

So since you mentioned that your actual class will hold about 500kb
data,
I'm afraid this is really a big pressure for cross appdomain
communication.
Also, for class that apply the [Serializable] attribute, the .net
framework automatically determine the runtime serialize structure, we
haven't any particular means to improve it. If your data's structure
or
members is of particular type which can be compressed, you can consider
manually implement the ISerializable interface for your class.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security



--------------------
| Date: Wed, 05 Oct 2005 12:02:50 +0200
| From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| X-Accept-Language: en-us, en
| MIME-Version: 1.0
| Subject: Re: Performance Problem with AppDomains
| References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com
c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| In-Reply-To: <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| Content-Transfer-Encoding: 7bit
| Message-ID: <uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
| Newsgroups: microsoft.public.dotnet.framework.performance
| NNTP-Posting-Host: host90-120.pool8536.interbusiness.it 85.36.120.90
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.performance:3726
| X-Tomcat-NG: microsoft.public.dotnet.framework.performance
|
| Hi Steven
| First of all thanks a lot for your time.
| I also performed similar testings, and I found out that the time
| comsuming is the serialization of the object. It take 780 millisecond
to
| serialize and deserialize in the other appdomain.
| The object is abount 500kbyte in size, so it's pretty big, but 780
| milliseconds are also a lot of time. Since every sycle this is
performed
| 5 times than we get 0,78*5 = 3,9 seconds. Exactly the difference in
time
| between the non-appdomain and appdomain version of the program.
|
| So, now the question move to : is there a way to perform a fast
| cross-domain serialization?
|
| Thanks
| Cristian
|
| Steven Cheng[MSFT] wrote:
| > Hi Cristian,
|
| > Sorry for keep you waiting. Since I've been involved in internal
certain
| > project, I have just managed to perform simple test. I create
simple
class
| > which has a three methods regarding on your description, like:
|
| > ===================
| > [Serializable]
| > public class MyData
| > {
| > public byte[] Bytes;
| > }
|
| > public class MyClass : MarshalByRefObject
| > {
| > public MyClass()
| > {
|
| > }
|
| > public MyData TestOne()
| > {
| > MyData md = new MyData();
|
| > byte[] bytes = new byte[1024*4];
| > for(int i=0;i<bytes.Length;i++)
| > {
| > bytes[i] = (byte)i;
| > }
|
| > md.Bytes = bytes;
|
| > return md;
| > }
|
|
| > public MyData TestTwo(MyData md1)
| > {
| > MyData md = new MyData();
|
| > byte[] bytes = new byte[1024*4];
| > for(int i=0;i<bytes.Length;i++)
| > {
| > bytes[i] = (byte)i;
| > }
|
| > md.Bytes = bytes;
|
| > return md;
| > }
|
| > public MyData TestThree(MyData md)
| > {
| > byte[] bytes = new byte[1024*4];
| > for(int i=0;i<bytes.Length;i++)
| > {
| > bytes[i] = (byte)i;
| > }
|
| > md.Bytes = bytes;
|
| > return md;
| > }
| > }
| > =======================
|
| > when calling the three method locally, all of them are very fast
and
| > consume nearly the same time span. When calling from remote (cross
| > appdomain), the result is also as I've expected, the "TestOne" is
fastest
| > since it dosn't require input paramter , and Method "TestTwo" and
| > "TestThree" takes almost the same timespan. Also, The difference
between
| > calling them locally and remotely dosn't like the one you mentioned
(from
| > milliseconds to seconds).
|
| > Anyway, I've attached my test code in this message, you can have
test
on
| > your side to see whether you get the same results.
|
| > Thanks,
|
| > Steven Cheng
| > Microsoft Online Support
|
| > Get Secure! www.microsoft.com/security
| > --------------------
| > | Date: Tue, 04 Oct 2005 10:28:41 +0200
| > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | X-Accept-Language: en-us, en
| > | MIME-Version: 1.0
| > | Subject: Re: Performance Problem with AppDomains
| > | References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
| > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | In-Reply-To: <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Message-ID: <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > | Newsgroups: microsoft.public.dotnet.framework.performance
| > | NNTP-Posting-Host: host90-120.pool8536.interbusiness.it
85.36.120.90
| > | Lines: 1
| > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.performance:3710
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > |
| > | Hi Steven,
| > | do you have any news?
| > |
| > | Thanks
| > | Cristian Mori
| > |
| > | Steven Cheng[MSFT] wrote:
| > | > Thanks for your detailed response.
| > |
| > | > I'll have a look and perform some tests according to the code
snippets.
| > |
| > | > Steven Cheng
| > | > Microsoft Online Support
| > |
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and
confers
no
| > | > rights.)
| > |
| > | > --------------------
| > | > | Date: Wed, 28 Sep 2005 10:35:35 +0200
| > | > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > | > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | > | X-Accept-Language: en-us, en
| > | > | MIME-Version: 1.0
| > | > | Subject: Re: Performance Problem with AppDomains
| > | > | References:
25E92219-89DA-4229-8ECB-8738E2522C32...soft (DOT) com
| > | > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > | > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > | In-Reply-To: <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Message-ID: <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > | > | Newsgroups: microsoft.public.dotnet.framework.performance
| > | > | NNTP-Posting-Host: host90-120.pool8536.interbusiness.it
85.36.120.90
| > | > | Lines: 1
| > | > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP09.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.performance:3700
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > | > |
| > | > | Hi Steven, thanks for your reply.
| > | > | The code is quite too long... I'll try to make it short to
see if
any
| > | > | advice is possible.
| > | > |
| > | > | I have this class
| > | > |
| > | > | [Serializable]
| > | > | public class Data
| > | > | {
| > | > | //Lot's of data.
| > | > | }
| > | > |
| > | > | I load in another appdomain an assembly. This assembly has a
class
| > with
| > | > | this public method
| > | > |
| > | > | class MyClass
| > | > | {
| > | > | //.....
| > | > | public Data PerformCalc(Data obj)
| > | > | {
| > | > | //Do some calculation using obj
| > | > | return(obj);
| > | > | }
| > | > | }
| > | > |
| > | > | Once I tryed deriving Data from MarshallByRef, but it took
far
too
| > long
| > | > | to compute singe all read/write on the data pass through the
| > trasparent
| > | > | proxy.
| > | > | So I pass the Data object by value and I return it. This way
I
| > thought
| > | > | that the only overhaead would have been the two
serialize/deserialize.
| > | > | Probably I was wrong.
| > | > |
| > | > | The non AppDomain version take a very short time to
compleate. We
are
| > in
| > | > | the order of 100ms. The AppDomain version take more than 3
seconds.
| > | > |
| > | > | Even so, I still think that this is too much time since the
| > calculation
| > | > | is performend in a function that does not comunicate with
other
| > | > AppDomains.
| > | > |
| > | > | Moreover, If I change the code this way
| > | > |
| > | > | class MyClass
| > | > | {
| > | > | //.....
| > | > | public Data PerformCalc()
| > | > | {
| > | > | Data obj=new Data();
| > | > | //Do some calculation using obj
| > | > | return(obj);
| > | > | }
| > | > | }
| > | > |
| > | > | The function is very fast!
| > | > | Moreover also this
| > | > |
| > | > | class MyClass
| > | > | {
| > | > | //.....
| > | > | public Data PerformCalc(Data obj)
| > | > | {
| > | > | //Do Nothing
| > | > | return(obj);
| > | > | }
| > | > | }
| > | > |
| > | > | if fast as well, so I think that the problem is not in the
function
| > | > | itself or in the serialize/deserialize of the data but with
the
data



Reply With Quote
  #12  
Old   
MoriCristian
 
Posts: n/a

Default Re: Performance Problem with AppDomains - 10-12-2005 , 06:55 PM






Hi Steven.
Sorry but I didn't fully understand your reply.
I tryed to use the BinaryFormatter inside the custom ISerializable
interface, but , I think, since the BinaryFormatter rely on the
serializzation, calling it on the same class will cause a recursive
operation. This is the problem I got.

Another question for you. I tryed to change the class so that it is no
longer serializable but it derive from MarshallByRefObject.

The situation is even worst! The same function now it is very very very
slow! I think this is due to the big amount of cross-appdomain calls done on
each chage.
What kind of remoting use the .NET framework on this situation? Is there a
way to speed up or not?

Thanks again!
Cristian Mori

"Steven Cheng[MSFT]" wrote:

Quote:
Hi Cristian,

Thanks for your response. For the Custom ISerializable interface, in the
GetObjectData method, generally, it will let us add the serilization data
of our class into the SerilizationInfo through AddValue method. For
example, which a class contains string, int and other type members, we can
only add some of them, as for string content, we can perform encoding and
compression on it. There is no means for us to convert a object instance
directly into byte array without use binaryFormatter , this is unlike in
c++. So what's your class's members, just byte array? If most of them are
string contents, we can perform encoding and compression on them. If only
binary datas, I'm afraid, we haven't any good means to compress them. Also,
to get byte[] from the object instance on the fly, we could only use the
BinaryFormatter inside our custom ISerializable interface.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security



--------------------
| Thread-Topic: Performance Problem with AppDomains
| thread-index: AcXLR9Xz5KAMQVh3RhG4L7YzFQDgYg==
| X-WBNR-Posting-Host: 85.36.120.90
| From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
| References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com
c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| Subject: Re: Performance Problem with AppDomains
| Date: Fri, 7 Oct 2005 07:03:04 -0700
| Lines: 326
| Message-ID: <94D4A41E-8BEE-4F74-B006-EA69C024F709 (AT) microsoft (DOT) com
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.performance
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.performance:3740
| X-Tomcat-NG: microsoft.public.dotnet.framework.performance
|
| Hi steven.
| Yeah, your advice proven to be precious.
| I'm trying to implement my own ISerializable using compression, but I
found
| a problem
|
| Implementing the GetObjectData, it would be usefull to get a byte array
| rappresenting the class, and Isually do so using this code
|
| System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter
formatter
| = new
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter();
| formatter.Serialize(buffer, this);
| Byte[] ByteObject=new Byte[buffer.Length];
| buffer.Read(ByteObject,0,buffer.Length]
|
| however, since I'm implementing my own ISerializable I cannot call
| formatter.Serializable since it would end up in a mess.
|
| Could you give me any other advice?
|
| Thanks
| Cristian Mori
|
| implementing the GlobalObjec
|
| "Steven Cheng[MSFT]" wrote:
|
| > Thanks for your followup Cristian,
|
| > So since you mentioned that your actual class will hold about 500kb
data,
| > I'm afraid this is really a big pressure for cross appdomain
communication.
| > Also, for class that apply the [Serializable] attribute, the .net
| > framework automatically determine the runtime serialize structure, we
| > haven't any particular means to improve it. If your data's structure
or
| > members is of particular type which can be compressed, you can consider
| > manually implement the ISerializable interface for your class.
|
| > Thanks,
|
| > Steven Cheng
| > Microsoft Online Support
|
| > Get Secure! www.microsoft.com/security
|
|
|
| > --------------------
| > | Date: Wed, 05 Oct 2005 12:02:50 +0200
| > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | X-Accept-Language: en-us, en
| > | MIME-Version: 1.0
| > | Subject: Re: Performance Problem with AppDomains
| > | References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
| > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | In-Reply-To: <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Message-ID: <uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
| > | Newsgroups: microsoft.public.dotnet.framework.performance
| > | NNTP-Posting-Host: host90-120.pool8536.interbusiness.it 85.36.120.90
| > | Lines: 1
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.performance:3726
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > |
| > | Hi Steven
| > | First of all thanks a lot for your time.
| > | I also performed similar testings, and I found out that the time
| > | comsuming is the serialization of the object. It take 780 millisecond
to
| > | serialize and deserialize in the other appdomain.
| > | The object is abount 500kbyte in size, so it's pretty big, but 780
| > | milliseconds are also a lot of time. Since every sycle this is
performed
| > | 5 times than we get 0,78*5 = 3,9 seconds. Exactly the difference in
time
| > | between the non-appdomain and appdomain version of the program.
| > |
| > | So, now the question move to : is there a way to perform a fast
| > | cross-domain serialization?
| > |
| > | Thanks
| > | Cristian
| > |
| > | Steven Cheng[MSFT] wrote:
| > | > Hi Cristian,
| > |
| > | > Sorry for keep you waiting. Since I've been involved in internal
| > certain
| > | > project, I have just managed to perform simple test. I create
simple
| > class
| > | > which has a three methods regarding on your description, like:
| > |
| > | > ===================
| > | > [Serializable]
| > | > public class MyData
| > | > {
| > | > public byte[] Bytes;
| > | > }
| > |
| > | > public class MyClass : MarshalByRefObject
| > | > {
| > | > public MyClass()
| > | > {
| > |
| > | > }
| > |
| > | > public MyData TestOne()
| > | > {
| > | > MyData md = new MyData();
| > |
| > | > byte[] bytes = new byte[1024*4];
| > | > for(int i=0;i<bytes.Length;i++)
| > | > {
| > | > bytes[i] = (byte)i;
| > | > }
| > |
| > | > md.Bytes = bytes;
| > |
| > | > return md;
| > | > }
| > |
| > |
| > | > public MyData TestTwo(MyData md1)
| > | > {
| > | > MyData md = new MyData();
| > |
| > | > byte[] bytes = new byte[1024*4];
| > | > for(int i=0;i<bytes.Length;i++)
| > | > {
| > | > bytes[i] = (byte)i;
| > | > }
| > |
| > | > md.Bytes = bytes;
| > |
| > | > return md;
| > | > }
| > |
| > | > public MyData TestThree(MyData md)
| > | > {
| > | > byte[] bytes = new byte[1024*4];
| > | > for(int i=0;i<bytes.Length;i++)
| > | > {
| > | > bytes[i] = (byte)i;
| > | > }
| > |
| > | > md.Bytes = bytes;
| > |
| > | > return md;
| > | > }
| > | > }
| > | > =======================
| > |
| > | > when calling the three method locally, all of them are very fast
and
| > | > consume nearly the same time span. When calling from remote (cross
| > | > appdomain), the result is also as I've expected, the "TestOne" is
| > fastest
| > | > since it dosn't require input paramter , and Method "TestTwo" and
| > | > "TestThree" takes almost the same timespan. Also, The difference
| > between
| > | > calling them locally and remotely dosn't like the one you mentioned
| > (from
| > | > milliseconds to seconds).
| > |
| > | > Anyway, I've attached my test code in this message, you can have
test
| > on
| > | > your side to see whether you get the same results.
| > |
| > | > Thanks,
| > |
| > | > Steven Cheng
| > | > Microsoft Online Support
| > |
| > | > Get Secure! www.microsoft.com/security
| > | > --------------------
| > | > | Date: Tue, 04 Oct 2005 10:28:41 +0200
| > | > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > | > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | > | X-Accept-Language: en-us, en
| > | > | MIME-Version: 1.0
| > | > | Subject: Re: Performance Problem with AppDomains
| > | > | References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
| > | > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > | > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > | > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > | In-Reply-To: <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Message-ID: <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > | > | Newsgroups: microsoft.public.dotnet.framework.performance
| > | > | NNTP-Posting-Host: host90-120.pool8536.interbusiness.it
85.36.120.90
| > | > | Lines: 1
| > | > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.performance:3710
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > | > |
| > | > | Hi Steven,
| > | > | do you have any news?
| > | > |
| > | > | Thanks
| > | > | Cristian Mori
| > | > |
| > | > | Steven Cheng[MSFT] wrote:
| > | > | > Thanks for your detailed response.
| > | > |
| > | > | > I'll have a look and perform some tests according to the code
| > snippets.
| > | > |
| > | > | > Steven Cheng
| > | > | > Microsoft Online Support
| > | > |
| > | > | > Get Secure! www.microsoft.com/security
| > | > | > (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | > | > rights.)
| > | > |
| > | > | > --------------------
| > | > | > | Date: Wed, 28 Sep 2005 10:35:35 +0200
| > | > | > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > | > | > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | > | > | X-Accept-Language: en-us, en
| > | > | > | MIME-Version: 1.0

Reply With Quote
  #13  
Old   
MoriCristian
 
Posts: n/a

Default Re: Performance Problem with AppDomains - 10-12-2005 , 07:12 PM



Another one.... this application is a port of another aplication that uses
COM... and even marshalling the object in com it was far more fast than this
version of the .NET remoting. Am I doing something wrong!?!??

Again, thanks
Cristian

"MoriCristian" wrote:

Quote:
Hi Steven.
Sorry but I didn't fully understand your reply.
I tryed to use the BinaryFormatter inside the custom ISerializable
interface, but , I think, since the BinaryFormatter rely on the
serializzation, calling it on the same class will cause a recursive
operation. This is the problem I got.

Another question for you. I tryed to change the class so that it is no
longer serializable but it derive from MarshallByRefObject.

The situation is even worst! The same function now it is very very very
slow! I think this is due to the big amount of cross-appdomain calls done on
each chage.
What kind of remoting use the .NET framework on this situation? Is there a
way to speed up or not?

Thanks again!
Cristian Mori

"Steven Cheng[MSFT]" wrote:

Hi Cristian,

Thanks for your response. For the Custom ISerializable interface, in the
GetObjectData method, generally, it will let us add the serilization data
of our class into the SerilizationInfo through AddValue method. For
example, which a class contains string, int and other type members, we can
only add some of them, as for string content, we can perform encoding and
compression on it. There is no means for us to convert a object instance
directly into byte array without use binaryFormatter , this is unlike in
c++. So what's your class's members, just byte array? If most of them are
string contents, we can perform encoding and compression on them. If only
binary datas, I'm afraid, we haven't any good means to compress them. Also,
to get byte[] from the object instance on the fly, we could only use the
BinaryFormatter inside our custom ISerializable interface.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security



--------------------
| Thread-Topic: Performance Problem with AppDomains
| thread-index: AcXLR9Xz5KAMQVh3RhG4L7YzFQDgYg==
| X-WBNR-Posting-Host: 85.36.120.90
| From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
| References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com
c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| Subject: Re: Performance Problem with AppDomains
| Date: Fri, 7 Oct 2005 07:03:04 -0700
| Lines: 326
| Message-ID: <94D4A41E-8BEE-4F74-B006-EA69C024F709 (AT) microsoft (DOT) com
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.performance
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.performance:3740
| X-Tomcat-NG: microsoft.public.dotnet.framework.performance
|
| Hi steven.
| Yeah, your advice proven to be precious.
| I'm trying to implement my own ISerializable using compression, but I
found
| a problem
|
| Implementing the GetObjectData, it would be usefull to get a byte array
| rappresenting the class, and Isually do so using this code
|
| System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter
formatter
| = new
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter();
| formatter.Serialize(buffer, this);
| Byte[] ByteObject=new Byte[buffer.Length];
| buffer.Read(ByteObject,0,buffer.Length]
|
| however, since I'm implementing my own ISerializable I cannot call
| formatter.Serializable since it would end up in a mess.
|
| Could you give me any other advice?
|
| Thanks
| Cristian Mori
|
| implementing the GlobalObjec
|
| "Steven Cheng[MSFT]" wrote:
|
| > Thanks for your followup Cristian,
|
| > So since you mentioned that your actual class will hold about 500kb
data,
| > I'm afraid this is really a big pressure for cross appdomain
communication.
| > Also, for class that apply the [Serializable] attribute, the .net
| > framework automatically determine the runtime serialize structure, we
| > haven't any particular means to improve it. If your data's structure
or
| > members is of particular type which can be compressed, you can consider
| > manually implement the ISerializable interface for your class.
|
| > Thanks,
|
| > Steven Cheng
| > Microsoft Online Support
|
| > Get Secure! www.microsoft.com/security
|
|
|
| > --------------------
| > | Date: Wed, 05 Oct 2005 12:02:50 +0200
| > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | X-Accept-Language: en-us, en
| > | MIME-Version: 1.0
| > | Subject: Re: Performance Problem with AppDomains
| > | References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
| > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | In-Reply-To: <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Message-ID: <uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
| > | Newsgroups: microsoft.public.dotnet.framework.performance
| > | NNTP-Posting-Host: host90-120.pool8536.interbusiness.it 85.36.120.90
| > | Lines: 1
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.performance:3726
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > |
| > | Hi Steven
| > | First of all thanks a lot for your time.
| > | I also performed similar testings, and I found out that the time
| > | comsuming is the serialization of the object. It take 780 millisecond
to
| > | serialize and deserialize in the other appdomain.
| > | The object is abount 500kbyte in size, so it's pretty big, but 780
| > | milliseconds are also a lot of time. Since every sycle this is
performed
| > | 5 times than we get 0,78*5 = 3,9 seconds. Exactly the difference in
time
| > | between the non-appdomain and appdomain version of the program.
| > |
| > | So, now the question move to : is there a way to perform a fast
| > | cross-domain serialization?
| > |
| > | Thanks
| > | Cristian
| > |
| > | Steven Cheng[MSFT] wrote:
| > | > Hi Cristian,
| > |
| > | > Sorry for keep you waiting. Since I've been involved in internal
| > certain
| > | > project, I have just managed to perform simple test. I create
simple
| > class
| > | > which has a three methods regarding on your description, like:
| > |
| > | > ===================
| > | > [Serializable]
| > | > public class MyData
| > | > {
| > | > public byte[] Bytes;
| > | > }
| > |
| > | > public class MyClass : MarshalByRefObject
| > | > {
| > | > public MyClass()
| > | > {
| > |
| > | > }
| > |
| > | > public MyData TestOne()
| > | > {
| > | > MyData md = new MyData();
| > |
| > | > byte[] bytes = new byte[1024*4];
| > | > for(int i=0;i<bytes.Length;i++)
| > | > {
| > | > bytes[i] = (byte)i;
| > | > }
| > |
| > | > md.Bytes = bytes;
| > |
| > | > return md;
| > | > }
| > |
| > |
| > | > public MyData TestTwo(MyData md1)
| > | > {
| > | > MyData md = new MyData();
| > |
| > | > byte[] bytes = new byte[1024*4];
| > | > for(int i=0;i<bytes.Length;i++)
| > | > {
| > | > bytes[i] = (byte)i;
| > | > }
| > |
| > | > md.Bytes = bytes;
| > |
| > | > return md;
| > | > }
| > |
| > | > public MyData TestThree(MyData md)
| > | > {
| > | > byte[] bytes = new byte[1024*4];
| > | > for(int i=0;i<bytes.Length;i++)
| > | > {
| > | > bytes[i] = (byte)i;
| > | > }
| > |
| > | > md.Bytes = bytes;
| > |
| > | > return md;
| > | > }
| > | > }
| > | > =======================
| > |
| > | > when calling the three method locally, all of them are very fast
and
| > | > consume nearly the same time span. When calling from remote (cross
| > | > appdomain), the result is also as I've expected, the "TestOne" is
| > fastest
| > | > since it dosn't require input paramter , and Method "TestTwo" and
| > | > "TestThree" takes almost the same timespan. Also, The difference
| > between
| > | > calling them locally and remotely dosn't like the one you mentioned
| > (from
| > | > milliseconds to seconds).
| > |
| > | > Anyway, I've attached my test code in this message, you can have
test
| > on
| > | > your side to see whether you get the same results.
| > |
| > | > Thanks,
| > |
| > | > Steven Cheng
| > | > Microsoft Online Support
| > |
| > | > Get Secure! www.microsoft.com/security
| > | > --------------------
| > | > | Date: Tue, 04 Oct 2005 10:28:41 +0200
| > | > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > | > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | > | X-Accept-Language: en-us, en
| > | > | MIME-Version: 1.0
| > | > | Subject: Re: Performance Problem with AppDomains
| > | > | References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
| > | > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > | > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > | > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > | In-Reply-To: <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Message-ID: <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > | > | Newsgroups: microsoft.public.dotnet.framework.performance
| > | > | NNTP-Posting-Host: host90-120.pool8536.interbusiness.it
85.36.120.90
| > | > | Lines: 1
| > | > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.performance:3710
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > | > |
| > | > | Hi Steven,
| > | > | do you have any news?
| > | > |
| > | > | Thanks
| > | > | Cristian Mori
| > | > |

Reply With Quote
  #14  
Old   
AT
 
Posts: n/a

Default Re: Performance Problem with AppDomains - 10-13-2005 , 06:56 AM



Thanks for your response Cristian,

As for the binary formatter, of course we can not direclty call it on the
object itself. Since we are manually control the serlization, we can
directory use it on our custom object's member objects/ fields. Also,
MarshalByRef is not possible since that'll cause more time on cross
boundary reference management. What does your custom object currently hold
that occupy the main size? String or nested custom class instances?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
Quote:
Thread-Topic: Performance Problem with AppDomains
thread-index: AcXPgltKhgp3OkrjRUqvlAWaAqdYSA==
X-WBNR-Posting-Host: 81.208.74.179
From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com
<c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl>
<#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl>
<VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl>
<rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<94D4A41E-8BEE-4F74-B006-EA69C024F709 (AT) microsoft (DOT) com>
<TYLyReWzFHA.3928 (AT) TK2MSFTNGXA02 (DOT) phx.gbl>
<42E1F185-B68C-4359-A89A-9E40B603A239 (AT) microsoft (DOT) com>
Quote:
Subject: Re: Performance Problem with AppDomains
Date: Wed, 12 Oct 2005 16:12:03 -0700
Lines: 309
Message-ID: <8FC87FAC-214B-45C9-A6CC-0BEBDAD40AD6 (AT) microsoft (DOT) com
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.performance
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.performance:3760
X-Tomcat-NG: microsoft.public.dotnet.framework.performance

Another one.... this application is a port of another aplication that
uses
COM... and even marshalling the object in com it was far more fast than
this
version of the .NET remoting. Am I doing something wrong!?!??

Again, thanks
Cristian

"MoriCristian" wrote:

Hi Steven.
Sorry but I didn't fully understand your reply.
I tryed to use the BinaryFormatter inside the custom ISerializable
interface, but , I think, since the BinaryFormatter rely on the
serializzation, calling it on the same class will cause a recursive
operation. This is the problem I got.

Another question for you. I tryed to change the class so that it is no
longer serializable but it derive from MarshallByRefObject.

The situation is even worst! The same function now it is very very very
slow! I think this is due to the big amount of cross-appdomain calls
done on
each chage.
What kind of remoting use the .NET framework on this situation? Is
there a
way to speed up or not?

Thanks again!
Cristian Mori

"Steven Cheng[MSFT]" wrote:

Hi Cristian,

Thanks for your response. For the Custom ISerializable interface, in
the
GetObjectData method, generally, it will let us add the serilization
data
of our class into the SerilizationInfo through AddValue method. For
example, which a class contains string, int and other type members,
we can
only add some of them, as for string content, we can perform encoding
and
compression on it. There is no means for us to convert a object
instance
directly into byte array without use binaryFormatter , this is unlike
in
c++. So what's your class's members, just byte array? If most of
them are
string contents, we can perform encoding and compression on them. If
only
binary datas, I'm afraid, we haven't any good means to compress them.
Also,
to get byte[] from the object instance on the fly, we could only use
the
BinaryFormatter inside our custom ISerializable interface.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security



--------------------
| Thread-Topic: Performance Problem with AppDomains
| thread-index: AcXLR9Xz5KAMQVh3RhG4L7YzFQDgYg==
| X-WBNR-Posting-Host: 85.36.120.90
| From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
| References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com
c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| Subject: Re: Performance Problem with AppDomains
| Date: Fri, 7 Oct 2005 07:03:04 -0700
| Lines: 326
| Message-ID: <94D4A41E-8BEE-4F74-B006-EA69C024F709 (AT) microsoft (DOT) com
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.performance
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.performance:3740
| X-Tomcat-NG: microsoft.public.dotnet.framework.performance
|
| Hi steven.
| Yeah, your advice proven to be precious.
| I'm trying to implement my own ISerializable using compression, but
I
found
| a problem
|
| Implementing the GetObjectData, it would be usefull to get a byte
array
| rappresenting the class, and Isually do so using this code
|
| System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter
formatter
| = new
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter();
| formatter.Serialize(buffer, this);
| Byte[] ByteObject=new Byte[buffer.Length];
| buffer.Read(ByteObject,0,buffer.Length]
|
| however, since I'm implementing my own ISerializable I cannot call
| formatter.Serializable since it would end up in a mess.
|
| Could you give me any other advice?
|
| Thanks
| Cristian Mori
|
| implementing the GlobalObjec
|
| "Steven Cheng[MSFT]" wrote:
|
| > Thanks for your followup Cristian,
|
| > So since you mentioned that your actual class will hold about
500kb
data,
| > I'm afraid this is really a big pressure for cross appdomain
communication.
| > Also, for class that apply the [Serializable] attribute, the
..net
| > framework automatically determine the runtime serialize
structure, we
| > haven't any particular means to improve it. If your data's
structure
or
| > members is of particular type which can be compressed, you can
consider
| > manually implement the ISerializable interface for your class.
|
| > Thanks,
|
| > Steven Cheng
| > Microsoft Online Support
|
| > Get Secure! www.microsoft.com/security
|
|
|
| > --------------------
| > | Date: Wed, 05 Oct 2005 12:02:50 +0200
| > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | X-Accept-Language: en-us, en
| > | MIME-Version: 1.0
| > | Subject: Re: Performance Problem with AppDomains
| > | References:
25E92219-89DA-4229-8ECB-8738E2522C32...soft (DOT) com
| > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | In-Reply-To: <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > | Content-Transfer-Encoding: 7bit
| > | Message-ID: <uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
| > | Newsgroups: microsoft.public.dotnet.framework.performance
| > | NNTP-Posting-Host: host90-120.pool8536.interbusiness.it
85.36.120.90
| > | Lines: 1
| > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.performance:3726
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > |
| > | Hi Steven
| > | First of all thanks a lot for your time.
| > | I also performed similar testings, and I found out that the
time
| > | comsuming is the serialization of the object. It take 780
millisecond
to
| > | serialize and deserialize in the other appdomain.
| > | The object is abount 500kbyte in size, so it's pretty big, but
780
| > | milliseconds are also a lot of time. Since every sycle this is
performed
| > | 5 times than we get 0,78*5 = 3,9 seconds. Exactly the
difference in
time
| > | between the non-appdomain and appdomain version of the program.
| > |
| > | So, now the question move to : is there a way to perform a fast
| > | cross-domain serialization?
| > |
| > | Thanks
| > | Cristian
| > |
| > | Steven Cheng[MSFT] wrote:
| > | > Hi Cristian,
| > |
| > | > Sorry for keep you waiting. Since I've been involved in
internal
| > certain
| > | > project, I have just managed to perform simple test. I create
simple
| > class
| > | > which has a three methods regarding on your description, like:
| > |
| > | > ===================
| > | > [Serializable]
| > | > public class MyData
| > | > {
| > | > public byte[] Bytes;
| > | > }
| > |
| > | > public class MyClass : MarshalByRefObject
| > | > {
| > | > public MyClass()
| > | > {
| > |
| > | > }
| > |
| > | > public MyData TestOne()
| > | > {
| > | > MyData md = new MyData();
| > |
| > | > byte[] bytes = new byte[1024*4];
| > | > for(int i=0;i<bytes.Length;i++)
| > | > {
| > | > bytes[i] = (byte)i;
| > | > }
| > |
| > | > md.Bytes = bytes;
| > |
| > | > return md;
| > | > }
| > |
| > |
| > | > public MyData TestTwo(MyData md1)
| > | > {
| > | > MyData md = new MyData();
| > |
| > | > byte[] bytes = new byte[1024*4];
| > | > for(int i=0;i<bytes.Length;i++)
| > | > {
| > | > bytes[i] = (byte)i;
| > | > }
| > |
| > | > md.Bytes = bytes;
| > |
| > | > return md;
| > | > }
| > |
| > | > public MyData TestThree(MyData md)
| > | > {
| > | > byte[] bytes = new byte[1024*4];
| > | > for(int i=0;i<bytes.Length;i++)
| > | > {
| > | > bytes[i] = (byte)i;
| > | > }
| > |
| > | > md.Bytes = bytes;
| > |
| > | > return md;
| > | > }
| > | > }
| > | > =======================
| > |
| > | > when calling the three method locally, all of them are very
fast
and
| > | > consume nearly the same time span. When calling from remote
(cross
| > | > appdomain), the result is also as I've expected, the
"TestOne" is
| > fastest
| > | > since it dosn't require input paramter , and Method "TestTwo"
and
| > | > "TestThree" takes almost the same timespan. Also, The
difference
| > between
| > | > calling them locally and remotely dosn't like the one you
mentioned
| > (from
| > | > milliseconds to seconds).
| > |
| > | > Anyway, I've attached my test code in this message, you can
have
test
| > on
| > | > your side to see whether you get the same results.
| > |
| > | > Thanks,
| > |
| > | > Steven Cheng
| > | > Microsoft Online Support
| > |
| > | > Get Secure! www.microsoft.com/security
| > | > --------------------
| > | > | Date: Tue, 04 Oct 2005 10:28:41 +0200
| > | > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > | > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > | > | X-Accept-Language: en-us, en
| > | > | MIME-Version: 1.0
| > | > | Subject: Re: Performance Problem with AppDomains
| > | > | References:
25E92219-89DA-4229-8ECB-8738E2522C32...soft (DOT) com
| > | > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > | > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > | > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > | In-Reply-To: <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > | > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > | > | Content-Transfer-Encoding: 7bit
| > | > | Message-ID: <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > | > | Newsgroups: microsoft.public.dotnet.framework.performance
| > | > | NNTP-Posting-Host: host90-120.pool8536.interbusiness.it
85.36.120.90
| > | > | Lines: 1
| > | > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > | > microsoft.public.dotnet.framework.performance:3710
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > | > |
| > | > | Hi Steven,
| > | > | do you have any news?
| > | > |
| > | > | Thanks
| > | > | Cristian Mori
| > | > |



Reply With Quote
  #15  
Old   
MoriCristian
 
Posts: n/a

Default Re: Performance Problem with AppDomains - 10-13-2005 , 08:21 AM



It hold several nested custom class instance

"Steven Cheng[MSFT]" wrote:

Quote:
Thanks for your response Cristian,

As for the binary formatter, of course we can not direclty call it on the
object itself. Since we are manually control the serlization, we can
directory use it on our custom object's member objects/ fields. Also,
MarshalByRef is not possible since that'll cause more time on cross
boundary reference management. What does your custom object currently hold
that occupy the main size? String or nested custom class instances?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| Thread-Topic: Performance Problem with AppDomains
| thread-index: AcXPgltKhgp3OkrjRUqvlAWaAqdYSA==
| X-WBNR-Posting-Host: 81.208.74.179
| From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
| References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com
c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
94D4A41E-8BEE-4F74-B006-EA69C024F709...soft (DOT) com
TYLyReWzFHA.3928 (AT) TK2MSFTNGXA02 (DOT) phx.gbl
42E1F185-B68C-4359-A89A-9E40B603A239...soft (DOT) com
| Subject: Re: Performance Problem with AppDomains
| Date: Wed, 12 Oct 2005 16:12:03 -0700
| Lines: 309
| Message-ID: <8FC87FAC-214B-45C9-A6CC-0BEBDAD40AD6 (AT) microsoft (DOT) com
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.performance
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.performance:3760
| X-Tomcat-NG: microsoft.public.dotnet.framework.performance
|
| Another one.... this application is a port of another aplication that
uses
| COM... and even marshalling the object in com it was far more fast than
this
| version of the .NET remoting. Am I doing something wrong!?!??
|
| Again, thanks
| Cristian
|
| "MoriCristian" wrote:
|
| > Hi Steven.
| > Sorry but I didn't fully understand your reply.
| > I tryed to use the BinaryFormatter inside the custom ISerializable
| > interface, but , I think, since the BinaryFormatter rely on the
| > serializzation, calling it on the same class will cause a recursive
| > operation. This is the problem I got.
|
| > Another question for you. I tryed to change the class so that it is no
| > longer serializable but it derive from MarshallByRefObject.
|
| > The situation is even worst! The same function now it is very very very
| > slow! I think this is due to the big amount of cross-appdomain calls
done on
| > each chage.
| > What kind of remoting use the .NET framework on this situation? Is
there a
| > way to speed up or not?
|
| > Thanks again!
| > Cristian Mori
|
| > "Steven Cheng[MSFT]" wrote:
|
| > > Hi Cristian,
|
| > > Thanks for your response. For the Custom ISerializable interface, in
the
| > > GetObjectData method, generally, it will let us add the serilization
data
| > > of our class into the SerilizationInfo through AddValue method. For
| > > example, which a class contains string, int and other type members,
we can
| > > only add some of them, as for string content, we can perform encoding
and
| > > compression on it. There is no means for us to convert a object
instance
| > > directly into byte array without use binaryFormatter , this is unlike
in
| > > c++. So what's your class's members, just byte array? If most of
them are
| > > string contents, we can perform encoding and compression on them. If
only
| > > binary datas, I'm afraid, we haven't any good means to compress them.
Also,
| > > to get byte[] from the object instance on the fly, we could only use
the
| > > BinaryFormatter inside our custom ISerializable interface.
|
| > > Thanks,
|
| > > Steven Cheng
| > > Microsoft Online Support
|
| > > Get Secure! www.microsoft.com/security
|
|
|
| > > --------------------
| > > | Thread-Topic: Performance Problem with AppDomains
| > > | thread-index: AcXLR9Xz5KAMQVh3RhG4L7YzFQDgYg==
| > > | X-WBNR-Posting-Host: 85.36.120.90
| > > | From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
| > > | References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
| > > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > > <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > <uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
| > > <rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > | Subject: Re: Performance Problem with AppDomains
| > > | Date: Fri, 7 Oct 2005 07:03:04 -0700
| > > | Lines: 326
| > > | Message-ID: <94D4A41E-8BEE-4F74-B006-EA69C024F709 (AT) microsoft (DOT) com
| > > | MIME-Version: 1.0
| > > | Content-Type: text/plain;
| > > | charset="Utf-8"
| > > | Content-Transfer-Encoding: 7bit
| > > | X-Newsreader: Microsoft CDO for Windows 2000
| > > | Content-Class: urn:content-classes:message
| > > | Importance: normal
| > > | Priority: normal
| > > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > > | Newsgroups: microsoft.public.dotnet.framework.performance
| > > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > > | Xref: TK2MSFTNGXA01.phx.gbl
| > > microsoft.public.dotnet.framework.performance:3740
| > > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > > |
| > > | Hi steven.
| > > | Yeah, your advice proven to be precious.
| > > | I'm trying to implement my own ISerializable using compression, but
I
| > > found
| > > | a problem
| > > |
| > > | Implementing the GetObjectData, it would be usefull to get a byte
array
| > > | rappresenting the class, and Isually do so using this code
| > > |
| > > | System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter
| > > formatter
| > > | = new
| > > System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter();
| > > | formatter.Serialize(buffer, this);
| > > | Byte[] ByteObject=new Byte[buffer.Length];
| > > | buffer.Read(ByteObject,0,buffer.Length]
| > > |
| > > | however, since I'm implementing my own ISerializable I cannot call
| > > | formatter.Serializable since it would end up in a mess.
| > > |
| > > | Could you give me any other advice?
| > > |
| > > | Thanks
| > > | Cristian Mori
| > > |
| > > | implementing the GlobalObjec
| > > |
| > > | "Steven Cheng[MSFT]" wrote:
| > > |
| > > | > Thanks for your followup Cristian,
| > > |
| > > | > So since you mentioned that your actual class will hold about
500kb
| > > data,
| > > | > I'm afraid this is really a big pressure for cross appdomain
| > > communication.
| > > | > Also, for class that apply the [Serializable] attribute, the
.net
| > > | > framework automatically determine the runtime serialize
structure, we
| > > | > haven't any particular means to improve it. If your data's
structure
| > > or
| > > | > members is of particular type which can be compressed, you can
consider
| > > | > manually implement the ISerializable interface for your class.
| > > |
| > > | > Thanks,
| > > |
| > > | > Steven Cheng
| > > | > Microsoft Online Support
| > > |
| > > | > Get Secure! www.microsoft.com/security
| > > |
| > > |
| > > |
| > > | > --------------------
| > > | > | Date: Wed, 05 Oct 2005 12:02:50 +0200
| > > | > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > > | > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > > | > | X-Accept-Language: en-us, en
| > > | > | MIME-Version: 1.0
| > > | > | Subject: Re: Performance Problem with AppDomains
| > > | > | References:
25E92219-89DA-4229-8ECB-8738E2522C32...soft (DOT) com
| > > | > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > > | > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > | > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > > | > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > | > <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > > | > <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > | > | In-Reply-To: <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > | > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > > | > | Content-Transfer-Encoding: 7bit
| > > | > | Message-ID: <uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
| > > | > | Newsgroups: microsoft.public.dotnet.framework.performance
| > > | > | NNTP-Posting-Host: host90-120.pool8536.interbusiness.it
85.36.120.90
| > > | > | Lines: 1
| > > | > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| > > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > > | > microsoft.public.dotnet.framework.performance:3726
| > > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > > | > |
| > > | > | Hi Steven
| > > | > | First of all thanks a lot for your time.
| > > | > | I also performed similar testings, and I found out that the
time
| > > | > | comsuming is the serialization of the object. It take 780
millisecond
| > > to
| > > | > | serialize and deserialize in the other appdomain.
| > > | > | The object is abount 500kbyte in size, so it's pretty big, but
780
| > > | > | milliseconds are also a lot of time. Since every sycle this is
| > > performed
| > > | > | 5 times than we get 0,78*5 = 3,9 seconds. Exactly the
difference in
| > > time
| > > | > | between the non-appdomain and appdomain version of the program.
| > > | > |
| > > | > | So, now the question move to : is there a way to perform a fast
| > > | > | cross-domain serialization?
| > > | > |
| > > | > | Thanks
| > > | > | Cristian
| > > | > |
| > > | > | Steven Cheng[MSFT] wrote:
| > > | > | > Hi Cristian,
| > > | > |
| > > | > | > Sorry for keep you waiting. Since I've been involved in
internal
| > > | > certain
| > > | > | > project, I have just managed to perform simple test. I create
| > > simple
| > > | > class
| > > | > | > which has a three methods regarding on your description, like:
| > > | > |
| > > | > | > ===================
| > > | > | > [Serializable]
| > > | > | > public class MyData
| > > | > | > {
| > > | > | > public byte[] Bytes;
| > > | > | > }
| > > | > |
| > > | > | > public class MyClass : MarshalByRefObject
| > > | > | > {
| > > | > | > public MyClass()
| > > | > | > {
| > > | > |
| > > | > | > }
| > > | > |
| > > | > | > public MyData TestOne()
| > > | > | > {
| > > | > | > MyData md = new MyData();
| > > | > |
| > > | > | > byte[] bytes = new byte[1024*4];

Reply With Quote
  #16  
Old   
AT
 
Posts: n/a

Default Re: Performance Problem with AppDomains - 10-14-2005 , 01:51 AM



if so, we should locate one of the nested class member which occupy the
most size. Also, what's the type of the data that comsume the most memory?
Anyway, to convert class instance into memory, we could not but utilize the
binaryfomatter since .NET dosn't support random access on raw memory of the
object instances.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
Quote:
Thread-Topic: Performance Problem with AppDomains
thread-index: AcXP8JRybeyXbIGqQMahYtrtOkYSvA==
X-WBNR-Posting-Host: 81.208.74.179
From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com
<c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl>
<#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl>
<VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl>
<rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
<94D4A41E-8BEE-4F74-B006-EA69C024F709 (AT) microsoft (DOT) com>
<TYLyReWzFHA.3928 (AT) TK2MSFTNGXA02 (DOT) phx.gbl>
<42E1F185-B68C-4359-A89A-9E40B603A239 (AT) microsoft (DOT) com>
<8FC87FAC-214B-45C9-A6CC-0BEBDAD40AD6 (AT) microsoft (DOT) com>
<H3TmBT#zFHA.1172 (AT) TK2MSFTNGXA01 (DOT) phx.gbl>
Quote:
Subject: Re: Performance Problem with AppDomains
Date: Thu, 13 Oct 2005 05:21:03 -0700
Lines: 304
Message-ID: <6DE5AFA7-EAD3-4BDC-A996-BAB98CAAB970 (AT) microsoft (DOT) com
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.performance
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.performance:3766
X-Tomcat-NG: microsoft.public.dotnet.framework.performance

It hold several nested custom class instance

"Steven Cheng[MSFT]" wrote:

Thanks for your response Cristian,

As for the binary formatter, of course we can not direclty call it on
the
object itself. Since we are manually control the serlization, we can
directory use it on our custom object's member objects/ fields. Also,
MarshalByRef is not possible since that'll cause more time on cross
boundary reference management. What does your custom object currently
hold
that occupy the main size? String or nested custom class instances?

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| Thread-Topic: Performance Problem with AppDomains
| thread-index: AcXPgltKhgp3OkrjRUqvlAWaAqdYSA==
| X-WBNR-Posting-Host: 81.208.74.179
| From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
| References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com
c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
94D4A41E-8BEE-4F74-B006-EA69C024F709...soft (DOT) com
TYLyReWzFHA.3928 (AT) TK2MSFTNGXA02 (DOT) phx.gbl
42E1F185-B68C-4359-A89A-9E40B603A239...soft (DOT) com
| Subject: Re: Performance Problem with AppDomains
| Date: Wed, 12 Oct 2005 16:12:03 -0700
| Lines: 309
| Message-ID: <8FC87FAC-214B-45C9-A6CC-0BEBDAD40AD6 (AT) microsoft (DOT) com
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.performance
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.performance:3760
| X-Tomcat-NG: microsoft.public.dotnet.framework.performance
|
| Another one.... this application is a port of another aplication that
uses
| COM... and even marshalling the object in com it was far more fast
than
this
| version of the .NET remoting. Am I doing something wrong!?!??
|
| Again, thanks
| Cristian
|
| "MoriCristian" wrote:
|
| > Hi Steven.
| > Sorry but I didn't fully understand your reply.
| > I tryed to use the BinaryFormatter inside the custom ISerializable
| > interface, but , I think, since the BinaryFormatter rely on the
| > serializzation, calling it on the same class will cause a recursive
| > operation. This is the problem I got.
|
| > Another question for you. I tryed to change the class so that it is
no
| > longer serializable but it derive from MarshallByRefObject.
|
| > The situation is even worst! The same function now it is very very
very
| > slow! I think this is due to the big amount of cross-appdomain
calls
done on
| > each chage.
| > What kind of remoting use the .NET framework on this situation? Is
there a
| > way to speed up or not?
|
| > Thanks again!
| > Cristian Mori
|
| > "Steven Cheng[MSFT]" wrote:
|
| > > Hi Cristian,
|
| > > Thanks for your response. For the Custom ISerializable interface,
in
the
| > > GetObjectData method, generally, it will let us add the
serilization
data
| > > of our class into the SerilizationInfo through AddValue method.
For
| > > example, which a class contains string, int and other type
members,
we can
| > > only add some of them, as for string content, we can perform
encoding
and
| > > compression on it. There is no means for us to convert a object
instance
| > > directly into byte array without use binaryFormatter , this is
unlike
in
| > > c++. So what's your class's members, just byte array? If most of
them are
| > > string contents, we can perform encoding and compression on them.
If
only
| > > binary datas, I'm afraid, we haven't any good means to compress
them.
Also,
| > > to get byte[] from the object instance on the fly, we could only
use
the
| > > BinaryFormatter inside our custom ISerializable interface.
|
| > > Thanks,
|
| > > Steven Cheng
| > > Microsoft Online Support
|
| > > Get Secure! www.microsoft.com/security
|
|
|
| > > --------------------
| > > | Thread-Topic: Performance Problem with AppDomains
| > > | thread-index: AcXLR9Xz5KAMQVh3RhG4L7YzFQDgYg==
| > > | X-WBNR-Posting-Host: 85.36.120.90
| > > | From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
| > > | References:
25E92219-89DA-4229-8ECB-8738E2522C32...soft (DOT) com
| > > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > > <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > <uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
| > > <rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > | Subject: Re: Performance Problem with AppDomains
| > > | Date: Fri, 7 Oct 2005 07:03:04 -0700
| > > | Lines: 326
| > > | Message-ID: <94D4A41E-8BEE-4F74-B006-EA69C024F709 (AT) microsoft (DOT) com
| > > | MIME-Version: 1.0
| > > | Content-Type: text/plain;
| > > | charset="Utf-8"
| > > | Content-Transfer-Encoding: 7bit
| > > | X-Newsreader: Microsoft CDO for Windows 2000
| > > | Content-Class: urn:content-classes:message
| > > | Importance: normal
| > > | Priority: normal
| > > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > > | Newsgroups: microsoft.public.dotnet.framework.performance
| > > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > > | Xref: TK2MSFTNGXA01.phx.gbl
| > > microsoft.public.dotnet.framework.performance:3740
| > > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > > |
| > > | Hi steven.
| > > | Yeah, your advice proven to be precious.
| > > | I'm trying to implement my own ISerializable using compression,
but
I
| > > found
| > > | a problem
| > > |
| > > | Implementing the GetObjectData, it would be usefull to get a
byte
array
| > > | rappresenting the class, and Isually do so using this code
| > > |
| > > |
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter
| > > formatter
| > > | = new
| > > System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter();
| > > | formatter.Serialize(buffer, this);
| > > | Byte[] ByteObject=new Byte[buffer.Length];
| > > | buffer.Read(ByteObject,0,buffer.Length]
| > > |
| > > | however, since I'm implementing my own ISerializable I cannot
call
| > > | formatter.Serializable since it would end up in a mess.
| > > |
| > > | Could you give me any other advice?
| > > |
| > > | Thanks
| > > | Cristian Mori
| > > |
| > > | implementing the GlobalObjec
| > > |
| > > | "Steven Cheng[MSFT]" wrote:
| > > |
| > > | > Thanks for your followup Cristian,
| > > |
| > > | > So since you mentioned that your actual class will hold about
500kb
| > > data,
| > > | > I'm afraid this is really a big pressure for cross appdomain
| > > communication.
| > > | > Also, for class that apply the [Serializable] attribute,
the
.net
| > > | > framework automatically determine the runtime serialize
structure, we
| > > | > haven't any particular means to improve it. If your data's
structure
| > > or
| > > | > members is of particular type which can be compressed, you
can
consider
| > > | > manually implement the ISerializable interface for your
class.
| > > |
| > > | > Thanks,
| > > |
| > > | > Steven Cheng
| > > | > Microsoft Online Support
| > > |
| > > | > Get Secure! www.microsoft.com/security
| > > |
| > > |
| > > |
| > > | > --------------------
| > > | > | Date: Wed, 05 Oct 2005 12:02:50 +0200
| > > | > | From: MoriCristian <CristianMori (AT) nospam (DOT) nospam
| > > | > | User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
| > > | > | X-Accept-Language: en-us, en
| > > | > | MIME-Version: 1.0
| > > | > | Subject: Re: Performance Problem with AppDomains
| > > | > | References:
25E92219-89DA-4229-8ECB-8738E2522C32...soft (DOT) com
| > > | > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > > | > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > | > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > > | > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > | > <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > > | > <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > | > | In-Reply-To: <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > > | > | Content-Type: text/plain; charset=ISO-8859-1; format=flowed
| > > | > | Content-Transfer-Encoding: 7bit
| > > | > | Message-ID: <uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
| > > | > | Newsgroups: microsoft.public.dotnet.framework.performance
| > > | > | NNTP-Posting-Host: host90-120.pool8536.interbusiness.it
85.36.120.90
| > > | > | Lines: 1
| > > | > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
| > > | > | Xref: TK2MSFTNGXA01.phx.gbl
| > > | > microsoft.public.dotnet.framework.performance:3726
| > > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > > | > |
| > > | > | Hi Steven
| > > | > | First of all thanks a lot for your time.
| > > | > | I also performed similar testings, and I found out that the
time
| > > | > | comsuming is the serialization of the object. It take 780
millisecond
| > > to
| > > | > | serialize and deserialize in the other appdomain.
| > > | > | The object is abount 500kbyte in size, so it's pretty big,
but
780
| > > | > | milliseconds are also a lot of time. Since every sycle this
is
| > > performed
| > > | > | 5 times than we get 0,78*5 = 3,9 seconds. Exactly the
difference in
| > > time
| > > | > | between the non-appdomain and appdomain version of the
program.
| > > | > |
| > > | > | So, now the question move to : is there a way to perform a
fast
| > > | > | cross-domain serialization?
| > > | > |
| > > | > | Thanks
| > > | > | Cristian
| > > | > |
| > > | > | Steven Cheng[MSFT] wrote:
| > > | > | > Hi Cristian,
| > > | > |
| > > | > | > Sorry for keep you waiting. Since I've been involved in
internal
| > > | > certain
| > > | > | > project, I have just managed to perform simple test. I
create
| > > simple
| > > | > class
| > > | > | > which has a three methods regarding on your description,
like:
| > > | > |
| > > | > | > ===================
| > > | > | > [Serializable]
| > > | > | > public class MyData
| > > | > | > {
| > > | > | > public byte[] Bytes;
| > > | > | > }
| > > | > |
| > > | > | > public class MyClass : MarshalByRefObject
| > > | > | > {
| > > | > | > public MyClass()
| > > | > | > {
| > > | > |
| > > | > | > }
| > > | > |
| > > | > | > public MyData TestOne()
| > > | > | > {
| > > | > | > MyData md = new MyData();
| > > | > |
| > > | > | > byte[] bytes = new byte[1024*4];



Reply With Quote
  #17  
Old   
MoriCristian
 
Posts: n/a

Default Re: Performance Problem with AppDomains - 10-14-2005 , 02:16 AM



They are almost the same size...
anyway, I tryed to use the binaryFormatter on each of them, compress them
using a commercial zip library that we own, use the compressed byte[] as
serializzation data and deserialize/decompress on the other side.
The data sent are a lot less, about 60000 byte, but the
compression/decompression time plus the serialize/deserialize is the same as
serializing the whole class!.
When we used COM we didn't had all those performace issues!
And all this stuff is just because I need to unload an assembly and reload
it at runtime, but since a single assembly can't be unloaded I need to create
an AppDomain where to load the assembly and the unload it when needed.

Any other ideas?

Thanks
Cristian Mori


"Steven Cheng[MSFT]" wrote:

Quote:
if so, we should locate one of the nested class member which occupy the
most size. Also, what's the type of the data that comsume the most memory?
Anyway, to convert class instance into memory, we could not but utilize the
binaryfomatter since .NET dosn't support random access on raw memory of the
object instances.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| Thread-Topic: Performance Problem with AppDomains
| thread-index: AcXP8JRybeyXbIGqQMahYtrtOkYSvA==
| X-WBNR-Posting-Host: 81.208.74.179
| From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
| References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com
c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
94D4A41E-8BEE-4F74-B006-EA69C024F709...soft (DOT) com
TYLyReWzFHA.3928 (AT) TK2MSFTNGXA02 (DOT) phx.gbl
42E1F185-B68C-4359-A89A-9E40B603A239...soft (DOT) com
8FC87FAC-214B-45C9-A6CC-0BEBDAD40AD6...soft (DOT) com
H3TmBT#zFHA.1172 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| Subject: Re: Performance Problem with AppDomains
| Date: Thu, 13 Oct 2005 05:21:03 -0700
| Lines: 304
| Message-ID: <6DE5AFA7-EAD3-4BDC-A996-BAB98CAAB970 (AT) microsoft (DOT) com
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.performance
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.performance:3766
| X-Tomcat-NG: microsoft.public.dotnet.framework.performance
|
| It hold several nested custom class instance
|
| "Steven Cheng[MSFT]" wrote:
|
| > Thanks for your response Cristian,
|
| > As for the binary formatter, of course we can not direclty call it on
the
| > object itself. Since we are manually control the serlization, we can
| > directory use it on our custom object's member objects/ fields. Also,
| > MarshalByRef is not possible since that'll cause more time on cross
| > boundary reference management. What does your custom object currently
hold
| > that occupy the main size? String or nested custom class instances?
|
| > Thanks,
|
| > Steven Cheng
| > Microsoft Online Support
|
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
|
|
|
|
| > --------------------
| > | Thread-Topic: Performance Problem with AppDomains
| > | thread-index: AcXPgltKhgp3OkrjRUqvlAWaAqdYSA==
| > | X-WBNR-Posting-Host: 81.208.74.179
| > | From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= <CristianMori (AT) nospam (DOT) nospam
| > | References: <25E92219-89DA-4229-8ECB-8738E2522C32 (AT) microsoft (DOT) com
| > <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (AT) microsoft (DOT) com
| > <c#HOgw$wFHA.768 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <#tO6MeAxFHA.3300 (AT) TK2MSFTNGP09 (DOT) phx.gbl
| > <#KBoBZPxFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <OwVVh2LyFHA.2800 (AT) TK2MSFTNGP10 (DOT) phx.gbl
| > <VnJkalYyFHA.3020 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <uACqyPZyFHA.788 (AT) tk2msftngp13 (DOT) phx.gbl
| > <rW5rlAlyFHA.780 (AT) TK2MSFTNGXA01 (DOT) phx.gbl
| > <94D4A41E-8BEE-4F74-B006-EA69C024F709 (AT) microsoft (DOT) com
| > <TYLyReWzFHA.3928 (AT) TK2MSFTNGXA02 (DOT) phx.gbl
| > <42E1F185-B68C-4359-A89A-9E40B603A239 (AT) microsoft (DOT) com
| > | Subject: Re: Performance Problem with AppDomains
| > | Date: Wed, 12 Oct 2005 16:12:03 -0700
| > | Lines: 309
| > | Message-ID: <8FC87FAC-214B-45C9-A6CC-0BEBDAD40AD6 (AT) microsoft (DOT) com
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.performance
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.performance:3760
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance
| > |
| > | Another one.... this application is a port of another aplication that
| > uses
| > | COM... and even marshalling the object in com it was far more fast
than
| > this
| > | version of the .NET remoting. Am I doing something wrong!?!??
| > |
| > | Again, thanks
| > | Cristian
| > |
| > | "MoriCristian" wrote:
| > |
| > | > Hi Steven.
| > | > Sorry but I didn't fully understand your reply.
| > | > I tryed to use the BinaryFormatter inside the custom ISerializable
| > | > interface, but , I think, since the BinaryFormatter rely on the
| > | > serializzation, calling it on the same class will cause a recursive
| > | > operation. This is the problem I got.
| > |
| > | > Another question for you. I tryed to change the class so that it is
no
| > | > longer serializable but it derive from MarshallByRefObject.
| > |
| > | > The situation is even worst! The same function now it is very very
very
| > | > slow! I think this is due to the big amount of cross-appdomain
calls
| > done on