Loading...

Monitoring Synapse serverless SQL open connections

Monitoring Synapse serverless SQL open connections

Scenario: Consider a scenario where you are trying to monitor the connections from other applications to serverless SQL. I hit this need while trying to understand how many connections opened I had coming from an application. Had I hit some kind of limitation on serverless SQL or not. Spoiler: There is no limit for connections on Synapse serverless SQL  as you would find with a dedicated SQL pool (formerly SQL DW).

 

Here it goes how to find how many open connections you have very simply:

1) Open SSMS or Synapse Studio or Azure Data Studio whatever you prefer.

2) Connect to your Synapse  serverless SQL endpoint. If you are not connecting from the Synapse Studio, you can find the endpoint on the  Azure portal when checking your workspace overview details - Fig 1 Overview (yellow).

 

Liliam_Leme_0-1654075233686.png

Fig 1 - Overview

 

3) Now let's check the active sessions and requests. Run the following queries and check the results. This query will expose the sessions and current requests from those sessions in a summarized way. 

 

 

 

 

 

 

Select DB_NAME(s.database_id) as DBName, COUNT(s.database_id) as NumberOfConnections, nt_user_name as username, login_name as LoginName, program_name as ApplicationName FROM sys.dm_exec_requests req JOIN sys.dm_exec_sessions s ON req.session_id = s.session_id GROUP BY s.database_id, nt_user_name, login_name, program_name

 

 

 

 

 

 

Another way to monitor is the next query that will summarize the connections per program, login, and database:

 

 

 

 

 

 

select DB_NAME(database_id) as DBName, nt_user_name as username, login_name as LoginName, program_name as ApplicationName, host_name, program_name, COUNT(*) AS NB_Connections from sys.dm_exec_sessions GROUP BY DB_NAME(database_id) , nt_user_name , login_name , program_name , host_name, program_name

 

 

 

 

 

 

For example, as a result in my own environment I have the following for the second query - Fig 2 Query Results:

 

Liliam_Leme_1-1654076530883.png

Fig. 2  Query results.

 

As a result, information such as SQL or AAD user, login, application, and hostname will be exposed. As also you may note the results of internal sessions related to the Medatasync service on Serverless. Medatasync does what the name implies sync the metadata with other components. This is internal and is not something a user has control over.

 

 

Summary:  The  dynamic managed views (DMVs) above provide you a way to check out the sessions and active requests from those open sessions open. When I used those DMVs to understand the requests I have coming from my application to serverless I could confirm there was no limitation on the open sessions as I mentioned before.

Following are some examples of possible  scenarios to use this logic:

  • Monitor Active connections
  • Monitor users, applications, and hosts connected to the environment.
  • Troubleshooting for a suspicious leak of connections can be applied in any scenario. 

 

 

So for the possible question that you may have up to this point... But...Would that mean is there a hard limit on connections inside serverless?

 

The short answer is No. What must be considered for serverless is not a limited number of connections but the number of active running queries.

Considerations about the active running queries:

  • The number of active sessions and requests would depend on the query complexity and amount of data scanned.  
  • I mean...As with any SQL, a serverless SQL pool could handle many different sessions that are executing lightweight queries or complex heavy queries consuming most of the resources while the other queries wait.

And this is documented as follows:

Check if there is a concurrent workload running on the serverless pool because the other queries might take the resources. In that case you might split the workload on multiple workspaces." 

Self-help for serverless SQL pool

 

 

Note: Thanks to Sergio Fonseca, Silas Mendes, and Ali Saleh on the CSS teamwork side.

 

Liliam C Leme

UK Engineer

Published on:

Learn more
Azure Synapse Analytics Blog articles
Azure Synapse Analytics Blog articles

Azure Synapse Analytics Blog articles

Share post:

Related posts

We're moving!

We’re moving to the Analytics on Azure Tech Community! All new Azure Synapse Analytics content will be published there. In the next few days a...

1 year ago

Upgrade to Azure Synapse runtimes for Apache Spark 3.4 & previous runtimes deprecation

It is important to stay ahead of the curve and keep services up to date. That's why we encourage all Azure Synapse customers with Apache ...

2 years ago

Interpreting Script activity output json with Azure Data Factory\Synapse analytics

Script activity in Azure Data Factory\ Synapse analytics is very helpful to run queries against data sources mentioned here in this document.&...

2 years ago

ADF\Synapse Analytics - Replace Columns names using Rule based mapping in Mapping data flows

In real time, the column names from source might not be uniform, some columns will have a space in it, some other columns will not. For exampl...

2 years ago

Synapse Connectivity Series Part #4 - Advanced network troubleshooting and network trace analysis

Continuing the series of this blog posts I would like to go more advanced on troubleshooting connectivity issues. I would like to thank also&n...

2 years ago

Boost your CICD automation for Synapse SQL Serverless by taking advantage of SSDT and SqlPackage CLI

Introduction   Azure Synapse Analytics Serverless SQL is a query service mostly used over the data in your data lake, for data discovery,...

2 years ago

Metadata-Based Ingestion in Synapse with Delta Lake

  Overview     The crucial first step in any ETL (extract, transform, load) process or data engineering program is ingestion, w...

3 years ago

Missing Fields Added to Dedicated SQL pool Diagnostic Settings Logs

Over the past year, customers have informed the team there were a set of key columns missing in the standalone Dedicated SQL pools (formerly S...

3 years ago

Using Azure DevOps with Synapse Workspaces to create hot fixes in production environments

Have you ever deployed a release to production only to find out a bug has escaped your testing process and now users are being severely impact...

3 years ago

Azure Synapse MVP Corner - March 2023

About this blog series Microsoft Most Valuable Professionals, or MVPs, are technology experts who passionately share their knowledge with the ...

3 years ago
Stay up to date with latest Microsoft Dynamics 365 and Power Platform news!
* Yes, I agree to the privacy policy