I'm looking for some guidance on optimizing the performance of my Azure App Service and SQL Database. My app is lightweight, using about 256 MB of RAM with .NET Core 9 on a 64-bit architecture. The database has over 20 years of data and is currently around 400 MB in size, with a client/lead table containing over 40,000 records and roughly 60 columns each. Right now, I'm on a Standard database tier (10 DTUs) which costs about $15 a month, and I've noticed that my DTU usage peaks at 29%.
A common scenario involves typing a client's last name into a search box. When running the app locally, results come up quickly in about 2 seconds, but when it's on Azure App Service (Premium v3 P1V3), it takes 4 to 10 seconds, and occasionally there are long delays. The most complex queries take about 15 seconds locally but can take up to 30 seconds on Azure, sometimes timing out.
Given that I'm currently paying $254.77/month for the App Service, while the database is just $15/month, it seems to me that my App Service is underperforming, especially in comparison to local performance. Should I be scaling up my database instead or consider different app container options? I need to get this sorted out for a new internal and client application rollout without breaking the bank!
4 Answers
It sounds like your app might need some indexing! Adding indexes could significantly improve your query times. Also, consider checking out Azure SQL's index recommendations feature—it can help pinpoint where you might need more optimization.
Have you tried using Application Insights? It can help you identify performance bottlenecks in your application, which might point to what's slowing things down besides just the database scaling.
By the way, are you using Entity Framework for your queries or writing them manually? I've had similar issues and found a mix of both helped in some cases.
It's a mix for me too! Some stored procedures for heavy lifting and others done in EF for flexibility.
Honestly, it seems like your app and database aren't that large, so scaling issues might be tied to the architecture rather than the resource limits. Transitioning to a vCPU pricing model instead of DTUs could provide better performance, too.
Absolutely! Plus, I've worked with some great database consultants who could help if you're looking for that extra expertise.