开发者

Strange issue when running application on 64 bits in C# .NET

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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜