I'm running a SignalR Scaleout service with multiple web servers on the front side and a Windows Service on the back side. Both share the same Hub and the Windows Service is generating a lot of broadcast messages to different groups of clients. Everything is working fine, except that the Windows Service is loosing lots of memory over time. After the start of the service it need 100MB and after a week or so it is over 1000 MB.
I did a heap snapshot after 2 days an it shows me that all the memory is used here (i hope this is of any use for you):
<root> : 260 MB (100,00%)
Other, Pinning <root>->Other, Pinning->(System.Object []): 258 MB (99,50%)
System.Object [] Other, Pinning->System.Object []->(System.RuntimeType,System.String,System.WeakReference [],...): 247 MB (95,20%) (1 object, 32 kB (0,01%))
System.Lazy<T> System.Object []->System.Lazy<T>->(System.Func<T>,System.Lazy<T>.Boxed): 241 MB (92,62%) (6 objects, 240 bytes (0,00%))
System.Lazy<T>.Boxed System.Lazy<T>->System.Lazy<T>.Boxed->(Microsoft.AspNet.SignalR.DefaultDependencyResolver): 241 MB (92,62%) (1 object, 24 bytes (0,00%))
Microsoft.AspNet.SignalR.DefaultDependencyResolver System.Lazy<T>.Boxed->Microsoft.AspNet.SignalR.DefaultDependencyResolver->(System.Collections.Generic.Dictionary<T,U>): 241 MB (92,62%) (1 object, 40 bytes (0,00%))
System.Collections.Generic.HashSet<T> Microsoft.AspNet.SignalR.DefaultDependencyResolver->System.Collections.Generic.HashSet<T>->(System.Collections.Generic.ObjectEqualityComparer<T>,System.Int32 []): 241 MB (92,61%) (1 object, 64 bytes (0,00%))
System.Collections.Generic.HashSet<T>.Slot [] System.Collections.Generic.HashSet<T>->System.Collections.Generic.HashSet<T>.Slot []->(Microsoft.AspNet.SignalR.ServiceBus.ServiceBusMessageBus): 241 MB (92,61%) (1 object, 72 bytes (0,00%))
Microsoft.AspNet.SignalR.ServiceBus.ServiceBusMessageBus System.Collections.Generic.HashSet<T>.Slot []->Microsoft.AspNet.SignalR.ServiceBus.ServiceBusMessageBus->(Microsoft.AspNet.SignalR.Messaging.MessageBroker,Microsoft.AspNet.SignalR.Tracing.TraceManager,System.Threading.Timer,...): 241 MB (92,61%) (1 object, 240 bytes (0,00%))
System.Lazy<T> Microsoft.AspNet.SignalR.ServiceBus.ServiceBusMessageBus->System.Lazy<T>->(System.Func<T>,System.Lazy<T>.Boxed): 238 MB (91,62%) (1 object, 40 bytes (0,00%))
System.Lazy<T>.Boxed System.Lazy<T>->System.Lazy<T>.Boxed->(Microsoft.AspNet.SignalR.Messaging.ScaleoutStreamManager): 238 MB (91,62%) (1 object, 24 bytes (0,00%))
Microsoft.AspNet.SignalR.Messaging.ScaleoutStreamManager System.Lazy<T>.Boxed->Microsoft.AspNet.SignalR.Messaging.ScaleoutStreamManager->(Microsoft.AspNet.SignalR.Messaging.ScaleoutStream [],System.Func<T,U,V>): 238 MB (91,62%) (1 object, 48 bytes (0,00%))
System.Collections.ObjectModel.ReadOnlyCollection<T> Microsoft.AspNet.SignalR.Messaging.ScaleoutStreamManager->System.Collections.ObjectModel.ReadOnlyCollection<T>->(Microsoft.AspNet.SignalR.Messaging.ScaleoutMappingStore []): 238 MB (91,62%) (1 object, 32 bytes (0,00%))
Microsoft.AspNet.SignalR.Messaging.ScaleoutMappingStore [] System.Collections.ObjectModel.ReadOnlyCollection<T>->Microsoft.AspNet.SignalR.Messaging.ScaleoutMappingStore []->(Microsoft.AspNet.SignalR.Messaging.ScaleoutMappingStore): 238 MB (91,62%) (1 object, 72 bytes (0,00%))
Microsoft.AspNet.SignalR.Messaging.ScaleoutMappingStore Microsoft.AspNet.SignalR.Messaging.ScaleoutMappingStore []->Microsoft.AspNet.SignalR.Messaging.ScaleoutMappingStore->(Microsoft.AspNet.SignalR.Messaging.ScaleoutStore): 238 MB (91,62%) (5 objects, 120 bytes (0,00%))
Microsoft.AspNet.SignalR.Messaging.ScaleoutStore Microsoft.AspNet.SignalR.Messaging.ScaleoutMappingStore->Microsoft.AspNet.SignalR.Messaging.ScaleoutStore->(Microsoft.AspNet.SignalR.Messaging.ScaleoutStore.Fragment []): 238 MB (91,62%) (5 objects, 320 bytes (0,00%))
Microsoft.AspNet.SignalR.Messaging.ScaleoutStore.Fragment [] Microsoft.AspNet.SignalR.Messaging.ScaleoutStore->Microsoft.AspNet.SignalR.Messaging.ScaleoutStore.Fragment []->(Microsoft.AspNet.SignalR.Messaging.ScaleoutStore.Fragment): 238 MB (91,62%) (5 objects, 5,0 kB (0,00%))
Microsoft.AspNet.SignalR.Messaging.ScaleoutStore.Fragment Microsoft.AspNet.SignalR.Messaging.ScaleoutStore.Fragment []->Microsoft.AspNet.SignalR.Messaging.ScaleoutStore.Fragment->(Microsoft.AspNet.SignalR.Messaging.ScaleoutMapping []): 238 MB (91,61%) (101 objects, 5,5 kB (0,00%))
Microsoft.AspNet.SignalR.Messaging.ScaleoutMapping [] Microsoft.AspNet.SignalR.Messaging.ScaleoutStore.Fragment->Microsoft.AspNet.SignalR.Messaging.ScaleoutMapping []->(Microsoft.AspNet.SignalR.Messaging.ScaleoutMapping): 238 MB (91,61%) (101 objects, 6,3 MB (2,43%))
Microsoft.AspNet.SignalR.Messaging.ScaleoutMapping Microsoft.AspNet.SignalR.Messaging.ScaleoutMapping []->Microsoft.AspNet.SignalR.Messaging.ScaleoutMapping->(Microsoft.AspNet.SignalR.Messaging.LocalEventKeyInfo []): 232 MB (89,18%) (808652 objects, 31 MB (11,88%))
Microsoft.AspNet.SignalR.Messaging.LocalEventKeyInfo [] Microsoft.AspNet.SignalR.Messaging.ScaleoutMapping->Microsoft.AspNet.SignalR.Messaging.LocalEventKeyInfo []->(Microsoft.AspNet.SignalR.Messaging.LocalEventKeyInfo): 201 MB (77,30%) (808657 objects, 31 MB (11,88%))
Microsoft.AspNet.SignalR.Messaging.LocalEventKeyInfo Microsoft.AspNet.SignalR.Messaging.LocalEventKeyInfo []->Microsoft.AspNet.SignalR.Messaging.LocalEventKeyInfo->(System.WeakReference): 170 MB (65,43%) (808657 objects, 31 MB (11,88%))
System.String Microsoft.AspNet.SignalR.Messaging.LocalEventKeyInfo->System.String: 121 MB (46,43%) (804331 objects, 121 MB (46,43%))
It would be great if someone could give me an advice what i could do to keep the memory usage low. Thanks a lot!
Hi,
I'm running a SignalR Scaleout service with multiple web servers on the front side and a Windows Service on the back side. Both share the same Hub and the Windows Service is generating a lot of broadcast messages to different groups of clients. Everything is working fine, except that the Windows Service is loosing lots of memory over time. After the start of the service it need 100MB and after a week or so it is over 1000 MB.
I did a heap snapshot after 2 days an it shows me that all the memory is used here (i hope this is of any use for you):
It would be great if someone could give me an advice what i could do to keep the memory usage low. Thanks a lot!