TraceEventSession usage in ServiceFabric applicati

2019-05-06 14:24发布

问题:

I have a State-full service fabric application running in a cluster.. I have about 20 State-full applications running in the same cluster. i have used TraceEventSession for correlation purposes. My cluster is having 10 nodes. When i deploy an application i am able to see the TPL session running active in Performance Monitor. When the number of application deployed in the cluster increased i started receiving the error specified

Insufficient system resources exist to complete the requested service. (Exception from HRESULT: 0x800705AA)

System.Runtime.InteropServices.COMException (0x800705AA): Insufficient system resources exist to complete the requested service. (Exception from HRESULT: 0x800705AA) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.Diagnostics.Tracing.Session.TraceEventSession.EnableProvider(Guid providerGuid, TraceEventLevel providerLevel, UInt64 matchAnyKeywords, TraceEventProviderOptions options) at TestApp.Service.Program.Main() in C:\Agent_work\12\s\TestApp\TestApp.Service\Program.cs:line 61

this is the code i wrote in program.cs to enable the tpl session

session = new TraceEventSession("TestApp_TplSession");  
session.EnableProvider(TplEtwProviderTraceEventParser.ProviderGuid, TraceEventLevel.Verbose,
                        (ulong)TplEtwProviderTraceEventParser.Keywords.TasksFlowActivityIds);

session.EnableProvider(ServiceEventSource.Current.Name);

I am not sure of how many state full service application will be deployed in the same cluster. How will i get rid of this error??

回答1:

Windows has a limit of 64 ETW sessions that can be running concurrently. Consider using a single stateless app running on every node to create a single session.