Hi developer-0760,
Thankyou for reaching Microsoft Q&A. It looks like the spike in sessions is happening because your elastic pool has a limit on how many connections and requests can run at one time and that limit is shared across all the databases in the pool. If your upgrade process runs when other apps or jobs are already connected to the pool, your total active sessions can suddenly jump and hit that limit, causing errors. That’s why you’re seeing it in production but not in your quieter test pool.
Here are some things you can do:
1.Try to make sure your code always closes database connections when it’s done using them, instead of keeping one connection open all the time. Short-lived connections are best.
2.Avoid constantly changing connection details in your app, as each new variation can create extra connections behind the scenes.
3.If you’re running lots of scripts in parallel, try reducing how many run at once so you don’t create a big burst of sessions.
4.You can track who’s connecting by running a simple query during the upgrade. This helps spot who or what is creating extra connections.
5.If this keeps happening, think about running upgrades in a pool with fewer other jobs or increasing resources for your elastic pool.
Helpful References:
1.Tech Community: Session Limit in Elastic Pool
2. Best Practice for Disposing Connections
3.Guide to Sessions in Azure SQL
Please let us know if you have any questions and concerns.