Hybrid Connector Performance

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

Hybrid Connector is a technology which enables you to connect to private data from cloud application.
That means if you have a Azure WebSite or a WebApi as a part of Mobile Services solution, you can connect to any TCP reachable service (with static IP address),
which even does not have a public IP address. In another words, you are connecting from cloud application to the service behind firewall with an private IP address.
This sounds crazy and impossible, but it is true.

 

image

Usually to make such solution working, you would setup the VPN between cloud and private hosting center. This is why many developers and administrators think that such kind of connector is not needed at all.
Fortunately this is not the right way of thinking. What if you don’t want VPN, because it is just not enough safe for you? This post is more related to VPN issues.
You probably do not want to have VPN which opens more or less everything, just because you need a single scenario.
For this reason, there is a Hybrid Connector which opens a bridge for a single application, but not the bridge between hosting centers. This is crucial difference in a way how we should think about it.
Why? In most organization you do not need to involve IT to change the infrastructure environment for a sake of a single application. Hope this was enough understandable.
For example, business department wants to be more flexible and want to avoid involving of IT in a particular solution without of need to break any existing IT rules.

Now let’s come back to real reason why I wrote this post. Connecting to the database from cloud which is remotely far a way from your database might be a performance issue. Depending on the distance of hosting centers (Azure to On-Prem ) you will notice different performance. You will have to pay overhead for TCP packet traveling, which is rounded to 50ms for a half earth-globe. Additionally we need to add fem more milliseconds  for TBD SQL protocol and data reading etc.
What I did to approve this is following code:

            SqlConnection sqlConn =
           
new SqlConnection(
           
ConfigurationManager.ConnectionStrings["connstr"].ConnectionString);
            sqlConn.Open();

           
int cnt = 0;

           
Stopwatch timer = new Stopwatch();

            timer.Start();

           
SqlCommand cmd = new SqlCommand("Select top(1000) *  from dbo.TEvent");
            cmd.Connection = sqlConn;
           
using(var reader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
            {
               
while(reader.Read())
                {
                    cnt++;
                    reader.GetString(0);
                    reader.GetString(1);
                    reader.GetDateTime(3);
                }
            }

            timer.Stop();

I have been reading 843 records from a table TEvent. The test was executed on the local box (left column) and then on Azure Web Site (right column).

http://localhost:3552/default.aspx http://xxxfrankfurt.azurewebsites.net/
   
5.0611 110.0361
5.2151 65.1087
6.9374 65.2498
7.4422 62.4588
2.2831 64.4797
4.9417 65.1933
6.8567 82.0052
5.6825 75.4278
4.0465 66.2992
5.2477 62.5411

How to interpret this result?

No questions performance is higher when application and database are running on the same box. But in many applications, when performance is not that important you have to calculate with an overhead of 50-60ms (depends on infrastructure, record schema etc.) Especially if you use this architecture for integration purposes (running in backend) this might be the way to enable cool cloud solutions for companies who don;t want to publish the data in the cloud.
Next time I will write more about several scenarios and architectures which leverage Hybrid Connector.


Posted May 22 2014, 08:00 AM by Damir Dobric
developers.de is a .Net Community Blog powered by daenet GmbH.