![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Greetings I'm experiencing this problem I have a class in an assembly with a single method PerformCalcs() If I load the assembly in the main AppDomain and call PerformCalcs() the execution time is aboput 10ms. If I load a new AppDomain, I load the assembly using a remote loader and then I call PerformCalcs() the execution time is aboun one minutes!! Can anyone figure out why? The PerformCalcs has it's own objects, so no remoting is here! Please Help! |
#3
| |||
| |||
|
|
Thread-Topic: Performance Problem with AppDomains thread-index: AcXDpS7DDnEF00gNSOCUVZ7u99lApQ== 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 Subject: RE: Performance Problem with AppDomains Date: Tue, 27 Sep 2005 13:51:07 -0700 Lines: 25 Message-ID: <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (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!TK2MSFTNGXA02.phx.gbl!TK2MSF TNGXA03.phx.gbl Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.performance:3698 X-Tomcat-NG: microsoft.public.dotnet.framework.performance Sorry, I had a breackoint on. So, without AppDomains, 10msec. With AppDomains 4 seconds. Please Help! Regards MoriCristian "MoriCristian" wrote: Greetings I'm experiencing this problem I have a class in an assembly with a single method PerformCalcs() If I load the assembly in the main AppDomain and call PerformCalcs() the execution time is aboput 10ms. If I load a new AppDomain, I load the assembly using a remote loader and then I call PerformCalcs() the execution time is aboun one minutes!! Can anyone figure out why? The PerformCalcs has it's own objects, so no remoting is here! Please Help! |
#4
| |||
| |||
|
|
Hi Mori, Welcome to MSDN newsgroup. From your description, you have a certain class which has a PerformCalcs() method , you have tried load the class's assembly in .net app's main appdomain and a separated appdomain and call that class instance's PerformCalcs() method. You found that when calling in separate domain, the method will take much more time to complete, yes? As for calling class instance remotely (cross appdomain), it'll involve many cross boundary processing, such as paramter, method callcontext marshaling/unmarshaling. These operations will all have impact on the performance. However, I also think 4 seconds still seems a bit too long. I'm not sure how you actually reference the class instance remotely and call the method, also what you've done in the method body. If convenient, I'd suggst you provide the complete code sinppet so that I can perform some tests on my local side, at least we can confirm whether 4 seconds is the expected time or environment specific. 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: AcXDpS7DDnEF00gNSOCUVZ7u99lApQ== | 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 | Subject: RE: Performance Problem with AppDomains | Date: Tue, 27 Sep 2005 13:51:07 -0700 | Lines: 25 | Message-ID: <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (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!TK2MSFTNGXA02.phx.gbl!TK2MSF TNGXA03.phx.gbl | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.performance:3698 | X-Tomcat-NG: microsoft.public.dotnet.framework.performance | | Sorry, I had a breackoint on. | So, without AppDomains, 10msec. With AppDomains 4 seconds. | | Please Help! | | Regards | MoriCristian | | "MoriCristian" wrote: | | > Greetings | > I'm experiencing this problem | | > I have a class in an assembly with a single method PerformCalcs() | > If I load the assembly in the main AppDomain and call PerformCalcs() the | > execution time is aboput 10ms. | > If I load a new AppDomain, I load the assembly using a remote loader and | > then I call PerformCalcs() the execution time is aboun one minutes!! | | > Can anyone figure out why? The PerformCalcs has it's own objects, so no | > remoting is here! | | > Please Help! | | | |
#5
| |||
| |||
|
|
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 (AT) microsoft (DOT) com EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (DOT) com |
|
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 handling itself. Is there any difference between doing Data obj=new Data() rather than receveing it from the deserialization apart the deserialization itself? I hope that this help you understand my problem. If needed, I could send you a zip with the code... let me know please Regards Cristian Mori Steven Cheng[MSFT] wrote: Hi Mori, Welcome to MSDN newsgroup. From your description, you have a certain class which has a PerformCalcs() method , you have tried load the class's assembly in .net app's main appdomain and a separated appdomain and call that class instance's PerformCalcs() method. You found that when calling in separate domain, the method will take much more time to complete, yes? As for calling class instance remotely (cross appdomain), it'll involve many cross boundary processing, such as paramter, method callcontext marshaling/unmarshaling. These operations will all have impact on the performance. However, I also think 4 seconds still seems a bit too long. I'm not sure how you actually reference the class instance remotely and call the method, also what you've done in the method body. If convenient, I'd suggst you provide the complete code sinppet so that I can perform some tests on my local side, at least we can confirm whether 4 seconds is the expected time or environment specific. 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: AcXDpS7DDnEF00gNSOCUVZ7u99lApQ== | 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 | Subject: RE: Performance Problem with AppDomains | Date: Tue, 27 Sep 2005 13:51:07 -0700 | Lines: 25 | Message-ID: <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (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!TK2MSFTNGXA02.phx.gbl!TK2MSF TNGXA03.phx.gbl | Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.performance:3698 | X-Tomcat-NG: microsoft.public.dotnet.framework.performance | | Sorry, I had a breackoint on. | So, without AppDomains, 10msec. With AppDomains 4 seconds. | | Please Help! | | Regards | MoriCristian | | "MoriCristian" wrote: | | > Greetings | > I'm experiencing this problem | | > I have a class in an assembly with a single method PerformCalcs() | > If I load the assembly in the main AppDomain and call PerformCalcs() the | > execution time is aboput 10ms. | > If I load a new AppDomain, I load the assembly using a remote loader and | > then I call PerformCalcs() the execution time is aboun one minutes!! | | > Can anyone figure out why? The PerformCalcs has it's own objects, so no | > remoting is here! | | > Please Help! | | | |
#6
| |||
| |||
|
|
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 (AT) microsoft (DOT) com EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (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 | handling itself. | Is there any difference between doing Data obj=new Data() rather than | receveing it from the deserialization apart the deserialization itself? | | I hope that this help you understand my problem. | If needed, I could send you a zip with the code... | let me know please | | Regards | Cristian Mori | Steven Cheng[MSFT] wrote: | > Hi Mori, | | > Welcome to MSDN newsgroup. | > From your description, you have a certain class which has a PerformCalcs() | > method , you have tried load the class's assembly in .net app's main | > appdomain and a separated appdomain and call that class instance's | > PerformCalcs() method. You found that when calling in separate domain, the | > method will take much more time to complete, yes? | | > As for calling class instance remotely (cross appdomain), it'll involve | > many cross boundary processing, such as paramter, method callcontext | > marshaling/unmarshaling. These operations will all have impact on the | > performance. However, I also think 4 seconds still seems a bit too long. | > I'm not sure how you actually reference the class instance remotely and | > call the method, also what you've done in the method body. If convenient, | > I'd suggst you provide the complete code sinppet so that I can perform some | > tests on my local side, at least we can confirm whether 4 seconds is the | > expected time or environment specific. | | > 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: AcXDpS7DDnEF00gNSOCUVZ7u99lApQ== | > | 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 | > | Subject: RE: Performance Problem with AppDomains | > | Date: Tue, 27 Sep 2005 13:51:07 -0700 | > | Lines: 25 | > | Message-ID: <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (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!TK2MSFTNGXA02.phx.gbl!TK2MSF TNGXA03.phx.gbl | > | Xref: TK2MSFTNGXA01.phx.gbl | > microsoft.public.dotnet.framework.performance:3698 | > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance | > | | > | Sorry, I had a breackoint on. | > | So, without AppDomains, 10msec. With AppDomains 4 seconds. | > | | > | Please Help! | > | | > | Regards | > | MoriCristian | > | | > | "MoriCristian" wrote: | > | | > | > Greetings | > | > I'm experiencing this problem | > | | > | > I have a class in an assembly with a single method PerformCalcs() | > | > If I load the assembly in the main AppDomain and call PerformCalcs() | > the | > | > execution time is aboput 10ms. | > | > If I load a new AppDomain, I load the assembly using a remote loader | > and | > | > then I call PerformCalcs() the execution time is aboun one minutes!! | > | | > | > Can anyone figure out why? The PerformCalcs has it's own objects, so no | > | > remoting is here! | > | | > | > Please Help! | > | | > | | > | | | |
#7
| |||
| |||
|
|
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...soft (DOT) com |
|
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 (AT) microsoft (DOT) com EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (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 | handling itself. | Is there any difference between doing Data obj=new Data() rather than | receveing it from the deserialization apart the deserialization itself? | | I hope that this help you understand my problem. | If needed, I could send you a zip with the code... | let me know please | | Regards | Cristian Mori | Steven Cheng[MSFT] wrote: | > Hi Mori, | | > Welcome to MSDN newsgroup. | > From your description, you have a certain class which has a PerformCalcs() | > method , you have tried load the class's assembly in .net app's main | > appdomain and a separated appdomain and call that class instance's | > PerformCalcs() method. You found that when calling in separate domain, the | > method will take much more time to complete, yes? | | > As for calling class instance remotely (cross appdomain), it'll involve | > many cross boundary processing, such as paramter, method callcontext | > marshaling/unmarshaling. These operations will all have impact on the | > performance. However, I also think 4 seconds still seems a bit too long. | > I'm not sure how you actually reference the class instance remotely and | > call the method, also what you've done in the method body. If convenient, | > I'd suggst you provide the complete code sinppet so that I can perform some | > tests on my local side, at least we can confirm whether 4 seconds is the | > expected time or environment specific. | | > 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: AcXDpS7DDnEF00gNSOCUVZ7u99lApQ== | > | 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 | > | Subject: RE: Performance Problem with AppDomains | > | Date: Tue, 27 Sep 2005 13:51:07 -0700 | > | Lines: 25 | > | Message-ID: <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (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!TK2MSFTNGXA02.phx.gbl!TK2MSF TNGXA03.phx.gbl | > | Xref: TK2MSFTNGXA01.phx.gbl | > microsoft.public.dotnet.framework.performance:3698 | > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance | > | | > | Sorry, I had a breackoint on. | > | So, without AppDomains, 10msec. With AppDomains 4 seconds. | > | | > | Please Help! | > | | > | Regards | > | MoriCristian | > | | > | "MoriCristian" wrote: | > | | > | > Greetings | > | > I'm experiencing this problem | > | | > | > I have a class in an assembly with a single method PerformCalcs() | > | > If I load the assembly in the main AppDomain and call PerformCalcs() | > the | > | > execution time is aboput 10ms. | > | > If I load a new AppDomain, I load the assembly using a remote loader | > and | > | > then I call PerformCalcs() the execution time is aboun one minutes!! | > | | > | > Can anyone figure out why? The PerformCalcs has it's own objects, so no | > | > remoting is here! | > | | > | > Please Help! | > | | > | | > | | | |
#8
| |||
| |||
|
|
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...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 | 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 (AT) microsoft (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 | > | handling itself. | > | Is there any difference between doing Data obj=new Data() rather than | > | receveing it from the deserialization apart the deserialization itself? | > | | > | I hope that this help you understand my problem. | > | If needed, I could send you a zip with the code... | > | let me know please | > | | > | Regards | > | Cristian Mori | > | Steven Cheng[MSFT] wrote: | > | > Hi Mori, | > | | > | > Welcome to MSDN newsgroup. | > | > From your description, you have a certain class which has a | > PerformCalcs() | > | > method , you have tried load the class's assembly in .net app's main | > | > appdomain and a separated appdomain and call that class instance's | > | > PerformCalcs() method. You found that when calling in separate domain, | > the | > | > method will take much more time to complete, yes? | > | | > | > As for calling class instance remotely (cross appdomain), it'll involve | > | > many cross boundary processing, such as paramter, method callcontext | > | > marshaling/unmarshaling. These operations will all have impact on the | > | > performance. However, I also think 4 seconds still seems a bit too | > long. | > | > I'm not sure how you actually reference the class instance remotely and | > | > call the method, also what you've done in the method body. If | > convenient, | > | > I'd suggst you provide the complete code sinppet so that I can perform | > some | > | > tests on my local side, at least we can confirm whether 4 seconds is | > the | > | > expected time or environment specific. | > | | > | > 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: AcXDpS7DDnEF00gNSOCUVZ7u99lApQ== | > | > | 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 | > | > | Subject: RE: Performance Problem with AppDomains | > | > | Date: Tue, 27 Sep 2005 13:51:07 -0700 | > | > | Lines: 25 | > | > | Message-ID: <EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD (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!TK2MSFTNGXA02.phx.gbl!TK2MSF TNGXA03.phx.gbl | > | > | Xref: TK2MSFTNGXA01.phx.gbl | > | > microsoft.public.dotnet.framework.performance:3698 | > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance | > | > | | > | > | Sorry, I had a breackoint on. | > | > | So, without AppDomains, 10msec. With AppDomains 4 seconds. | > | > | | > | > | Please Help! | > | > | | > | > | Regards | > | > | MoriCristian | > | > | | > | > | "MoriCristian" wrote: | > | > | | > | > | > Greetings | > | > | > I'm experiencing this problem | > | > | | > | > | > I have a class in an assembly with a single method PerformCalcs() | > | > | > If I load the assembly in the main AppDomain and call | > PerformCalcs() | > | > the | > | > | > execution time is aboput 10ms. | > | > | > If I load a new AppDomain, I load the assembly using a remote | > loader | > | > and | > | > | > then I call PerformCalcs() the execution time is aboun one minutes!! | > | > | | > | > | > Can anyone figure out why? The PerformCalcs has it's own objects, | > so no | > | > | > remoting is here! | > | > | | > | > | > Please Help! | > | > | | > | > | | > | > | | > | | > | | | |
#9
| |||
| |||
|
|
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 |
|
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...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 | 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 (AT) microsoft (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 | > | handling itself. | > | Is there any difference between doing Data obj=new Data() rather than | > | receveing it from the deserialization apart the deserialization itself? | > | | > | I hope that this help you understand my problem. | > | If needed, I could send you a zip with the code... | > | let me know please | > | | > | Regards | > | Cristian Mori | > | Steven Cheng[MSFT] wrote: | > | > Hi Mori, | > | | > | > Welcome to MSDN newsgroup. | > | > From your description, you have a certain class which has a | > PerformCalcs() | > | > method , you have tried load the class's assembly in .net app's main | > | > appdomain and a separated appdomain and call that class instance's | > | > PerformCalcs() method. You found that when calling in separate domain, | > the | > | > method will take much more time to complete, yes? | > | | > | > As for calling class instance remotely (cross appdomain), it'll involve | > | > many cross boundary processing, such as paramter, method callcontext | > | > marshaling/unmarshaling. These operations will all have impact on the | > | > performance. However, I also think 4 seconds still seems a bit too | > long. | > | > I'm not sure how you actually reference the class instance remotely and | > | > call the method, also what you've done in the method body. If | > convenient, | > | > I'd suggst you provide the complete code sinppet so that I can perform | > some | > | > tests on my local side, at least we can confirm whether 4 seconds is | > the | > | > expected time or environment specific. | > | | > | > 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: AcXDpS7DDnEF00gNSOCUVZ7u99lApQ== | > | > | X-WBNR-Posting-Host: 81.208.74.179 | > | > | From: =?Utf-8?B?TW9yaUNyaXN0aWFu?= CristianMori (AT) nospam (DOT) nospam | > | > | References: 25E92219-89DA-4229-8ECB-8738E2522C32...soft (DOT) com | > | > | Subject: RE: Performance Problem with AppDomains | > | > | Date: Tue, 27 Sep 2005 13:51:07 -0700 | > | > | Lines: 25 | > | > | Message-ID: EC9C7082-9610-4BF2-9EEC-4CF5B2287EBD...soft (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!TK2MSFTNGXA02.phx.gbl!TK2MSF TNGXA03.phx.gbl | > | > | Xref: TK2MSFTNGXA01.phx.gbl | > | > microsoft.public.dotnet.framework.performance:3698 | > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.performance | > | > | | > | > | Sorry, I had a breackoint on. | > | > | So, without AppDomains, 10msec. With AppDomains 4 seconds. | > | > | | > | > | Please Help! | > | > | | > | > | Regards | > | > | MoriCristian | > | > | | > | > | "MoriCristian" wrote: | > | > | | > | > | > Greetings | > | > | > I'm experiencing this problem | > | > | | > | > | > I have a class in an assembly with a single method PerformCalcs() | > | > | > If I load the assembly in the main AppDomain and call | > PerformCalcs() | > | > the | > | > | > execution time is aboput 10ms. | > | > | > If I load a new AppDomain, I load the assembly using a remote | > loader | > | > and | > | > | > then I call PerformCalcs() the execution time is aboun one minutes!! | > | > | | > | > | > Can anyone figure out why? The PerformCalcs has it's own objects, | > so no | > | > | > remoting is here! | > | > | | > | > | > Please Help! | > | > | | > | > | | > | > | | > | | > | | | |
#10
| |||
| |||
|
|
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 (AT) microsoft (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 |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |