Jon H
Jon H

Reputation: 1071

Com calls to 32bit application on 64bit server slow

I have an application that I have just migrated to Windows 2008 R2 64bit. In essence it is a C# .NET 4.0 WCF application that makes a dynamic call to a 32bit COM application written in VC6 C++.

When I was running this on my desktop which is Windows 7 32bit the COM calls were considerably faster.

The server ought to be an order of magnitude more powerful (although in a HOSTED environment)

Are there any quick/easy things I can check to try and get to the bottom of this? I am due today to get alook at the resources allocated to the virtual machine but in the mean time..

Is this a 64bit calling 32bit COM thing?

Thank you!

Upvotes: 4

Views: 2058

Answers (1)

Anders Marzi Tornblad
Anders Marzi Tornblad

Reputation: 19305

Running 32-bit code from 64-bit processes is very time-consuming, because it involves the Windows on Windows subsystem (WoW). 64-bit code and 32-bit code cannot be run within the same process, which means that all calls from your code to the 32-bit dll must pass process and architecture boundaries, which involves some heavy data marshalling and function call marshalling.

http://blog.mattmags.com/2007/06/30/accessing-32-bit-dlls-from-64-bit-code/

Do some profiling to measure the performance of your app in different situations.

  • Compile to Any-CPU, run on x64
  • Compile to x64, run on x64
  • Compile to x86, run on x64

Then do what gives you the most performance.

However...

If you have access to the COM library source code, the very best thing would be to recompile it on the x64 platform.

Upvotes: 5

Related Questions