Results 1 to 5 of 5
  1. #1

    Unhappy DotNetAdapter LOH fragmentation and latent release of subscription strings on SOH


    In our environment we're experiencing both the fragmentation of the .NET LOH (Large Object Heap) and the rather slow release of subscription strings generated by the .NET Lightstreamer Adapter libraries. Memory profiling has indicated that instance(s) of the object Lightstreamer.DotNet.Server.RequestReply.NotifySen der executing Run()
    is holding onto Lightstreamer subscription strings presumably generated by the Lightstreamer adapter libraries. These subscription strings are observed in the format of: "1361213581995|UD3|S|VIS.USV.02....COMMAND|S|. ..." and are around 1K each.

    A screenshot from the profiler appears below. In this particular scenario, the aforementioned Lightstreamer object type was still referencing over 450MB in subscription string objects in the Generation 2 SOH. This occurred when we had 25 clients each establish a unique subscription for ~130,000 items 30 seconds apart from each other. (client1, client2 30 seconds later, ...) The Lightstreamer.DotNet.Server.RequestReply.NotifySen der object(s) were still referencing the subscription strings long after each client had received their snapshot request from the Lightstreamer server. We've also noticed that the NotifySender.Run() continues to reference ArrayList objects on the LOH. So it would appear that these large ArrayList objects are continually created in the LOH and fragmenting the LOH.

    Click image for larger version. 

Name:	LightstreamerGen2SOH1Schriever.png 
Views:	601 
Size:	21.8 KB 
ID:	130

    We've tried tuning the Data Adapter's app.config file by specifying different values for either gcServer enabled or gcConconcurrent enabled/disabled. These changes have not altered the rapid rise in Generation 2 SOH memory consumption.

    Please advise.


    Environment Info:
    - Lightstreamer Server: Presto version 4.2
    - Lightstreamer DotNetAdapter_N2 DLL: v2.0.50727 / 1.7.4175.16355
    - OS: Windows 2008 R2 SP1 / .NET 4.0
    Last edited by bkretschmer; February 21st, 2013 at 12:36 AM. Reason: Additional screenshot.

  2. #2
    Join Date
    Jul 2006
    With a huge amount of updates generated in a loop (such as upon a subscription for 130000 items all of which produce a snapshot) the mentioned _queue object can grow significantly, but we expect that all the contained strings are released before they are sent through the network.

    Can you confirm that you could see strings hanging in the queue after the Adapter had terminated the transmission of all the updates?

    Otherwise, it is possible that at very high update rates the library can never manage to empty the queue completely.
    Would you notice the same issue by lowering the number of items, or would you notice a threshold effect?

    About the continuous creation of large array objects, can you identify some of them?
    The mentioned _queue object is never recreated, but its internal components may and this is an aspect that may leave room for optimizations.

  3. #3
    The screenshot below(Lightstreamer4.2SOHGen2SubscriptionStrings.p ng) shows the subscription strings identified by the ANTs memory profiler as being retained in Gen 2 SOH (small object heap) by the NotifySender object mentioned in the first posting. This memory snapshot was taken ~4 minutes after the client had received the push data from the Lightstreamer server. The second screenshot (LightstreamerLOHLargeArrays.png) shows the creation of the large array objects on the LOH. These eventually get cleaned up, but could really fragment the LOH and lead to system degradation over time. The last two screenshots show the instance retention graphs for the object arrays held by Lightstreamer in the LOH.

    We are currently running threshold tests based on longer time intervals between initial subscription snapshot requests. Once we complete this, we may also have to undertake data volume threshold testing as well. The rapid SOH rowth due to the subscription string references hanging around in the Lightstreamer Adapter objects has now become a large technical risk for us. The fragmentation of the LOH is also of serious concern for the operational stability of the system over time.

    Is there testing you can do on your end to independently verify these issues?

    Click image for larger version. 

Name:	Lightstreamer4.2SOHGen2SubscriptionStrings.jpg 
Views:	593 
Size:	52.8 KB 
ID:	136 Click image for larger version. 

Name:	LightstreamerLOHLargeArrays.PNG 
Views:	578 
Size:	44.8 KB 
ID:	135 Click image for larger version. 

Name:	LightstreamerLOHInstanceRetentionGraph1.PNG 
Views:	523 
Size:	25.4 KB 
ID:	137Click image for larger version. 

Name:	LightstreamerLOHInstanceRetentionGraph2.PNG 
Views:	581 
Size:	25.2 KB 
ID:	138
    Last edited by bkretschmer; February 22nd, 2013 at 02:38 AM.

  4. #4
    Join Date
    Jul 2006
    We have not tested the .NET Remote Adapter library against a high load because, from our point of view, this is not the inner loop of the system, as
    • client subscriptions are expected to have a many to one relationship with subscription requests to the Data Adapter;
    • the update flow from the Data Adapter is also expected to be significantly lower than the outbound flow managed by the Server.

    In fact, as the last resort, one always has the option to get rid of our .NET library and communicate from the back-end to the Server by directly leaning on the ARI protocol, as documented in the Adapter Remoting Infrastructure SDK.

    As far as the code is concerned, we don't notice any memory leak related with strings retained, nor a creation of array objects.
    A persistency issue may arise in one of the internal queues, which is cleaned up later than needed, but simply because it is cleared after the next event is produced;
    so, the issue is visible only if you send many events in a loop and then stop producing events suddenly, but, in fact, this should be considered as a "false positive".

    In order to try to replicate and analyze your case in depth, we suggest you interacting with us by writing us at

  5. #5
    Thank you. I will submit additional questions to referencing this forum thread.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT +1. The time now is 03:32 PM.