Azure Limitation on XEvent Memory for Slow Queries #138
Replies: 5 comments 8 replies
-
I've bumped against this limitation also - it's a bit frustrating. My recommendation to workaround it is to be selective about which DBs you capture slow queries for. For AzureDB you just need to set a connection to the master DB and it will add the other DBs without you needing to add individual connections. If you have slow query capture on master - all the databases inherit this setting. I would turn off slow query capture on master then add explicit connections to the most critical databases - turning on slow query capture as required (within the limitations). In the service config tool there is a button to scan for azure db connections to add the individual DBs to the config. Query store doesn't capture the same data. The extended events are capturing individual rpc & batch completed events. The query store data is captured at the plan level and the data is aggregated rather than capturing individual executions. Query store data is still very useful - it's just different from the slow query capture. DBA Dash doesn't do any statement/plan level capture (except the running query snapshots) - Query store is good to compliment what is collected by DBA Dash. If there is a better workaround I would be interested. Hope this helps |
Beta Was this translation helpful? Give feedback.
-
I got feedback from Microsoft and have tested their advice successfully. Looks like all we need to do is add "(SET max_memory = ????)" to the ADD TARGET section (replacing ???? with the value for max memory). So maybe in the admin GUI we add a column for "Target Max Memory" or just reuse the "Slow Query Session Max Memory (KB)" value for this one as well. CREATE EVENT SESSION [DBADash_1] ON DATABASE |
Beta Was this translation helpful? Give feedback.
-
As a workaround, there is an option in the service config tool to "Persist XE Sessions". The app won't drop/re-create the event sessions with this option enabled which allows you to alter the configuration of the event session as needed. For example, adding the max_memory setting or adding some filters. |
Beta Was this translation helpful? Give feedback.
-
I'm still confused as to how much max memory I should configure when encountering this problem. The doc (https://dbadash.com/docs/help/slow-queries/#azure-db) doesn't mention it either. Also, is "-1" a default value? If I run this "SELECT * FROM sys.dm_xe_database_sessions", the total_target_memory is 500KB. Should I put 32 in the slow Query Target Max Memory inDBA Dash Service Config? |
Beta Was this translation helpful? Give feedback.
-
So Microsoft has decided to limit the amount of memory that can be used for Extended Events, not only at the database level, but also at the elastic pool level. If it were only at the database level then we would be good, but we have an elastic pool with 52 databases in it sharing resources and even if we set the memory to be used in the XEvent to 256KB it still isn't enough to do 52 databases. We were looking to do some DML capture at one time and ran into the same thing and worked with Microsoft to understand the issue, so this is confirmed directly with Microsoft.
https://docs.microsoft.com/en-us/azure/azure-sql/database/xevent-db-diff-from-svr#performance-considerations
I'm wondering if anyone has an idea on how this could still be accomplished? I don't know if it would be feasible to pull some of this from the Query Store DMV's directly, though I know it wouldn't be as complete as we use Auto to only grab queries that are causing waits...but maybe that's okay?
Error (Abbreviated):
"Microsoft.Data.SqlClient.SqlException (0x80131904): Operation failed. Operation will cause database event session memory to exceed allowed limit. Event session memory may be released by stopping active sessions or altering session memory options. Check sys.dm_xe_database_sessions for active sessions that can be stopped or altered. If no sessions are active on this database, please check sessions running on other databases under the same logical server.
The event session has already been stopped. Error Number:25747,State:1,Class:16"
Beta Was this translation helpful? Give feedback.
All reactions