Coldfusion to Azure sql, Connection retry logic implementations?
Copy link to clipboard
Copied
Hi
Just wondering if anyone has any experience with implementing connection retry logic with Coldfusion and Azure sql, to handle transient connection failures. I have an application that is hosted on Azure with Azure SQL and there have been a few instances where the DB has failovered intermittently while a user was requesting a page, thus resulting in an error. Looking to see how I can minimize this impact and make it a seamless experience on the user's end when this occurs. I've looked at https://docs.microsoft.com/en-us/ef/ef6/fundamentals/connection-resiliency/retry-logic which is based on an EF6 library.
Thanks!
Copy link to clipboard
Copied
CF's database interaction is typically not as low-level as the code you're showing. But there's no reason why you couldn't handle connection failures at a higher level using CFTRY/CFCATCH or even higher-level error handling. If this happens a lot, there's no reason why you couldn't build a wrapper that lets you try a database connection, catch a connection failure caused by this behavior, wait briefly if needed, then retry the database connection. Presumably if you have the same problem a second time you'd want to respond with an actual error state, I guess.
Dave Watts, Eidolon LLC
Copy link to clipboard
Copied
2 suggestions in addition to Dave's:
- ensure that Maintain Connections is enabled for the datasource.
- use the cachedWithin attribute for queries that do not change often; ColdFusion would then use the value from cache rather than make another trip to the database.
Copy link to clipboard
Copied
Thanks for the suggestions guys.. I've added what you suggested Dave to the onRequestStart method of the application.cfc so will monitor and see how it goes with handling the issues.

