none
.NET app progressive performance degrade in Console-App -or- WinForms-App -BUT- no degrade in ASP.NET -or- NUnit app RRS feed

  • Question

  • Hi,

    I have a .NET class library that makes about 12000 calls to the database for a particular case (this is the application's xml import functionality).

    I have four ways to (seemingly) identically call this library:  1.) IIS ASP.NET web application , 2.) NUnit test application, 3.) simple .NET console application, 4.) simple .NET Windows Forms application.

    With the IIS ASP.NET web application and the NUnit test application, I see a a consistent 12 database calls per second through the whole process (I have a timed log file entry generated for each database call). {whole process takes about 18 minutes}

    With the simple console application or windows forms application, I initially see 12 database calls per second, but steadily throughout the process see the performance ultimately degrade to about 1 database call per second. {whole process takes about 2 hours 40 mintues}

    some notes:  database is (with high confidence) properly indexed, and I clear all data from the database upon each test run.

    Any ideas?

    Thanks!
    • Edited by GreenStone90 Friday, June 13, 2008 3:59 PM spelling
    Friday, June 13, 2008 2:31 PM

Answers

  • What ASP.NET and NUnit have in common is that they create an AppDomain to run your code.  That makes it likely that memory leaks in your code are not detrimental as the leaked objects get discarded when the AppDomain is unloaded.  Why your code is leaking is not at all obvious from what you've told us.  This MSDN magazine article could be helpful.

    Hans Passant.
    • Marked as answer by Bruno Yu Monday, June 16, 2008 5:45 AM
    Friday, June 13, 2008 10:34 PM
    Moderator

All replies

  • Hi,

    Who controls database connection object creationg and lifetime: hosting application or library?
    Vitaliy Liptchinsky
    Friday, June 13, 2008 2:46 PM
  • Thanks for the reply... The library
    Friday, June 13, 2008 3:31 PM
  • Some additional information:

    Using the performance monitor (perfmon.exe), I found the following information:

    Console-Application (application with progressive degradation):  "Gen 0 heap size" is pegged at 100 (I am not sure of the units...guess %), "Gen 1 heap size" averages about 95 (with peaks to 100).  "Allocated bytes/sec" starts at about 50 and progressively (over the length of time of running the app) to 4.

    NUnit application (application with good performance): "Gen 1 heap size" is pegged at 100, "Gen 1 heap size" averages about 32.  "Allocated bytes/sec" starts at about 58 and stays there the whole time.
    Friday, June 13, 2008 5:37 PM
  • Additional note:  I have the same issue if I use either SQLServer or Oracle (my app can use either) as the type of database.
    Friday, June 13, 2008 6:34 PM
  • What ASP.NET and NUnit have in common is that they create an AppDomain to run your code.  That makes it likely that memory leaks in your code are not detrimental as the leaked objects get discarded when the AppDomain is unloaded.  Why your code is leaking is not at all obvious from what you've told us.  This MSDN magazine article could be helpful.

    Hans Passant.
    • Marked as answer by Bruno Yu Monday, June 16, 2008 5:45 AM
    Friday, June 13, 2008 10:34 PM
    Moderator