views:

57

answers:

3

We have a function in C# that uses the ICSharpCode SharpZipLib BZip2 decompression method to uncompress some XML we get from a database. We have noticed an issue on two of our webservers (Win 2K and Win 2003 Svr) that this code takes a really long time to execute and causes the CPU utilization to max out on these servers. We have isolated the code and put it into a Winforms app for testing and when running this same code in the winforms app on the same machines the code runs much faster. This is with the same SharpZipLib assembly.

So far we are at a loss as to why the code runs so much slower under the asp.net process.

Any suggestions, ideas ?

Thanks in advance!

+1  A: 

Use a profiler. Problem might be somewhere outside of the decrompession code. You, I and the rest of the folks at SO won't give any more info than one profiler session will give.

Jan Jongboom
+1  A: 

Have you tried watching the code in a Profiler like RedGate ANTS Performance Profiler to see what kind of things the code is doing?

Code hosted inside of an ASP.NET application is run under completely different conditions than a WinForm application. You could be running into ThreadPool issues when loading through the IIS worker process.

You could also be running into an issue where your code is not pre-compiled in your ASP.NET application.

All that being said, running your application through a Profiler is going to provide you with the best view into how things are working.

Justin Niessner
It's not pre-compilation; DLL's won't be any different other than it being compiled later on.
Jan Jongboom
@Jan Jongboom - The DLLs won't be any different, but there will be some perceived time difference in execution while the compilation happens.
Justin Niessner
Yes, but only the first request. Furthermore they are running multiple webservers so I guess they are doing it the right way anyway :-)
Jan Jongboom
A: 

Make sure you are creating a web project and compile it for release build. (Build -> configuration manager)

Spooks
He's using an external library, so their DEBUG/RELEASE settings won't mind for that code.
Jan Jongboom
@Jan: Keep in mind that debug/release is just a bit that the JIT is expected to honor but doesn't always. If you run in the debugger, the default behavior is to JIT release builds as debug (unoptimized). Perhaps something along these lines is happening here.
Steven Sudit