4

I got this error when try to call SQL queries inside a Function App. My plan is get the number of current active request to avoid the limit request error above. I saw that SQL request has these statuses: dormant, running, background, rollback, pending, runnable, spinloop, suspended.

Do you guys knows which statuses that the limit error count?

Nam Vũ
  • 103
  • 1
  • 8
  • How do you now manage SQL connections in your code? – H H Jun 01 '19 at 13:29
  • Does this answer your question? [Azure Sql request limit reached although the number of connections is well below the resource limit](https://stackoverflow.com/questions/37837056/azure-sql-request-limit-reached-although-the-number-of-connections-is-well-below) – Michael Freidgeim May 29 '22 at 11:25

2 Answers2

1

You can run the following queries:

-- Run on master
SELECT * FROM sys.resource_stats ORDER BY end_time DESC;  

or

SELECT * FROM sys.dm_db_resource_stats ORDER BY end_time DESC; 

You can examine max_session_percent and max_worker_percent values on those queries.

My suggestion is to add OPTION (MAXDOP 1) to your queries or set maximum degree of parallelism at the database level.

ALTER DATABASE SCOPED CONFIGURATION SET MAXDOP = 1;
Alberto Morillo
  • 13,893
  • 2
  • 24
  • 30
1

"The request limit for the database is 30 and has been reached"

The status that most likely relates to request count regarding the above error, or rather that you should look at, would be "running" - tasks that are currently being processed. All workers are busy until their task is completed and cannot pick up a pending task, so incoming requests that would create new pending tasks will not be accepted.

"The maximum number of sessions and workers are determined by the service tier and compute size (DTUs and eDTUs). New requests are rejected when session or worker limits are reached, and clients receive an error message."

The error doesn't mean you have to increase the max. The function app could be making too many calls. Or there might be poor performing queries that are hogging resources resulting in long completion times.

If you want to increase the max, for Azure SQL database, the next tier up from Basic would be Standard/S0 with 60 concurrent workers (requests). You can see all the tiers and their limits here.

tameikal
  • 166
  • 1
  • 6