SQL Timeout's & Locks
# help-with-umbraco
i
We have both a V8 & V13 website running on Azure appservice which is Plan S1 and Azure SQL Server S0 / 10 DTU's. The site has about 50k+ nodes in the tree. We're seeing a huge amount of SQL timeouts and locks, which we're trying to resolve. What specification of appservice & SQL database's do other people use? The database is setup with DTU based pricing, should we be using a v-core based database? We've followed the recommended Azure setup here: https://docs.umbraco.com/umbraco-cms/13.latest/fundamentals/setup/server-setup/azure-web-apps
k
We only use SQL Server VMs in Azure. Only time we've had problems with timeouts and locks is when background jobs misbehave, taking locks on stuff. What plugins/addons/etc do you have? Do you have any custom background jobs?
i
We have a product importer for Vendr on one of the sites, but we can see that this hasn't been hit today. SQL turned up to 300 DTU's and still maxing out
k
What do the logs say is going on?
If Umbraco does nothing, there should be zero database traffic. And if Umbraco is just "serving web requests", there should be near-zero database traffic. So I think you need to find out what's databasing. Can you run this in development, and turn on SQL logging?
k
That's not an unexpected lock timeout. It looks like a good old congestion issue or database throttling issue.
s
UrlTracker
is mentioned a few times in that stack trace. Also, you said you set it up as in the docs but use an S0 instead of S2 (minimum recommended) database?
50k+ nodes is a lot, maybe you're importing stuff in the background?
i
We've bumped the db upto S4 (200DTU's) and still maxing out at times
s
Cool, that's too high, even Our Umbraco only runs an S2 at 50DTUs and that's on Umbraco v7 which is far from optimized. So yes, as @kdx-perbol suggests, I would investigate where all that DB traffic is coming from, unless your editors are constantly editing it shouldn't see this amount of DB problems. And again, I do wonder what is going on with the URLTracker here, my investigation would definitely start there, especially as that seems to be the cause of the exception you posted. Try and look at all the exceptions and see what percentage of them contain the URLTracker in the trace.
k
If all of them have
UrlTracker.Core.Intercepting.NoLongerExistsInterceptor.<InterceptAsync>d__4.MoveNext()
in them I'd say you have some megajob that "handles missing pages" or something that never completes and fires constantly for some reason. Is that an internal Umbraco
UrlTracker
, or something plugin/addon?
i
Thanks @Sebastiaan @kdx-perbol we're seeing a high number of requests for url's / images that don't exist i.e autodiscover/autodiscover.xml, and I think UrlTracker is then trying to find these with db lookups. We've added some cloudflare filters to block these requests and the db usage is coming down.
s
Might also be worth a check to see if you have the latest version installed! And I'd check the issue tracker/PRs for similar reports https://github.com/Infocaster/UrlTracker
They also have some config options like blocked URLs that you could explore I see.
Although that would probably be too much, as it's a single URL per line..
k
Don't forget to send Infocaster your SQL Azure invoice and a gold medal for outstanding DDOS enablement. 🙂
j
With an attitude like that I sure hope that you pay for all the software that you use 😅
i
now now children 🤣
c
@Ian Houghton there is an app setting or there was where you could turn off the writing of 404s to the database for Url Tracker. Also I agree with the 50DTUs
d
Hello hello, I see URL Tracker is mentioned! The URL Tracker in Umbraco 8 and below can really hog your database resources. We see this ourselves as well. We don't do any support for Umbraco 8 anymore, but I have personally put extra effort into optimizing the URL Tracker for Umbraco 13. I would definitely recommend updating to the latest v13.
Should you have need to filter tracking for a large variety of URLs, then you can extend the url tracker with a custom filter in C#, that would probably be better than adding loads of urls in the appsettings
And as others have already pointed out: turn off the features that you don't need
s
Ah I thought this was v13, but might be v8! Did that error come from v8?
d
I noticed "IncomingRequestEventSubscriber" in the stacktrace in the .txt file, which, iirc, is specifically from the v8 version.
The latest v13 version can be configured so that it does 0 database calls on request threads. If you're alright with keeping all your redirects in-memory at all times.
j
Okay, this is totally my bag... bear with me as I ask a LOT of questions. When you say "maxing out" what does that look like? 100% DTU utilisation on the database - do you have a graph? It would be helpful to double check the bottleneck is the database itself and not IO/thread starvation etc. If so, can do this approach to find what queries are using up all the resources? https://learn.microsoft.com/en-us/azure/azure-sql/database/query-performance-insight-use?view=azuresql You mentioned Vendr. Is that for both these sites? The performance dynamic with Vendr will be very different from a "regular" umbraco site as it talks to the database a lot more. An S1 web app is not really good enough for high traffic/performance Umbraco sites and certainly not good enough for Vendr - it uses magnetic storage and the network IO is slower. For a site that's making a lot of SQL (TCP/network) calls that matters. Starting point for us is always P0V3. Recommended database SKU is tricky as it depends on node count, content complexity and versions. It's very easy to have a site that runs fine but is incapable of a cold boot or upgrade (with inevitable database reindexing) as it needs to read every property value of every node.
I've also had the redirects issue albeit with a different package, and I noted 4 (blocking) SQL queries for each 404 😓 (at least one of which is Umbraco itself). Adding redirect rules at the edge (Cloudflare) fixed that for us. I notice you mentioned autodiscover.xml - how much spurious traffic you're getting? Are there any other common URLs for cyber attacks being hammered (e.g. wp-login.php)? If so, then the best thing to do is enable Cloudflare's WAF to deal with that. Whether or not your app is performant is irrelevant if your under attack - nix that traffic at the source and don't waste your app's CPU cycles on them.
l
- We run most of our sites in S0, S1 or S2, but most on S1. - Check is The SQL Database in Azure has performance recommendations. I once made the mistake to very actively use the ConsentService in Umbraco, which is practically just a CRUD service directly on the database. Creating an additional index on the database made the DTUs from regularly hitting 80-90% to 4%.
k
For reference, the load Umbraco incurs on our SQL Server Azure VMs is minimal. And we are on a relatively cheap VM tier. We use Azure SQL as well for other stuff, but we've deemed SQL Server a better fit for Umbraco. (Including Umbraco upgrades.)
i
the error came from V8 (which has Vendr) installed, but also a Product Importer (but this only runs on demand in hangfire)
we've since blocked a bunch of spurious requests via Cloudflare WAF, and the site has settled down slightly
For reference: the V8 site is running Vendr (mostly a brochure site with some ecommerce) - site is being upgraded to V13 & Commerce at the moment the V13 site is basically a portal for device management, but it does make a lot of database requests through an API sitting on top of Umbraco. Either to update nodes in Umbraco, or custom tables
j
Cool, when you say settled down, what does that mean in terms of stats? Response times? DTU utilization on the database? Fewer errors?
25 Views