Freitag, 8. Juni 2012 20:34
I'm using php + sql at azure platform.
when I'm set new connection using PDO or with simple sqlsrv
$dbh = new PDO ("sqlsrv:server=tcp:$serverName;Database=$dbname","$username","$pw");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
to the sql server, the connection time get's up to 5seconds!! (just for connection)
picked the closest sql server..west europe
connection+query time local <1sec
connection+query time on azure >5sec
same DB ,same application, same same
really its a big problem for me...I need fast connection..
what can i do?
Sonntag, 10. Juni 2012 05:58...well....
Montag, 11. Juni 2012 05:24ModeratorHi Yaron1234,
Regarding to your description, the local connection works faster than the Azure connection. That might be related to the cost of network roundtrips. SQL Azure being far away, and always encrypted, your application needs to open/close connections carefully.
Note that if you use SQL Azure in addition to SQL over Windows Azure Connect, you will need to ensure the remoteip range in the rule exempts traffic to your SQL Azure servers.
For more information, please refer to Speeding Up SQL Server Connections
Regards, Amber zhang
- Als Antwort markiert amber zhangModerator Montag, 25. Juni 2012 02:30
Samstag, 16. Juni 2012 18:51
Most certainly in your case there is a performance penalty coming from the distance between your web server and the database. You mentioned that you picked the closest Azure data center for your database, but still the performance will never be the same as in the case when both the web server and the database are in the same data center. Personally I would highly recommend you to deploy your web site in Azure if you are going to use an Azure SQL database.
There would be two possible options for that. The first and probably the most convenient one would be to use the very recently launched Windows Azure Web Sites. The very cool thing about them is the fact that if a shared environment is enough for your needs, you could run your site for free. Latter, if the load demands it, the site can be scaled up to reserved resources and further scaled out to multiple load balanced VMs (pricing details here).
You can read a tutorial on creating Azure PHP web sites with SQL databases here.
Besides Web Sites, there is also the more powerful but more complicated option of deploying PHP applications using Azure Web Roles, as detailed here.
For an overview over Azure web sites vs Azure Web Roles you can read this article.