MySQL on Azure – Azure loves Open Source

Do you know? Open source software (OSS) platforms and technologies are among the fastest growing workloads on Azure nowadays.

As people say, Over the past few years, Microsoft has undergone a major cultural shift towards sharing and collaboration and this naturally includes engaging with open source communities. Microsoft teams across the company are now releasing their function as open source, contributing to a wide variety of open source projects, and are using open source tools.

I presume you know about the followings –

.NET Core –

.NET is a free, cross-platform, open source developer platform for building many different types of applications. Community makes 60% of code contributions. More

Visual Studio Code –

Quick to market with cross-platform support and Microsoft has made numerous contributions to the Electron codebase. More

And of course, Azure –

Popular services based on Linux, Hadoop, Redis and other OSS projects. Microsoft has contributed Azure’s data center designs to the Open Compute Project. More

Azure Database for MySQL” –

A new addition to the Azure Relational Database family. A fully managed, enterprise-ready community MySQL database as a service.

The MySQL Community edition helps you easily lift and shift to the cloud, using languages and frameworks of your choice and Scale in seconds with built-in high availability with Secure, compliant and global reach.

Developing a “Hello World” program using C# and Azure Database for MySQL is possible within few minutes.

  • Login to Azure portal and create an “Azure Database for MySQL server” and a sample database with sample table.
  • Create a C# Console App.
  • Install the MySql.Data.MySqlClient .Net Core Class Library to the project using NuGet package manager.
  • Compile and Run.

I know it’s easy said than done so here is git repository for quick reference. Happy coding

Memory-Optimized Tables – Helps in Performance and Scalability

Today, while performing the code review on one of my project, which is getting developed using many Azure services/technologies.

Being ‘Internet of Things’/IOT scenario, the requirements demands the use of “Polyglot Persistence” pattern. Because solution need to store the structured/SQL as well unstructured/NoSQL data. And as we know, to store the structured/relational data ‘SQL Azure’ is the default technology choice being on Azure and Microsoft person 🙂

So, while analyzing the stored procedure’s T-SQL code, observed that many of the SPs are utilizing the temporary tables for data computation/processing operations to improve the overall performance. Using temporary tables, table variables, or table-valued parameters was a reasonable/acceptable practice when I was a programmer 🙂 But started wondering if anything new added to this approach/pattern to improve for better. By using Bing, I quickly discovered that we really have something new and better of course namely, “Memory-Optimized Tables“. This is part of In-Memory OLTP, which is the premier technology available in SQL Server and Azure SQL Database for optimizing performance of transaction processing, data ingestion, data load, and transient data scenarios.

As MS docs says, Memory-optimized tables are tables, created using CREATE TABLE with “MEMORY_OPTIMIZED = ON” option. Memory-optimized tables are fully durable by default, and, like transactions on (traditional) disk-based tables, fully durable transactions on memory-optimized tables are fully atomic, consistent, isolated, and durable (ACID). Memory-optimized tables and natively compiled stored procedures support a subset of Transact-SQL. More details.

Hence, if you are exploring the options to enhance your SPs/T-SQL code on SQL Azure then please refer here for performance and scalability considerations.

The details scenario are documented with instructions @ Replace global tempdb ##table and Replace session tempdb #table

So, next time whenever you see CREATE TABLE #temptable and/ CREATE TABLE #temptable and choose to replace by memory optimization option then make sure you visit this blog to say thanks you 🙂

The Azure Architecture Center is available now

The Azure Architecture Center is available now in the documentation section of Azure. It’s Open to everyone with no cost to access the information. The Architecture Center is an extremely valuable resource as it brings –

  • Information for all cloud users ranging from beginners to specialists.
  • Best practices for security, availability, scalability, performance, cost, and manageability.
  • Tested, proven, and verified guidance. Not theoretical designs, they have been built and successfully run and ready for production.
  • Prepared deployment scripts and diagrams that anyone can use to get started quickly

The main areas of the architecture center covers are –

  • Application Architecture Guide – This guide presents a structured approach for designing applications on Azure that are scalable, resilient, and highly available.
  • Reference Architectures – Scenarios with related architectures grouped together.
  • Cloud Design Patterns – These design patterns are useful for building reliable, scalable, secure applications in the cloud.

One of interesting topic is a special section for customers coming from compete cloud provider namely, AWS. It helps Amazon Web Services (AWS) experts understand the basics of Microsoft Azure accounts, platform, and services. It also covers key similarities and differences between the AWS and Azure platforms, here.

Lastly, the people who are deep in architectural/design work should visit here. This provides resources including icons, Viso templates, PNG files, and SVG files that are useful for producing your own architecture diagrams. A direct link to download.

LAMP and Azure – Misconceptions vs Possibilities

A discussion of the Microsoft Platform (Windows, IIS, SQL Server and ASP.NET) vs LAMP (Linux, Apache, MySQL, and PHP) topic covers a large set of topics.

My intent is not to compare 1:1 but commenting on a scenario.

In many discussions, I realized many people have perception/misconceptions that, Azure is not really meant for traditional web-based applications built on the LAMP (Linux Apache MySQL PHP).

However, the truth is that you can deploy LAMP stack on Azure to rapidly build, deploy, and dynamically scale websites and web apps using IaaS (VM scale sets) and PaaS (Azure Web Apps)

So, Customers who want to – Upgrade web apps to the cloud for scalability, high availability and other cloud traits like global presence, and dynamically scale (up and down) websites in a cost-effective. You should consider Azure as you get Architectural choices for hosting websites to choose from a wide array of architectures (containers, VMs, PaaS services, Azure Functions, etc.) and languages (node.js, PHP, Java, etc.). Linux web apps, let us create node and Javascript websites that are fully managed.

Providers like, Bitnami provides images which are pre-configured, tested and optimized for Microsoft Azure and portable across platforms. Which provides quick and ready to use services.

For more information please feel free to visit @ https://azure.microsoft.com/en-in/overview/choose-azure-opensource/

File Storage and Functions – A files import story in Azure

The story goes like this – you have a set of files which should be imported into a solution hosted on Azure.

The idea is to cover the scenario technically – the key players are Azure File Storage, Azure Functions.

If you don’t know already then quick summary –

  1. Azure File storage
    It’s a service that offers file shares in the cloud using the standard Server Message Block (SMB) Protocol. With Azure File storage, you can migrate legacy applications that rely on file shares to Azure quickly and without costly rewrites. Applications running in Azure virtual machines or cloud services or from on-premises clients can mount a file share in the cloud, just as a desktop application mounts a typical SMB share. Any number of application components can then mount and access the File storage share simultaneously. Since a File storage share is a standard SMB file share, applications running in Azure can access data in the share via file system I/O APIs. For more details please refer here. [Reference: Azure docs]
  2. Azure Functions – It’s a service that offers a server-less compute service that enables you to run code-on-demand without having to explicitly provision or manage infrastructure. Use Azure Functions to run a script or piece of code in response to a variety of events. So, a solution for easily running small pieces of code, or “functions,” in the cloud. You can write just the code you need for the problem at hand, without worrying about a whole application or the infrastructure to run it. Functions can make development even more productive, and you can use your development language of choice, such as C#, F#, Node.js, Python or PHP. For more details please refer here. [Reference: Azure docs]

The Overall process –

  • Define the structure for Input files location – In file storage, defines a structure for Input file, Processed and Failed file by using ‘Share(s)’ and ‘Directory(s)/Files(s)’.
  • New file detection mechanism – check the presence of a new file(s) as per predefined schedule and add a message to a queue for further processing. Using a Function triggered by a timer.
  • Import the files/data into system – A Function which processes the input file(s) and ultimately imports the data.
  • Perform cleanup at Input files location – Mark files as processed, or move files to processed/failed directory for reference/tracking purpose.

Now, the devil is in the detail –

The Azure File service offers the four resources: the storage account, shares, directories, and files. The File service REST API provides a way to work with share, directory, and file resources via HTTP/HTTPS operations. So, instead of UNC/file-share/mapping, you need to use Azure Storage SDK which is a wrapper over Azure Storage REST API. This should avoid any UNC/mapping/related issues.