HPC Pack SOA Tutorial V: Diagnose a SOA Service
It’s not an easy job to write an HPC application with complex algorithms, but it’s even more difficult to troubleshoot the application. This tutorial is to introduce how to diagnose the SOA application.
Get SOA logs
In HPC Pack 2012, it is much easier to get the SOA-related logs from HPC Cluster Manager. To enable SOA logging, in Configuration -> Services, click Set Event Logging Level to set the log level. See the following figure.
Then you can try to call the service. After the SOA job finishes, you can right-click on the last job executed, then click Export SOA Trace to export all the SOA-related logs. Note that these actions are only applicable to SOA jobs.
Export SOA Trace exports a zip file which contains several .csv files and .evtx files. The .csv files have all the SOA-related logs of all the compute nodes which ran the SOA tasks. Each .csv file corresponds to one compute node. The .evtx files have more log information generated by HPC Pack to help further diagnostics.
Writing to a log
The next question is how to write logs in your own SOA service. HPC Pack 2012 provides a logging framework. See the accompanying code sample to follow these steps to use the framework.
In a SOA service you can use code like the following to add your own log, and the log can then be accessed from HPC Cluster Manager.
ServiceContext.Logger.TraceInformation("Get a request to factorize {0}", n);
|
In above sample, the log level is Information. So you need to make sure the log level of the service is set to information or verbose. You can use HPC Cluster Manager to set the level, as we did previously, or you can change the service configuration file to set the log level.
<microsoft.Hpc.Session.ServiceRegistration> <serviceassembly="\\head.contoso\SOAServices\Diagnostic.PrimeFactorization.dll" stdError=""soaDiagTraceLevel="Information, ActivityTracing" /> </microsoft.Hpc.Session.ServiceRegistration> |
Now invoke the service again. To view the log, click View Message Details dialog for the job.
In the dialog box that appears you can see all the requests. Click one of the requests, and you can see your log information.
If you want to export the log files, as was shown previously, the .csv files will contain all your service log data.
Debug
HPC Pack provides a Visual Studio plug-in to help debug the service. With that you can attach to all the compute nodes for debugging. For more information, see Microsoft HPC Debugger Add-ins for Visual Studio.