Last post Mar 11, 2016 02:34 AM by Jamobor yao - MSFT
Mar 10, 2016 01:37 AM|geog272|LINK
We are moving our site to azure, and I am noticing a significant speed difference -- the site is very slow on azure. The database is an azure SQL. I am a beginner. I am hoping someone can point me to some basic troubleshooting steps to find the source
of the slowness.
In case it's relevant, right now I open and close database connections several times on one page, rather than leaving the connection open a long time. So the database connection may open and close several times as the page loads. This is my basic code
Dim connectionString As String
Dim dbconn As System.Data.SqlClient.SqlConnection
Dim dbcomm As System.Data.SqlClient.SqlCommand
Dim dbread As System.Data.SqlClient.SqlDataReader
sql = "SELECT * FROM table"
connectionString = ConfigurationManager.ConnectionStrings("MyConnectionString").ToString
dbconn = New System.Data.SqlClient.SqlConnection(connectionString)
dbcomm = New System.Data.SqlClient.SqlCommand(sql)
dbcomm.Connection = dbconn
dbread = dbcomm.ExecuteReader()
If dbread.HasRows Then
Do While dbread.Read()
And this is my connection string:
connectionString="Data Source=tcp:xxxx.database.windows.net,1433;Initial Catalog=xxxx;User ID=xxxx;Password=xxxxxx;" />
Mar 10, 2016 07:41 AM|Mikesdotnetting|LINK
right now I open and close database connections several times on one page, rather than leaving the connection open a long time. So the database connection may open and close several times as the page loads.
If the performance declined dramatically only after the application was deployed to a new environment, then it would be reasonable to assume that the issue is environment-related, not code-related.
Mar 11, 2016 02:34 AM|Jamobor yao - MSFT|LINK
If you mean the initial request takes long and then any subsequent requests are fast, then that would be because you are hitting .NET apps cold start. Many .NET apps are slow to JIT and
load all their .NET requirements, but once everything is loaded, they are fast. If you want to avoid this problem, please try to enable "always on", Enabling Always On essentially causes Azure to automatically ping your site periodically to ensure that it
remains in a running state. Please refer to
https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/ for more information.
If it is not a problem that I describe above. I would suggest you choose Azure web app and Azure SQL Database in the same region. It is the easiest way to increase the performance.