Cloud Computing

CosmosDb – Connection Policy – Setting Connection Mode and Connection Protocol

May 13, 2018 .NET, Azure, CosmosDB, Microsoft, PaaS, VisualStudio, Windows, Windows Azure Development No comments , , ,

Recently I have been trying multiple ways to optimize CosmosDb SQL.NET SDK integration calls from my web application that sits within a VNET.

After carefully analyzing different options available within Cosmos Db SQL API’s have realized there are different aspects we could optimize in achieving minimal turn around time. In this article I am going to discuss about one such useful find, that is to use Cosmos Db SQL SDK connection policy to use diferent networking options to improve the latency between web application and cosmos db API calls.

Connection Policy:

Performance of an client application has important implication based on – how SQL .NET SDK  connects to Azure Cosmos DB , because of expected client-side latency due to networking conditions. There are two key configuration settings available for configuring client Connection Policy – the connection mode and the connection protocol.

There are two connection mode options provides by Cosmos Db SQL.NET SDK:

  • Gateway Mode(which is default): This mode is the default option being used and works with all Cosmos DB SDK versions.  Since it is only accessible over HTTPS/TCP, it is more secure and best choice for applications that run on a constrained secure corporate network. If you are using the .NET Framework version of the CosmosDb SQL.NET SDK, then proably this is the only connection mode that would work for you. 

  • Connection Protocol – TCP:  443 is the CosmosDb port, 10255 is the MongoDB API port.   
  • Connection Protocol – HTTPS: Default 443
  • Direct Mode:  This is a new mode which will work only on .NET Standard 2.0 onwards. It provides you an ability to choose between TCP or HTTPS more efficiently.  Only caveat is that you would need .NET Standard 2.0 as target framework for your client application.
    • Connection Protocol – TCP: TCP would be more faster when client and db are in same VNET.  Since TCP within the same network would be more faster, you would be amazed by the latency improvements by your client application. It would respond faster to you cosmos Db requests.  NB In TCP mode apart from 443 and 10255 mentioned in Gateway more, we also need to ensure  port range between 10000 and 20000 is open in your firewall configuration,  because Azure Cosmos DB uses dynamic TCP ports.
    • Connection Protocol – HTTPS: Since client application and cosmosDb are in same network limits, you could see that HTTPS option is also a reliable, secure and faster access channel for you, but not highly performing as TCP.

    A simplified diagram below :

    image

    Sample Code:

     string cosmosDbEndpoint = new Uri("https://mycosmosDbinstance.documents.net");
     string authKey ="cosmosDb-apiKey";
     DocumentClient client = new DocumentClient(cosmosDbEndpoint, authKey,
     new ConnectionPolicy
     {
        ConnectionMode = ConnectionMode.Direct,
        ConnectionProtocol = Protocol.Tcp
     });
     

    Refer more :

    You can find the completed sample here: AzureContrib/CosmosDB-DotNet-Quickstart-With-ConnectionPolicy

    Introduction to Kubernetes

    April 22, 2018 Cloud Computing, Cloud Native Computing Foundation, Computing, Emerging Technologies, Google Cloud, IaaS, OpenSource, PaaS, Platforms No comments

    What is Kubernetes?

    Kubernetes (a.k.a K8s) is an open-source system for automating deployment, scaling and management of containerized applications that was originally designed by Google and now maintained by the Cloud Native Computing Foundation.

    What Kubernetes can do?
    Kubernetes has a number of features in cloud computing world, it can be thought as a :

    • A container platform
    • A microservices platform
    • A portable cloud platform and a lot more

    Kubernetes defines a set of building blocks (“primitives”) which collectively provide mechanisms for deploying, maintaining, and scaling applications. The components which make up Kubernetes are designed to be loosely coupled and extensible so that it can meet a wide variety of different workloads. The extensibility is provided in large part by the Kubernetes API, which is used by internal components as well as extensions and containers running on Kubernetes.

    If you are interested  to know more, learn more about Kubernates  through Official tutorials:

    Some useful online training is:

    Kubernetes vs Service Fabric

    April 13, 2018 Application Virtualization, Azure, Emerging Technologies, Kubernates, Orchestrator, OS Virtualization, PaaS, Service Fabric, Virtual Machines, Virtualization No comments

    What is the difference between Kubernates and Service Fabric?

    It is a common question today among most of the business stakeholders, infrastructure specialists, and information technology architects.

     

     

     

     

     

     

     

     

     

    To answer in simpler words, quoting from this Reddit log :

    • Kubernetes manage/orchestrate containers and applications within. 
    • ServiceFabric is a framework for microservices based on one of three models; stateful, stateless, actor. Service Fabric provides a framework for creating micro services, runtime for managing distributed instances, and also provides the ‘fabric’ that holds everything together.

    A detailed comparison quoting from an MSDN blog  from here:

    Azure Container Service: If you are looking to deploy your application in Linux environment and are comfortable with an orchestrator such as Swarm, Kubernetes or DC/OS, use ACS. A typical 3 tier application (such as a web front end, a caching layer, a API layer and a database layer) can be easily container-ized with 1 single dockerfile (or docker-compose file). It can be continuously decomposed into smaller services gradually. This approach provides an immediate benefit of portability of such an application. Containers is Open technology and there is great community support around containers.

    Azure Service Fabric: If an application must have its state saved locally, then use Service Fabric. It is also a good choice if you are looking to deploy the application in Windows server ecosystem(Linux support is in the works as well!). Refer to common workloads on Service Fabric for more discussion on applications that can benefit from Service Fabric. Biggest benefit is that Service Fabric applications can run on-premise, on Azure or even in other cloud platforms also.

    What’s Azure Container Service (ACS/AKS)

    April 12, 2018 Application Virtualization, Azure, Azure Container Service, Cloud Computing, Cloud Services, Computing, Containers, Docker, Emerging Technologies, IaaS, Kubernates, Microsoft, OpenSource, Orchestrator, OS Virtualization, PaaS, Virtual Machines, Virtualization, Windows Azure Development No comments

    I will start with history: Sometime around 2016, Microsoft launched an IaaS service called Azure Container Service a.k.an ACS serves as a bridge between Azure Ecosystem and existing container ecosystem being used widely by the developer community around the world.

    kubernates_azureIt helps as a gateway for infrastructure engineers and developers to manage underlying infrastructure such as Virtual Machines, Storage, Network Load Balancing services individually than the application itself.  The application developer doesn’t have to worry about planet-scale of the application, instead, a container orchestrator can manage the scale up and scale down of your application environment based on peaks and downs of your application usage.

    It offers an option to select from 3 major container orchestrators available today such as DC/OS, Swarm, Docker, and Kubernates.   ACS along with your choice of container orchestrators works efficiently with different container ecosystems to enable the promise of application virtualization.

    To make it simpler, ACS is your Super Glue to gel your Azure infrastructure and your container orchestrator together. Means you will be able to make your fully managed container cluster in a matter of minutes with Azure.

    ACS is for making your microservices dream come true, by providing individual services scale according to the demand and automatically reduce the scale, if usage is low. You don’t have to worry, ACS and your container orchestrator will take care of you.

    If you are a beginner to container-based infrastructure for your applications, you don’t have to take the pain at all of setting up Kubernates on your own, instead, ACS will simplify your implementation with a couple of easier click thru’s and your container infrastructure is ready to be fully managed by you. As simple as that.

    What is Azure Container Kubernates Service (AKS) then?

    As I am writing today, Microsoft has a new fully managed PaaS service called as Azure Container Service (AKS) or Managed Kubernates, meaning that Kubernates would be your default fully managed container orchestrator, if you choose Azure Container Service. But you would be able to deploy other open-source container orchestrators if you prefer to choose to have your own unmanaged Kubernates, Docker or DC/OS and then add your specific management and monitoring tools.

    This service is currently available in PUBLIC PREVIEW, you can get started from here

    Means though it is a fully managed service, you still have the option to manage it your own using your preferred set of tools and orchestrators.

    Charging Model

    Whether you manage your AKS service with your own set of tools and orchestrator or you use Fully Managed Kubernates, you only need to pay for resources you consume. No need to worry about per-cluster charges like other providers.

    Useful References:

    General Availability of Azure Database Services for MYSQL and PostgreSQL

    March 23, 2018 Azure, Cloud Computing, Cloud Services, Data Services, Emerging Technologies, Microsoft, Tech Newz, VisualStudio, VS2017 No comments

    It has been a while I have written something on my blog. I thought of getting started again with a good news that Microsoft Azure team has announced the general availability of Azure Database Services for MySQL and PostgreSQL. In my earlier posts, I have provided some oversight into Preview Availability of these services as part of the Azure cloud. Now that it is generally available, customers should be able to utilize these services for their general purpose or enterprise level database requirements in Azure Cloud.

    You may read about it more on Microsoft announcement blog Announcing general availability of Azure database services for MySQL and PostgreSQL  by Tobias Ternstrom Principal Group Program Manager, Azure Data

    IoT is not all about Cloud

    October 15, 2017 Cloud Computing, Connected, Connectivity, Emerging Technologies, Internet of Things, IoT, Machines No comments

    Recent past, I had multiple discussions with many tech forums and many people have a misconception about IoT and Cloud. Some think whenever we do something like blinking an LED with Raspberry Pi or Arduino is IoT.

    I just thought of sharing some of my viewpoints on these terminologies.

    • Internet of Things(IoT) – refers to the connection of devices (other than the usual examples such as computers and smartphones) to the Internet. Cars, Home and Kitchen appliances, Industrial devices, and even heart monitors can all be connected through the IoT.
    • Cloud Computing – often called simply “the cloud,” involves delivering data, applications, photos, videos, and more over the Internet to data centers.

    We can break down cloud computing into six different categories:

    1. Software as a service (SaaS): Cloud-based applications run on computers off-site (or “in the cloud”). Other people or companies own and operate these devices, which connect to users’ computers, typically through a web browser.
    2. Platform as a service (PaaS): Here, the cloud houses everything necessary to build and deliver cloud-based applications. This removes the need to purchase and maintain hardware, software, hosting, and more.
    3. Infrastructure as a service (IaaS): IaaS provides companies with servers, storage, networking, and data centers on a per-use basis.
    4. Public Cloud: Companies own and operate these spaces and provide quick access to users over a public network.Example: Amazon AWS, Microsoft Azure etc.
    5. Private Cloud: Similar to a public cloud, except only one entity (user, organization, company, etc.) has access. Means the access to the cloud is secured and isolated, only organizational entities have access to this type of cloud resources. A private cloud is owned by a single organization. Private clouds enable an organization to use cloud computing technology as a means of centralizing access to IT resources by different parts, locations, or departments of the organization. When a private cloud exists as a controlled environment within Onpremise data centers.
    6. Hybrid Cloud: Takes the foundation of a private cloud but provides public cloud access. This combination would be established through a secure high-speed VPN tunnel over MPLS or other dedicated lines or extended connectivity gateways provided by the respective cloud vendor. In this mode, your on-premise applications can connect to cloud infrastructure and vice versa. This provides you the flexibility to host your missing critical information in on-premise itself, but also provides you the flexibility to utilize the cloud power, without compromising your organization’s critical data.

    Role of Cloud in IoT

    Cloud is simply an enabler for IoT. It provides necessary services and infrastructure for things to be interconnected and operate.

    Cloud provides all the essential services to increases efficiency in implementing your IoT solutions, accumulate and operate on IoT data. Internet of things requires Cloud to work, I would better define it as Cloud and IoT are inseparable, but IoT is not all about Cloud.

    For example, millions of devices connected in an IoT ecosystem would create millions of bytes of data, and you would need sufficient infrastructure to store and operate on these data to create a meaningful result out of it.

    Cloud Service providers started realizing the need of providing IoT specific services to customers to quickly enable to create Fast to market solutions. That’s where Cloud and IoT converges. Microsoft has packages all IoT related components into Azure IoT and hence Amazon AWS IoT, similarly the remaining providers such as SAP Hana, IBM Cloud etc. This helps customers from picking necessary components and build their IoT ecosystem in Cloud, or utilize the predefined(SaaS) solutions for quick enablement.

    What is the role of Raspberry Pi, Arduino and Dragon board then?

    These are single board computer or hardware boards(CPUs) or Microcontroller boards that have sufficient hardware capacity to run a small/complex IoT program on an operating system of your choice.

    These boards are typically equipped with your basic storage and computing needs for establishing an IoT device or edge capability. You can write a program of your choice to blink an LED based on your conditions, as they are equipped with digital/analog I/O ports. You can choose from wide variety of operating systems such as Raspebian, Windows 10IoT etc to install on these devices or deploy microcontroller programs depending on the capacity.

    This means they are edge devices which you can program for your IoT use case. When deployed to the field together, they would create an IoT network.

    Conclusion:

    Enough said, IoT is not all about the cloud, but are inseparable in a modern world and whatever you are doing with RaspeberryPi, Arduino Uno etc may not be an IoT unless there are a specific IoT use cases you are not trying to solve using these devices.

    Useful References: