Click Here to Install Silverlight*
IndiaChange|All Microsoft Sites
MSDN
|Developer Centers|Library|Downloads|How To Buy|Subscribers|My MSDN
 
Chat Transcript
 
Performance Tuning your .NET Applications
Host
: Ajay Solanki – Consultant, Microsoft Consultancy Services, India
June 27, 2002
 
KunalS_MS: Good afternoon to all present

KunalS_MS: Welcome and thanks for joining to the MSDN India Expert Chat Session

KunalS_MS: Todays topic of expert chat is - Performance Tuning your .NET Applications

KunalS_MS: and our expert host is Ajay Solanki

KunalS_MS: Ajay is a Consultant with Microsoft Consultancy Services, India

KunalS_MS: and one of our key experts on .NET implementation

AjayS_MS: Hi once again

Moderator: (Viral) What is the performance overhead for .NET component hosted in COM+?

AjayS_MS: There is no perfomance overhead, the performance penalty is more apparent in COM/ Interop

Moderator: (Viral) In DNA we have 3 tier model with Dll hosted in MTS / COM+. What should be .Net deployment for max performance benefit?

AjayS_MS: To gain max performance the basic 3-Tier principle i.e COM+ hosting biz logic and a light UI yet holds true.

AjayS_MS: deployment strategy yet remains the same.

Moderator: (Saurabh) We have read a lot about performance tuning for ASP.NET applications, but not much for Win Forms applications. I understand the enviornment is different, still what are the key areas to look out in Win Forms apps?

AjayS_MS: Winforms have been an area to watch out for, its not just Winforms alone but assemblies in general.

AjayS_MS: You need to watch out for the working set for Winforms, there will be tools out soon for the same

Moderator: (Viral) Can I have a VC 6 .exe and .Net Dll? Will this function without any penalty? Moreover will a simple re compilation of vc6 code to vc7 improve the performance or not?

AjayS_MS: A VC6 to .NET call is expensive / or any boundary crossing increases with the overhead of marshalling.

AjayS_MS: Moreover a direct compilation from VC6 to VC7 managed will not achieve an 100% straight migration, you will need to go back the migrated code and make changes.

Moderator: (Saurabh) Can you please elaborate on the tools for Winforms? And what are the things we need to watch out for?

AjayS_MS: vadump.exe / I am not sure if its out but do check/ Ideally look out for working set, cold startup time/ warm startup time etc

Moderator: (Viral) Are MSMQ triggers a good option to invoke components in .Net do they have any performance penalties? Are they available for MSMQ 2.0?

AjayS_MS: MSMQ triggers don’t have a penalty as such, and yes they are available in MSMQ 3.0 also.

Moderator: (ronaldo) In web applications for any kind of form data vaidation should we use the .net controls or ususal client side javascript validation? if we go for .net controls what will be the advantage?

AjayS_MS: .net controls definitely do give an programmin model adv. / however not much diff in performance

Moderator: (Manish_MVP) If .NET to COM marshalling is an issue, a COM library is binary. Will this have an impact? These issues has not been answered properly anywhere.

AjayS_MS: Marshalling is always been an area of concern

AjayS_MS: If you are looking basic COM/Interop it has an overhead 31 instruction minimum and rest varies on the data been marshalled.

Moderator: (madhu) What is the optimized way of loading the Assembly?

AjayS_MS: Let say if you loading an assembly for a single method, you are a paying a tremendous penalty here, see if you can duplicate.

AjayS_MS: the method's functionality using the code already loaded.

AjayS_MS: And also there is a working set associated with each assembly loaded.

Moderator: (Viral) If we want to migrate VC6 to VC7 unmanaged code, will this give the necessary performance numbers say a 30% improvement?

AjayS_MS: One more thing any method body beyond 64 local variables and 3000 lines code is very heavy on the JIT compilation process

AjayS_MS: migrating from VC6 to VC7 will give a definite performance boost and also depends on the code quality

Moderator: (Viral) We have an application where in we are planning a phased migration to .net , just needed to know whether ADO and ADO.net will co exist on the same server and does this have any performance implications?

AjayS_MS: in .net its on ADO.NET / as you see there is a striking difference b/w ADO and ADO.NET.

AjayS_MS: I think you should be considering moving completely to ADO.NET one short.

Moderator: (ronaldo) What is the performance overhead if I host .NET assemblies in COM+ environment?

AjayS_MS: Performance overhead if its is end 2 end .NET / COM+ none, If COM/Interop a basic penalty of 31 instruction varying depending on marshalling requirement

Moderator: (Viral) Will Windows API call also be considered as marshalling out of .NET Framework?

AjayS_MS: Windows API / the whole set is available in .NET/ If you are exclusively calling an Win 32 API from the .NET frame yes there will be marshalling come into play

Moderator: (madhu) But, there are different methods to load the assembly. Is there any method which will give me good performance?

AjayS_MS: Actually Assembly loading there are 2 concern areas the load time and the working set. You need to put all the relevant method in the same assembly .

AjayS_MS: Yes if it is just a single method you dont have an option you pay the penalty

Moderator: (Bharat) Is performance increased by deploying .NET components in COM+?

AjayS_MS: there are no stats available on this so far, But I believe no performance difference, probably very minimal in terms of object cycle.

Moderator: (Bharat) Can you tell me the criterias for using COM+ with .NET?

AjayS_MS: COM+ in .NET is a continued trend as what you did in DNA/ COM+ , The criteria to use is the same as 3 Tier architecture

Moderator: (Saurabh) Ajay you just said - "Windows API / the whole set is available in .NET". But I find that the .NET framework is only a very small subset of Win32 API; is there a new version coming up?

AjayS_MS: Saurabh ideally what Win 32 API in .NET are u lookin at

Moderator: (Saurabh) Multimedia, Hardware Access (COM/USB) etc.

AjayS_MS: Hardware access you have the entire Management namespace/Multimedia I have to check on

Moderator: (madhu) What will happen if memory is allocated by an unmanaged code, and this code is called from .NET. When will the memory allocated by the unmanaged code be released?

AjayS_MS: unmanaged code memory allocation is an overhead, memory allocation is on execution but the memory releasing is a question as there is a seperate entity/thread which keeps track of this.

Moderator: (madhu) Also what is the performance hit between calling a windows dll and com dll?

AjayS_MS: If unmanaged, yes!

Moderator: (Bharat) The RCW is an intermediate layer through which you have go to access COM+. Is there no overhead in invoking COM+ components from .NET?

AjayS_MS: , the standard RCW or CCW that is generated by the runtime provides adequate marshaling for calls that cross the boundary between COM and the .NET Framework. Using custom attributes, you can optionally adjust the way the runtime represents managed and unm

Moderator: (ronaldo) Do you have any statistics regarding performance improvement between COM/ADO environment and .NET/ADO.NET? This is very important before deciding to change any application.

AjayS_MS: COM/ADO vs .NET/ADO.NET is an indirect way to look at performance the basic is moving an VB6 app to VB.NET does give you around 25% performance improvement and these statistics are based on MS Nile application test - http://www.gotdotnet.com/team/compare/nileperf.aspx

Moderator: (Saurabh) Ajay, I thought the Management namespace is used to access WMI. I don't see any classes there that help me *program* against raw hardware devices?

AjayS_MS: WMI would give you APIs to monitor any kind of devices (raw also)/ RAW Device API I have check on this

Moderator: (madhu) Can you give me some stats between the two, i.e., callling a windows dll and calling a com dll?

AjayS_MS: Platform invoke allows managed code to call unmanaged functions that are implemented in a DLL. Platform invoke provides the mechanism for finding and invoking unmanaged functions, as well as marshaling managed arguments to and from unmanaged code. When ma

AjayS_MS: When managed code calls an unmanaged function that is implemented in a DLL, platform invoke locates the DLL that implements the function, loads the DLL into memory, and locates the function address in memory.

AjayS_MS: It then pushes the function’s arguments onto the stack, marshals any data that has to be marshaled, enables pre-emptive garbage collection, and transfers control to the address of the unmanaged code.

AjayS_MS: So the basic marshalling overhead applies here too.

Moderator: (ronaldo) Contd from prev question - I mean performance difference between COM and .NET assemblies with ADO.NET, the UI can be windows or WEB.

AjayS_MS: ADO.NET vs ADO don’t have the exact statistics now.

Moderator: (Manish_MVP) Can you give some references of the custom attributes to optionally adjust the way the runtime represents managed and unmanaged in .NET assemblies hosted in COM+?

AjayS_MS: you can specify custom marshaling attributes by adding a MarshalAsAttribute to the parameters of the function. You can also use the MarshalAsAttribute with structures. When using the MarshalAsAttribute with structures.

AjayS_MS: You must also use the StructLayout attribute to set the native layout of the structure.

KunalS_MS: Since time has run out, we shall not be taking any more questions today

KunalS_MS: If any, please share your satisfaction/suggestions on the community support initiative - http://www.microsoft.com/india/communitysatsurvey

KunalS_MS: Also, if we have not been able to answer any queries of yours due to lack of time, please do post your questions at -

KunalS_MS: MSDN India Online Forums http://www.microsoft.com/india/onlineforums

KunalS_MS: I would firstly like to thank Ajay for taking time out from this hectic schedule

AjayS_MS: pleasure

KunalS_MS: He has been a great assistance in solving our queries

KunalS_MS: And surely - thank you all for joining into this chat session and bringing your problems to us.
     

©2009 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy Statement
Microsoft