Friday, March 10, 2017

We continue with a detailed study of Microsoft Azure stack as inferred from an introduction of Azure by Microsoft. We reviewed some more features of Azure storage. We saw how erasure coding works in Windows Azure Storage aka WAS and how its different from Pelican. We saw what steps WAS takes to improve durability. We also saw the benefits of journaling. We reviewed the partition layer which translates objects such as blob, table or queue to storage. We saw how the partition manager maintains a massive Object Table that is sharded on different partition servers which maintain their consistency across concurrent transactions using a lock service. We read the partition layer data model and the supported data types and operations, the partition layer architecture and the range partition data structures. we reviewed the load balancing, split and merge operations. Then we reviewed the intrastamp and interstamp replication. We also took stock of TCO, performance, application profiles and their comparision study
We reviewed some of their design choices. They separated nodes dedicated to computation from nodes dedicated to storage. They decided to use range based partitioning /indexing instead of hash based indexing for the partition layer's object table. They used throttling or isolation which proved very useful when accounts are not well behaved. They built in automatic load balancing  on range based partitioning approach and the account based throttling. They used separate log streams for each RangePartition to isolate the load time of each RangePartition. They used journaling to overcome the read/writes contention on the same drive.
 #codingexercise
To count total number of N digit numbers whose difference between sum of even and odd digits is 1, we modify it as follows:
long GetCountDiff(int digits, int even, int odd, int n, bool isOdd)
{
if (digits == n) return even - odd == 1 || odd - even == 1;
long count = 0;
if (isOdd){
    for (int i = 0; i <= 9; i++)
           count += GetCountDiff(digits+1, even, odd+i, n, false);
}else{
    for (int i = 0; i <= 9; i++)
           count+= GetCountDiff(digits+1, even+i, odd, n, true);
}
return count;
}

To skip leading zeros, we use a wrapper that counts from 1 to 9

long GetCountWrapper(int N)

{

   long count = 0;

   int digits = 0;

   int even = 0;

   int odd = 0;


   for (int i = 1; i<=9; i++)
              count += GetCountDiff(digits+1, even+i, odd, N, true);

   return count;
}
notice that the recursion chains for the number of digits N specified.

No comments:

Post a Comment