tags:

views:

64

answers:

2

All,

I have a server application which reads messages off a queue and writes them in a database by calling stored procedures. It is written in C# targetting .NET Framework 3.5 The server is XEON 2.4Ghz (16 cores)

In my Build properties I had the Platform Target as "Any CPU". The result was in the server, all cores to run constant at 100% but the application was running slow ! I changed the Platform Target to be x86 and when running on the server is running much faster than before and the Cores are around 20-30% load.

I can't really explain what is happening.

Any ideas?

Thanks,

MK

+2  A: 

This blog post by the MS guy Rick Byers talks about just this: AnyCPU Exes are usually more trouble than they're worth

A quote from the blog is: 32-bit tends to be faster anyway which could be a part of the answer.

Edit: Added a bit of my answer that I forgot as Hans Passant pointed out.

ho1
Not *that* much faster.
Hans Passant
@Hans: Bad answer on my behalf, thanks.
ho1
+2  A: 

Well, doesn't make a lot of sense. But you are running with a very different dbase provider. The 64-bit versions of them are relatively new and might not have gone through the same kind of rigorous testing and optimization as their 32-bit versions.

Still, a program like this should always block on the queue read and the dbase write. I/O is always slow, much slower than raw code. Only when the thread blocks on an I/O request will it use less than 100% of the CPU cycles.

Do make sure that it isn't throwing and catching exceptions frequently. That's expensive and easily gobbles up all CPU resources. Visible while debugging in the Output window.

Hans Passant