views:

203

answers:

3

We have a DLL used as the middle layer between our website front end and our back end ticketing system. The method of insertion into the ticketing system is a bit complicated to explain, but the short version is that it's slow. The best case scenario I've gotten is a 9 second submission time.

The real problem though, is that I can only get that time through a Windows app, not through an ASP.NET web site. I've set up both a Windows test application and a web page for testing, and even though the code is copied between them the web page is consistently submitting in 17-20 seconds, while the windows app is getting 8-11 seconds.

What could be causing that?

EDIT: In response to a couple of the answers...

The call to the web service is taking the bulk of the time, but I have no control over this web service as it's provided by the ticketing system vendor. I need to find out why the web service is taking different amounts of time when it's being called form a different kind of application. The code is exactly the same in both cases, and it's running a loop then reporting the times recorded.

The code is:

for (int i = 0; i < numIterations; i++)
        {
            startTimes[i] = DateTime.Now;

            try
            {
                cvNum = Clearview.Submit(req, DateTime.Now, DateTime.Now, false);
            }
            catch (Exception ex)
            {
                exceptionCount++;
                lblResult.Text += @"<br />Exception Caught: " + ex.Message + @"<br />";                    
            }

            endTimes[i] = DateTime.Now;
    }

It's the same loop in both cases, and I'm marking the time right before and after the call to the library, which does further processing and then calls the web service. But that processing should be consistent shouldn't it? I have traced during debugging and not seen any delay getting to the actual web service call...

EDIT Again: Working with Ants, in both cases 99.4% of the time is being sent just on the web service call. There appears to be no difference there... except that when timed out the web page is taking longer than the windows app.

+1  A: 

Pepper your application on both sides with logs - that will show you where the time is going. If that doesn't help, use Wireshark to trace the network activity.

Jon Skeet
+2  A: 

Potentially the location of the web service in relation to the web server could be having an issue. Also, the page structure and other processing inside your web UI could be having an impact on how long it takes the application to process.

As mentioned logging items on both sides is a great idea, if that doesn't get you what you need, you might try a performance profiler such as Ants Profiler by Red Gate that can help identify the line, method, or class that is using the bulk of the time.

Mitchel Sellers
I just added edited in some more info. I don't have access to the internals of the web service, but not sure why that would matter anyway...
Telos
Also since I'm testing on my desktop the web service is in the same place for both clients...
Telos
I would be looking at Ants Profiler in this case, look at loop execution times. Also, are exceptions being thrown more in one case than another? Exceptions are costly.
Mitchel Sellers
Playing with Ants now, but no exceptions are being thrown.
Telos
Ok, see if ants between the two apps can isolate one specific line that is taking more effort.
Mitchel Sellers
It's the call to the web service, as I'd suspected. 99% of the time is just on that one call...
Telos
+1  A: 

Are you running both on the same machine? Is the middle-layer that you are calling located on a remote machine? The time durations you mentioned vaguely feels like a DNS timeout issue, when opening a connection incurs the penalty for the first (down/misaddressed) DNS response to timeout. Are you sure that whatever config file/var pointing the DLL to the middle-layer are the same in both invocations?

I second the suggestion to use Wireshark to see what is going on. You can at least satisfy yourself that the backend processing time is (should be, anyways) the same...

Toybuilder
It was a config issue, one was submitting into the production system though both were using the correct web service. The time difference was because of how much busier the prod database is apparently. Honestly, not sure why it worked at all...Thanks though!
Telos