Thursday, February 9, 2017

We continue with a detailed study of Microsoft Azure stack as inferred from an introduction of Azure by Microsoft. We discussed Azure stack is a hybrid approach to cloud. Microsoft Azure has developer tools for all platform services targeting web and mobile, Internet of Things, Microservices, and Data + analytics, Identity management, Media streaming, High Performance Compute and Cognitive services. These platform services all utilize core infrastructure of compute, networking, storage and security. The Azure resource manager has multiple resources, role based access control, custom tagging and self-service templates.The compute services are made more agile with the offerings from a VM infrastructure, VM scale sets infrastructure, Container service orchestration and batch/Job orchestration.
 The compute
 services are made more agile with the offerings from a VM infrastructure, VM scale sets infrastructure, Container service orchestration and batch/Job orchestration.  Azure involves a lot of fine grained loosely coupled micro services Microservices can be stateful or stateless and can be deployed in a multi-cloud manner.  

The Paas platform of Azure can span Azure and AWS both. It can occupy on-Premise, GCP and others as well Containers, serverless and Microservices are different forms of computing. A container packages an exe or a jar. Serverless dictates the operational/cost model.  Microservices are a 3-tier  model involving a thin client SOA and pub/sub and provides a development architecture. The core compute is provided by Batch, Container Service, VM Scale sets and virtual machines in that order. The Platform is provided by Azure functions, App Service, Service fabric and Cloud Services
We now look at data platform. The purpose of this platform to interpret Data to gain intelligence so that it can guide actions. This transformation from data to actions is facilitated by layers of information management, big data stores, machine learning and analytics, and Intelligence services as well as dashboards and visualizations.  The data comes from sensors and devices, applications,  and other data sources.  The information management layer aggregates this data with data factory, data catalog, and event hubs.  The big data stores work with data lake store and SQL data warehouse.  Machine learning and analytics involves all insight applications such as those for machine learning, data lake analytics, HDInsight and stream analytics.
The Intelligence layer comprises of Cognitive services, Bot framework, and Cortana. The dashboard  usually involves Power BI.
The consumers for this data transformation to actions are people as well as apps and automated systems.
Azure Networking is divided into regions that include inside the Azure region, connecting Azure regions, and geographic reach and internet ecosystems. Its the latter two that the internet exchange provider spans.  The connections to the Azure region are made over Software defined WAN and optical networks or advanced MPLS services. The networking inside the Azure region already comes with security, performance, load balancing, virtual networks, cross-premises connectivity.
Azure now comes with accelerated networking that provides upto 25Gbps of throughput and reduces network latency up to 10x. Without accelerated networking, the policies were applied in software in the host. With accelerated networking, the policies are applied in hardware accelerators
#codingexercise
Check whether a BST has a dead end.
A dead end is an element after which we cannot insert any more element. It is a value x such that x+1 and x-1 exist. The BST contains positive integer values greater than zero which makes the value 1 an exception
bool HasDeadEnd(Node root)
{
if (root == null) return false;
var all = new List<Node> ();
ToInOrderList(root, ref all);
var leaves = GetLeaves(all); // during traversal, check if left and right are null for selecting a leaf
foreach (var leaf in leaves)
{
if (all.Contains(leaf.data -1) && all.Contains(leaf.data+1))
{
return true;
}
}
return false;
}
}
void ToInOrderList(Node root, ref List<node> all)
{
if (root == null) return;
ToInOrderList(root.left, ref all);
all.Add(root);
ToInOrderList(root.right, ref all);
}
List<Node> GetLeaves(List<Node> all)
{
all.Select(x => x.left == null && x.right == null).ToList();
}
Alternatively
void FindLeaves(Node root, ref List<node> leaves)
{
if (root == null) return;
FindLeaves(root.left, ref leaves);
if(root.left == null && root.right == null)
leaves.Add(root);
FindLeaves(root.right, ref leaves);
}

The order in which the leaves are enumerated depends on the order in which the traversal is done.

Wednesday, February 8, 2017



We continue with a detailed study of Microsoft Azure stack as inferred from an introduction of Azure by Microsoft. We discussed Azure stack is a hybrid approach to cloud. Microsoft Azure has developer tools for all platform services targeting web and mobile, Internet of Things, Microservices, and Data + analytics, Identity management, Media streaming, High Performance Compute and Cognitive services. These platform services all utilize core infrastructure of compute, networking, storage and security. The Azure resource manager has multiple resources, role based access control, custom tagging and self-service templates.The compute services are made more agile with the offerings from a VM infrastructure, VM scale sets infrastructure, Container service orchestration and batch/Job orchestration. Container infrastructure layering allows even more scale because it virtualizes the operating system.Azure is an open cloud because it supports open source infrastructure tools  such as  Linux, ubuntu, docker, etc. layered with databases and middleware such as hadoopredismysql etc., app framework and tools such as nodejs, java, python etc., applications such as Joomla, drupal etc and management applications such as chef, puppet, etc. and finally with devops tools such as jenkinsGradleXamarin etc. Azure involves a lot of fine grained loosely coupled micro services Microservices can be stateful or stateless and can be deployed in a multi-cloud manner.  
The Paas platform of Azure can span Azure and AWS both. It can occupy on-Premise, GCP and others as well. As a PaaS offering, this platform enables development and debugging using API, IDE and CI/CD interface. 
The web apps written using Azure stack can handle mission-critical load that scales because it has builtin auto scale and load balancing and high-availability with auto-patching. It enables continuous deployment with a variety of source control and supports a variety of applications. It is tightly integrated with Xamarin which is loved by developers and trusted by enterprise.  
Writng APIs is a breeze if we have the framework already. We can just publish, manage, secure and analyze our APIs in minutes. We secure the API with Active Directory, single sign-on and OAuth and generate client-proxies or APIs in the language of our choice. Similarly enterprise API can be mashed up and integrated with API management and Logic Apps.  
Instead of APIs we can also use serverless apps that help process events. These are cloud scale event handlers and they can scale with customer demand so that the pay is on a usage basis. All this involves is to write functions in C#, Node.js, Python, PHP and schedule event-driven tasks across services.  These functions are exposed as HTTP API endpoints, are fully open source and run on serverless infrastructure.  
Serverless means that there are no underlying servers which means we don't have to do OS patching or management. Applications are built of event handlers which makes it easy to connect services and components.  There is micro-billing involved which pays for execution at very short time increments with significant cost efficiencies.  
Containers, serverless and Microservices are different forms of computing. A container packages an exe or a jar. Serverless dictates the operational/cost model.  Microservices are a 3-tier  model involving a thin client SOA and pub/sub and provides a development architecture. 

Micro-serverless, simple cloud platform and service access usually involves callers/events, serverless microservices, and platform. The core compute is provided by Batch, Container Service, VM Scale sets and virtual machines in that order. The Platform is provided by Azure functions, App Service, Service fabric and Cloud Services.
#codingexercise 
Find the maximum value of a node between two nodes in a BST.
Solution: Find the LCA between the nodes. Iterate through ancestors of the nodes upto LCA to find max
Node getLCA( node root, int n1, int n2)
{
If (root == null) return null;
If (root.data == n1 || root.data == n2) return root;
Int left = getLCA(root.left, n1, n2);
Int right = getLCA(root.right, n1, n2);
If (left && right) return root;
If (left) return left;
If (right)return right;
Return null;

}
int GetMaxBetween(Node root, int n1, int n2)
{
Node lca = GetLCA(root, n1, n2);
return Math.max(GetMax(lca, n1), GetMax(lca, n2));
}


Tuesday, February 7, 2017

The following is a detailed study of Microsoft Azure stack as inferred from an introduction of Azure by Microsoft 
Introduction: Organizations are increasingly leaning on public cloud or at least hybrid cloud to meet the demands on their IT. This writeup tries to cover nearly eighty topics of interest in the Azure Stack. 
Azure stack is a hybrid approach to cloud. On one hand, we have the Microsoft Azure public cloud and on the other hand, we have Microsoft Azure Stack either hosted or in private cloud. The Azure stack is therefore a One Azure ecosystem. It facilitates unified app development and the Azure services are in our datacenter. 
Both the Azure and Azure stack are tiered implementations of a cloud or pseudo cloud infrastructure at the bottom, an IaaS or PaaS layer next, followed by Azure Resource manager and Dev-ops tools on top. Microsoft Azure has developer tools for all platform services targeting web and mobile, Internet of Things, Microservices, and Data + analytics, Identity management, Media streaming, High Performance Compute and Cognitive services. These platform services all utilize core infrastructure of compute, networking, storage and security. 
The Azure resource manager has multiple resources, role based access control, custom tagging and self-service templates. 
Azure templates are like formula, We can use it for dedicated purposes.  For example, we can have a quick start template for Linux Virtual machine. There is a growing community of 350 unique templates, 300 unique contributors and over 4500 visitors each day. 
The compute services are made more agile with the offerings from a VM infrastructure, VM scale sets infrastructure, Container service orchestration and batch/Job orchestration. 
VM Scale sets are those that can auto-scale and have auto configuration at scale such as the ones using Chef and puppet.  
A variety of alphabet VM sizes are available.  Each VM has a resource usage in terms of a NIC card and a storage that is specific to that VM.   
VMs are available in sets as Racks with a power unit, network switch and a server.  These therefore determine fault domains.An availability set may be a group of control nodes or a group of databases. 
Compute requirement of a modern cloud app typically involve load balanced compute nodes that operate together with control nodes and databases. 
VM Scale sets provide scale, customization, availability, low cost and elasticity. 
VM scale sets in Azure resource manager generally have a type and a capacity. App deployment allow VM extension updates just like OS updates. 
Container infrastructure layering allows even more scale because it virtualizes the operating system. While traditional virtual machines enable hardware virtualization and hyper V’s allow isolation plus performance, containers are cheap and barely anything more than just applications. 
Azure container service serves both linux and windows container services. It has standard docker tooling and API support with streamlined provisioning of DCOS and Docker swarm. 
Azure is an open cloud because it supports open source infrastructure tools  such as  Linux, ubuntu, docker, etc. layered with databases and middleware such as hadoopredismysql etc., app framework and tools such as nodejs, java, python etc., applications such as Joomla, drupal etc and management applications such as chef, puppet, etc. and finally with devops tools such as jenkinsGradleXamarin etc. 
Job based computations use larger sets of resources such as with compute pools that involve automatic scaling and regional coverage with automatic recovery of failed tasks and input/output handling. 
Azure involves a lot of fine grained loosely coupled micro services using HTTP listener, Page content, authentication, usage analytic, order management, reporting, product inventory and customer databases. 
Microservices can be stateful or stateless and can be deployed in a multi-cloud manner.  
#codingexercise
Remove BST keys inside a given range

Node PruneBSTRange(Node root, int min, int max)
{
if (root == null) return null;
root.left = PruneBSTRange(root.left, min, max);
root.right = PruneBSTRange(root.right, min, max);
if (root.data > min)
{
var right = root.right;
delete root;
return right;
}
if (root.data < max)
{
var left = root.left;
delete root;
return left;
}

return root;
}
The comparision operator can also help with the sentinels.

Monday, February 6, 2017

Today we continue to compare Azure networking with AWS networking. We were discussing Security, Security Groups, Network ACLs, Custom routing tables and Virtual network interfaces. We also compared DNS service, connectivity, VPN over IPSec, private connectivity over Exchange, SDK & Tools.
Subnets can be created of any size. They can be single public or a mix of public and private. Traffic can be selectively permitted or denied using network access control lists (ACLs) Security can also be managed using security groups. Subnets follow the same routing as the overall network unless their routing table is customized. Each instance may have multiple ip address assigned, however, this requires one or more NIC cards and is usually permitted only on large instances by both cloud providers.
We can register domain names, route internet traffic to the resources for the domain and check the health of the resources using DNS services such as route 53 from AWS. Azure uses Anycast networking  so that each DNS query is answered by the closest available DNS server thus increasing the performance and the availability of the domain. Azure additionally provides CDN And traffic Manager.
CDN delivers content to end users through a robust network of global data centers. It cuts the time that it takes to serve up content to the web applications by caching closer to the user than the origin. Using the CDN, we can cache publically available objects loaded from Azure blob storage, web application, virtual machine, application folder and other HTTP/HTTPS location. The locations are regional and chosen to maximize the bandwidth to the clients.
Traffic manager routes incoming traffic for high performance and availability. Traffic manager distributes the user traffic for service endpoints in different datacenters using the Domain Name System.
A VPN gateway provides connectivity between the virtual network in the cloud and the on-premise site. It sends encyrpted traffic over a public connection. Azure provides a VPN Gateway and ExpressRoute gateway. A VPN gateway allows point to site as well as multisite that share bandwidth available to the gateway. All the VPN tunnels share the available bandwidth for the gateway. AWS provides Direct Connect links that lets you create virtual interfaces directly to the AWS cloud and Amazon Virtual Private cloud, bypassing the ISPs in the route. Both cloud provider provide programmable SDKs as well as CLI and REST APIs.

Network is assumed to be well-provisioned and its usage is assumed to be effectively free as long as bandwidth is available.  However these assumptions are not always true. For example, cluster applications are often deployed in cloud environments or even across multiple data center sites and cloud tenants would like to minimize their cost.  The authors of McCAT : multi-cloud cost-aware transport propose to control the network usage of cluster applications by creating a cost-aware transport service.  This service filters the data transmitted if it is ultimately not used by the application. It aggregates multiple data items into one to save bandwidth by reducing precision. and it multicasts data items to avoid redundant unicast transmissions of the same data across sites. With these three features, it aims to control and reduce network usage to remain in free tier of services.
#codingexercise
Remove BST keys outside a given range

Node PruneBST(Node root, int min, int max)
{
if (root == null) return null;
root.left = PruneBST(root.left, min, max);
root.right = PruneBST(root.right, min, max);
if (root.data < min)
{
var right = root.right;
delete root;
return right;
}
if (root.data > max)
{
var left = root.left;
delete root;
return left;
}
return root;

The same code above can be modified to find the outliers of the given range.