There is no logging or tracing in the application so trouble shooting is near impossible, particularly for the timeout issue which was the first issue uncovered.
Enabling logging on the ASP.Net Presentation Tier
I added the following to the web.config to enable tracing in the web tier. Initially I was logging "verbose" but as it was too much info I turned the volume down to "information".
Add this into the existing <system.serviceModel> section.
<diagnostics>
<messageLogging
logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true"
maxMessagesToLog="3000"
/>
</diagnostics>
Add the new <system.diagnostics> section before the closing </configuration> tag.
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.ServiceModel" switchValue="Info">
<listeners>
<add name="xml"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="xml"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="D:\inetpub\MyApp\Trace.svclog"
/>
</sharedListeners>
</system.diagnostics>
The hard part is then getting the log file off the server as I don't have access to it. But it does give some useful information in that I can see the full SOAP request and response between the web and app tiers. Tracing will be easier to get my hands on.
Enabling tracing of the web tier
The web tier can be easily enabled for tracing, thus letting me see specific methods being called and timing information for how long they execute. I output the tracing to the separate trace.axd file in the app's home directory.<trace enabled="true" pageOutput="false" requestLimit="40" traceMode="SortByTime" localOnly="false"/>
With that in place I can now add trace statements into the methods thus:-
if (Trace.IsEnabled)
{
Trace.Write("Entered Page_Load");
} or evenif (Trace.IsEnabled)
{
Trace.Write("gvRow is completed: " + i);
}
These have revealed some interesting things that I must still address:-
1. The page contains a grid with >1,000 rows so when rendering the resultant page there is >1MB being returned to the user's web browser. No wonder it is slow!
2. If the message size returned from the WCF service to the consuming web tier >512Kb (I think) then it takes approx 45seconds to deliver to the Transport layer. There is then a further 45 seconds to pass it from the Transport layer up to the Messaging layer within the presentation tier!
I also believe that a reason for the slow speed is that the site impersonates another user. This is also causing problems in a load balanced environment where the app doesn't seem to be able to call out to the load balancer when calling the WCF services. It can only route the request to http://localhost/MyWCFservices/ServiceEndpoint.svc.
No comments:
Post a Comment