none
performance counter which shows when garbage collector suspends all threads RRS feed

  • Question

  • I would like to implement real-time application on C# which will provide price real-time with time precision 100ms or faster.

    I know that Garbage Collector sometimes suspend all .NET threads for 1-2 second  or more, which is depends on memory consumtion.

    How to find the Performance Counter which shows 100% that GC decided to suspend all threads for some time.

    For my application/service is critically important to have prices provided without delays >100ms, or it will be money loss.

    Thank you for help.

     


    RUV


    Tuesday, July 29, 2014 9:07 AM

Answers

  • Hi Roman,

    In the .NET Framework 4.5, CLR term has delivered background server garbage collection. You can see more information from http://msdn.microsoft.com/library/ee787088(v=vs.110).aspx#background_server_garbage_collection.

    >I only need to find performance counter which will shows that GC decided to freeze all threads.

    Per my understanding, GC ETW events can help you. You can go through the reference to find more. http://msdn.microsoft.com/en-us/library/ff356162(v=vs.110).aspx.

    Hope useful.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    • Marked as answer by Roman Uvarov Wednesday, July 30, 2014 7:23 AM
    Wednesday, July 30, 2014 2:08 AM
    Moderator

All replies

  • Hello,

    Currently, I am working on a server real time (500 000 updates / sec) for trading market. 

    You need to avoid using garbage collector and to do that, you could use struct against class to allocate on the stack and not on the heap by garbage collector.

    I don't have any issue with the garbage collector and 1-2 secondes is very long and I have never seen this using time for garbage collection.

    You could force the garbage collection but, for me, it is not a good idea.

    I am using performance monitor from Windows to check the CPU time used by 3 generations of garbage collection.

    To test when garbage collection was launched, I used that:

    Garbage Collection Notifications

    It's interisting if you want to manage in your code when .net execute garbage collection.

    I also used WinDBG but this tool is a little bit complex but very performed.

    Regards

    Cédric




    Tuesday, July 29, 2014 9:15 AM
  • Garbage collection algorithms are always slow.  It is some times more efficient to clone the stack skipping the deleted the objects and then dispose the original stack. 

    You also can build your own garabage collection if your stack uses pointers for previous and next object.  Simply unlink the deleted object from the stack and put empty object on your own garbage list.  When you need a new object simply link back an object from the garbage list.  If the garbage list is empty then allocate and new object.


    jdweng

    Tuesday, July 29, 2014 10:23 AM
  • I only need to find performance counter which will shows that GC decided to freeze all threads.

    Not sure why it looks like this is quite complicated task.


    RUV

    Tuesday, July 29, 2014 2:59 PM
  • Hi Roman,

    In the .NET Framework 4.5, CLR term has delivered background server garbage collection. You can see more information from http://msdn.microsoft.com/library/ee787088(v=vs.110).aspx#background_server_garbage_collection.

    >I only need to find performance counter which will shows that GC decided to freeze all threads.

    Per my understanding, GC ETW events can help you. You can go through the reference to find more. http://msdn.microsoft.com/en-us/library/ff356162(v=vs.110).aspx.

    Hope useful.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    • Marked as answer by Roman Uvarov Wednesday, July 30, 2014 7:23 AM
    Wednesday, July 30, 2014 2:08 AM
    Moderator
  • based on pointing to ETW events I manage to google ETW tool PerfView, which is seems what I need for now.

    Thank you for help


    RUV

    Wednesday, July 30, 2014 7:24 AM