locked
Extended Events Clarification on max memory size RRS feed

  • Question

  • Hi,

    I would like to know the maximum limit of event session memory size 

    Max memory size (sys.server_event_session_fields.max_memory)

    I have a machine with 

    Total Physical Mem: 61 GB
    Max Server Memory : 60GB

    I've tried to check the maximum memory size limit. It takes upto 2GB, not sure how that is?

    ALTER EVENT SESSION [xe2] ON SERVER  ADD TARGET package0.ring_buffer(SET max_memory=(<memory here>))

    In that command if I supply 1GB/2GB for <memory here> it works and if I supply 3GB it will fails saying 

    Msg 25641, Level 16, State 0, Line 19
    For target, "package0.ring_buffer", the parameter "max_memory" passed is invalid. 

    Anyone knows how the limit is calculated?

    Second question on this. 

    I've set 'max server memory (MB)',1048576 (1GB) and I was able to create ring buffer session with max memory of the event session to 2GB. Can the ring buffer target memory surpass 'max server memory (MB)' also?


    • Edited by bolapati Tuesday, January 22, 2019 6:04 PM
    Tuesday, January 22, 2019 5:54 PM

Answers

  • Hi bolapati,

     

    In my machine, I have the same scenario. I also can just set max_memory upto 4GB for ring buffer. If the max_memory is more than 4 GB, the error in your original post will appear.

     

    We can see from the Ring Buffer Target document, the max_memory option allows any 32 bit integer. The 32 bit integer ranges from 0 to 2^32=4294967296. 4294967296 bit = 4GB. As a result, we can just set the max_memory with the value that is less than 4GB.

     

    Best Regards,

    Emily


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by bolapati Thursday, January 24, 2019 8:19 PM
    Thursday, January 24, 2019 6:39 AM

All replies

  • Hi bolapati,

     

    >>In that command if I supply 1GB/2GB for <memory here> it works and if I supply 3GB it will fails saying

     

    >>Msg 25641, Level 16, State 0, Line 19

    >>For target, "package0.ring_buffer", the parameter "max_memory" passed is invalid.

     

    Based on my test, I can specify the value for max_memory to 3GB. Because I don't set the limitation for the value. You can check the limitation for the max_memory via the following command.

     

    select * from sys.dm_xe_object_columns where name='max_memory'

     

    >>Can the ring buffer target memory surpass 'max server memory (MB)' also?

     

    No, even though you can create it, but it will get errors when the target memory will reach to the max server memory. And if you are using the ring buffer target, it is recommended that you set the max_memory target parameter to 2048 kilobytes (KB) to help avoid possible data truncation of the XML output.

    For more details, please refer to the document: Buffer management.

     

    Best Regards,

    Emily


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com


    Wednesday, January 23, 2019 8:38 AM
  • Thank you!

    I think I was also able to set max_memory upto 4GB (not including) for ring buffer. I ran the below query


    select * from sys.dm_xe_object_columns where name='max_memory'

    but I did not see a column that defines this limit (3gb).

    thanks for answering the second question as well. 


    • Edited by bolapati Wednesday, January 23, 2019 9:06 PM
    Wednesday, January 23, 2019 6:32 PM
  • Hi bolapati,

     

    In my machine, I have the same scenario. I also can just set max_memory upto 4GB for ring buffer. If the max_memory is more than 4 GB, the error in your original post will appear.

     

    We can see from the Ring Buffer Target document, the max_memory option allows any 32 bit integer. The 32 bit integer ranges from 0 to 2^32=4294967296. 4294967296 bit = 4GB. As a result, we can just set the max_memory with the value that is less than 4GB.

     

    Best Regards,

    Emily


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by bolapati Thursday, January 24, 2019 8:19 PM
    Thursday, January 24, 2019 6:39 AM
  • thank you.
    Thursday, January 24, 2019 8:19 PM
  • I've learned via a support case, that the threshold across all Azure SQL databases on an Azure SQL "Server" is 524MB when using the ring buffer. It is dynamically adjusted by the system, and we dont have any direct control over it.  This is much smaller than the usual SQL Server value quoted here ( < 4GB)
    Monday, February 10, 2020 1:48 AM