I have a rather strange scenario. We have a range of WEBAPIs hosted on the cloud. We consume those services in our Windows 8 application. The problem is when the services are running locally it takes less than 400ms but when hosted on Windows azure it takes upto 20 seconds for some requests. I have checked the indexes of our database tables and its fine. I have no clue so as to what to profile and how to improve the performance. Thanks!
-
The latency of SQL Azure can be quite the killer if you end up doing many database requests (ie [n+1](http://stackoverflow.com/questions/97197/what-is-the-n1-selects-issue) can do nasty things). – Joachim Isaksson Aug 06 '13 at 04:34
-
If it is not database issue, you may try [CloudUp](http://www.thecloudup.com), which visits your website every certain minutes to keep it awake. This proves to be an effective way to solve first-connection-slowness issue. – Jeff Jia Jun 03 '14 at 19:48
2 Answers
Everyone Thanks a lot! But I found a way to use dottrace(Excellent profiling tool) on the azure deployment. Here is the link
You can also use windows azure diagnostics and stopwatch class to log all times to the wad tables. Also found out that the first request to the azure service is always slow in another thread. Have just copied it here below
Serkan, you would need to first make sure in your post, weather you have published a Cloud Service or a Website to Windows Azure. Based on Cloud Service (A Web Role) or a WebSite the answer to your question will be different. As you want to learn more I would explain what goes on behind.
As you suggested that your first connection is slow, I can see that happen with Windows Azure Websites. Windows Azure Websites are running in shared pool of resources and uses the concept of hot (active) and cold (inactive) sites in which if a websites has no active connection for x amount of time, the site goes into cold state means the host IIS process exits. When a new connection is made to that websites it takes a few seconds to get the site ready and working. Depend on how your first page code is, the time to load the site for the first time varies. Similar discussion is logged: Very slow opening MySQL connection using MySQL Connector for .net
With Windows Azure Cloud Service the overall application model is different. Your webrole has its own IIS server which is fully dedicated to your application and above Website limitation does not occur however there could be other reasons which could have slower page load. If you are using WebRole, then what you could do is run a page load profiler first and RD to your Azure Instance to collect the page load data to see what else you could do to boost the performance.

- 627
- 2
- 12
- 32
-
For MySql connection performance check [this](http://www.yaplex.com/windows-azure/mysql-database-performance-on-windows-azure/). – Rui Marques Nov 01 '13 at 10:06
You'll obviously need to profile your app to find the real cause. Check out these two articles which should get you started:

- 25,584
- 6
- 69
- 80