1

We really need an expert's view on IIS7 and I'm going to do my best to describe our problem. If you need more information please let me know and I'll retrieve it.

We have an ASP.NET website which references a couple of .NET DLLs and the performance was dramatic at our clients! On our own testserver the same set of data took 25 seconds (still not fast but that's another issue) and at our clients it took 6 minutes!

I wrote logs in every possible routine that I could think of, logging how long it took. It showed that across all the routines across all the DLL's the processing of the code simply takes longer at our clients.

To further test this I made a desktop application which references the exact same DLLs and ran this at the client. Those 6 minutes went down to... 5 seconds!!! What the... ?

We ran through all the settings in IIS7 and compared it to our IIS7 and... We are really stumped here to honestly admit. The specs of the servers at the client are even higher than ours!

Let's zoom in on the problem. We are talking for instance about a function that instantiates an object and sets 3 properties. No DB connections, nothing fancy at all, really simple:

'Creates a GeneralPractitioner
   Public Shared Function Create(ByVal gp As GeneralPractitionerTO) As GeneralPractitioner

'HACK Temporarily write to a logfile.
        WebHISPortaalBLL.WriteToLo
g.WriteToLog(Now.ToString("dd-MM-yyyy HH:mm:ss.fff") & " BEGIN WebHISPortaalBLL.GeneralPractitioner.Create", String.Empty, "PerformanceTest")

'Check if parameter is not nothing.
        If gp IsNot Nothing Then

'Create new instance of GeneralPractitioner and set properties in object initializer.
            Return New GeneralPractitioner With {.ID = gp.ID,
                                                 .Name = gp.Name,
                                                 .AGBCode = gp.AGBCode}

        Else
            Return Nothing
        End If

    End Function 

The calling piece of code is a LINQ query, so there's nothing in between. And now look at the difference. First I'll post a small piece of the logfile at our testserver, look at milliseconds.

This method at our testserver:

24-11-2011 15:23:34.526 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 24-11-2011 15:23:34.527 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 24-11-2011 15:23:34.528 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 24-11-2011 15:23:34.529 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 24-11-2011 15:23:34.530 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 24-11-2011 15:23:34.530 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 24-11-2011 15:23:34.531 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 24-11-2011 15:23:34.531 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create

Same method at client's server:

25-11-2011 10:38:11.414 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 25-11-2011 10:38:11.476 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 25-11-2011 10:38:11.539 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 25-11-2011 10:38:11.601 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 25-11-2011 10:38:11.664 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 25-11-2011 10:38:11.726 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 25-11-2011 10:38:11.789 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create 25-11-2011 10:38:11.851 BEGIN WebHISPortaalBLL.GeneralPractitioner.Create

Where our testserver takes on average 1 millisecond (and actually ussually 0.5 milliseconds) to complete this task, the client's server takes 62 milliseconds on average to complete this task!

Why??

Is there anyone out there that can help us? We would appreciate any comment. Anything.

Danny van der Kraan
  • 5,344
  • 6
  • 31
  • 41
  • maybe there are some extra network calls (ie an webservice) – Adrian Iftode Nov 25 '11 at 09:20
  • 1
    Can you install a profiler? The best way to work out what's going on is to install a profiler (on your own server for starters) and seeing what the bottleneck is. The bottleneck on your client's infrastructure may be different - so if you can, install a profiler there too. I've found the Redgate profiler to be very useful... – Neville Kuyt Nov 25 '11 at 09:57
  • @Adrian Iftode: First off, thnx for replying. Alas the server appears to obdiently await work only for our website and DLLs. – Danny van der Kraan Nov 25 '11 at 10:24
  • Could we see the code that you are timing there? – Andrew Barber Nov 25 '11 at 10:25
  • @Neville K: Thnx for your reply. We'll look into it. – Danny van der Kraan Nov 25 '11 at 10:27
  • @Andrew Barber: Yeah I tried at first, but it gave me problems. I added it now. Sorry it all looks warped. Hope you can make something out of it. – Danny van der Kraan Nov 25 '11 at 10:30
  • OK; I definitely want to see that logging function, and if there's anything in the constructor of `GeneralPractitioner` – Andrew Barber Nov 25 '11 at 10:33
  • @Andrew Barber: I am gratefull for your replies ofcourse, but in my humble opinion you are really getting off target here. The constructor of GeneralPractitioner is empty and the logging function was placed áfter the performance issues were reported. So they have nothing to do with it. Agreed? – Danny van der Kraan Nov 25 '11 at 10:36
  • Knowing that information, yes; I would agree. – Andrew Barber Nov 25 '11 at 10:41
  • Is the underlying database the same at both sites? If you have only test data locally and actual (i.e. more) data at the client, this might account for a lot. Try getting the generated SQL from the linq query and run it directly against the database. – Matt Evans Nov 25 '11 at 10:44
  • @Matthew Evans: First off, thank you for replying. We actually took a copy of the client's DB and used it in our test setup to eliminate that situation. To be clear, it has nothing to do with data in my humble opinion (see code sample + loglistings). – Danny van der Kraan Nov 25 '11 at 10:54
  • The problem isn't this code, it is the code that is calling this function. What is that? – cjk Nov 25 '11 at 11:00
  • @cjk : 'hcp.GeneralPractitioners.AddRange(From gpTO In gpTOs Select GeneralPractitioner.Create(gpTO))' But keep in mind. This is just an example. Over the entire lifecycle the code is slower on the client's machine than on our testmachine. – Danny van der Kraan Nov 25 '11 at 11:59
  • @Neville K :I've looked into the ANTS performance profiler by RedGate and I think I'm in love. So yeah we would like to use it. BUT... And i really don't want to be stubborn here (but I'm a developer so what did you expect) this is for finding specific problems in the code. While our loglistings show that basically each and every line of code is slower on the client's machine than on our test machine. So this is not the answer. Sorry. – Danny van der Kraan Nov 25 '11 at 12:16
  • I'd start with the profiler - it will allow you to nail down _where_ your code is spending time, and drill down deeper; with a bit of luck, it will tell you why it's slower on the client machine. – Neville Kuyt Nov 25 '11 at 12:30
  • Check this answer, its say about database, but is general. http://stackoverflow.com/questions/6572612/checklist-for-asp-net-database-performance/6572734#6572734 – Aristos Nov 25 '11 at 12:47
  • @Neville K You've convinced me. I'll give it a shot. Give me some time to come with results. To be continued... – Danny van der Kraan Nov 25 '11 at 13:07
  • @Aristos Thank you for your contribution. Those are alot of (vague) tips. I've passed them on to our network guy. If something comes out of it I'll post it here. – Danny van der Kraan Nov 25 '11 at 13:16
  • What happens if you comment out the "main" line? Return New GeneralPractitioner... How fast will it run? – DmitryK Sep 24 '13 at 11:33

0 Answers0