PaaS

Azure Cosmos DB – 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:

    Managed Azure Database for MySQL and PostgreSQL

    June 9, 2017 App Service, Azure, Azure Data Services Platform, Azure Database for MySQL, Azure Database for PostgreSQL, Cloud Computing, Cloud Services, Data Services, Emerging Technologies, OpenSource, PaaS, SQL Data Warehouse, SQL Database, Windows Azure Development No comments

    During Microsoft Build 2017(May 10th 2017) conference in Seattle, Scott Guthrie (EVP of Cloud and Enterprise Group) announced two new offerings to the Azure Database Services Platform, Azure Database for MySQL and Azure Database for PostgreSQL.

    I was happy that Microsoft is filling the gap for the need of Fully Managed MYSQL and PostgreSQL . I recollect around in April I was trying to migrate this WordPress blog from Godaddy hosting in to  an Azure App Service to provide and since WordPress requires MySQL as the database. The only option left for me in Azure was to have local MySQL(MySQL in App)  in App Service, which cannot scale well or either use Clear DB service (a Microsoft partner in azure). Some how I wasn’t happy with the performance of local MYSQL and Clear DB, due to my bulky blog. So I thought what if there was a Managed MYSQL service just like Managed SQL Azure services.

    What is Azure Database for MySQL and PostgreSQL?

    Azure Database for MYSQL and PostgreSQL(currently in PREVIEW)  are fully managed Platform as a Service(PaaS) offering from Microsoft Azure, which does not want us to worry about infrastructure and managing the server instance.  Below is the outline of how these services has been stacked up against existing SQL Database offerings. As a customer you do not need to worry about the Compute, Storage, Networking, and high-performance/availability/scalability  of these services ensured by Azure Data Service Platform with built in monitoring.

    You easily deploy an Azure Web App with Azure Database for MySQL as the database provider, and to provide complete solutions for common Content Management Systems (CMS) such as WordPress and Drupal.

    2d1e1ef6-94ac-4110-bc4d-93d0b44d45aa

    I will cover more details in later series That’s all for now. Thank you for reading my content. Leave your comments.

    Pricing Details:

    Useful Links:

    Big Data & Front End Development track in the Microsoft Professional Program

    June 8, 2017 Analytics, Azure, Azure Data Factory, Azure Data Lake, Big Data, Big Data Analytics, Big Data Management, Data Analytics, Data Services, Emerging Technologies, Hadoop, HD Insight, IaaS, PaaS, Predictive Analytics, Realtime Analytics, SQL Azure, Stream Analytics, Windowz Azure No comments

    Earlier I introduced you the Microsoft Professional Program for Data Science. Right after few days Microsoft announced the BETA availability of two more tracks Big Data and Front End Development.

    Big Data Track:

    This Microsoft program will help you to learn necessary skills from cloud storage and databases to Hadoop, Spark, and managed data services in Azure. Curriculum of this program involves learning how to build big data solutions for batch and real-time stream processing using Azure managed services and open source systems like Hadoop and Spark.

    Are you intend to pursue a Data Analytics career, this is the right program for you to gain necessary insights.

    Technology you will apply to gain these skills are: Azure Data Lake, Hadoop, HDInsight, Spark, Azure data factory, Azure Stream Analytics

    Below is the course outline :

    • 10 COURSES  |  12-30  HOURS PER COURSE  |  8  SKILLS
    • ENROLL NOW here
    • More details here

    Front End Development Track:

    This track provides you necessary skills to get started with Advanced Front End development using HTML5, CSS3, JavaScript, AngularJS and Bootstrap.  At the end of the curriculum you will become master in Front End Development with all predominant modern web technologies.

    So if you are a front end UI developer, this is something you can try out to enhance your skills.

    Below is the course outline :

    • 13 COURSES  |  15-30 HOURS PER COURSE  |  11 SKILLS
    • ENROLL NOW here
    • More details  here

    Track detail

    Each course runs for three months and starts at the beginning of a quarter. January—March, April—June, July—September, and October —December. The capstone runs for four weeks at the beginning of each quarter: January, April, July, October. For exact dates for the current course run, please refer to the course detail page on edX.org. 

    [Microsoft]