Sunday, July 31, 2016

In yesterday's post, we talked about extending OneFS over mesos. In that we maintained separation between the  layers of OneFS services and mesos. However, we could also consider a hypothetical substitute for mesos but one that is virtual and integrated with OneFS such that the nodes of the cluster is directly maintained by OneFS. The way this differs from the current use of OneFS clusters is that it could use its own cluster nodes as well as mesos so long as it can delegate. One of the requirements for OneFS is that it needs a high speed network between the nodes so that data transfer and metadata operations are supported. When we replace the current physical resources with virtual resources for the OneFS, we should be mindful that the performance is at par so that the services can work seamlessly.
Another important consideration is that some datacenters for the sake of performance choose to pull in the direction away from commodity hardware and use racks as the basic building block of modern data centers instead of individual servers. A rack-scale set of computers is a class of hardware with pooled storage, compute and network such that thousands of cores are interconnected at high speed.  For example, at Microsoft rack-scale computing, the hardware, storage, networking and OS stacks are redesigned in a cross layer co-design manner so as to improve efficiencies. By using a direct server to server network topology, they provide the ability to overcome the hardware restrictions that convention OneFS deployments have. While this is another dimension to source the resources for the OneFS, it highlights the abstraction that OneFS core services can make in terms of what it is operating on while continuing to provide their respective functionalities to form scalable self-healing file system.
The use of mesos or the use of racks do not take away any of the functionality that OneFS services provide to stretch the filesystem over resources well beyond the individual server. The design of OneFS already makes the necessary assumptions to support growth and shrink of the resources. The difference is that while this is being done directly based on nodes, we now suggest a redirection through an abstraction that is suitable for all three - direct virtual resources, mesos delegation and rack computing.
This abstraction implies that customers can expect the same seamless managed storage layer across deployments both in the on-premise enterprise, datacenters and large scale cloud deployments.
Moreover, by providing this managed layer instead of raw storage, the applications are relieved of many storage and data maintenance considerations of scale, cost and performance enabling them to focus more on the compute and being able to push down the service to where they themselves can be rolled from one place to another. This improves operational benefits while reducing impact to architecture.
#codingexercise
Given a string and a pattern state whether it follows the pattern. For eg: input = “redblueredgreen” matches pattern “abac” but not “aaab” as ‘red’ means ‘a’, ‘blue’ means ‘b’ and ‘green’ means ‘c’ here. String input only contains words “red”, “green” & “blue” and pattern can have any character.
We could optionally modify the problem above to include any text so that the input elements of red, green, blue don't form well known demarcations in input.
Solution : we build a hashtable for pattern elements  and maintain a sequence.
bool IsSimilar(string text, string pattern, ref Hashtable h)
{
if (text =="" && pattern == "") return true;
if (text == "" && pattern != "") return false;
if (text != "" && pattern == "") return false;
for (int i = 1; i <= text.Length; i++)
{
var sub = text.substring(0,i);
if (h.contains(pattern[0])){
If(h[pattern[0]]  != sub)
{
Continue;
}else{
h.Add(pattern[0], sub);
}
If( IsSimilar(text.trimleft(sub), pattern.removefirst(), ref h))
return true;
h.remove(pattern[0], sub);
}
Return false;
}

Given a N*M matrix how many different sizes of rectangles or squares can be formed
int GetNumberOfSquaresRectangles(int n, int m)
{
int count = 0;
for (int i =1; i <= M; i++)
   for (int j = 1; j <=N; j++)
    count += 1;
return count;
}
now count the number of such rectangles formed for each cell as the starting point
int GetAll(int n, int m)
{
int count = 0;
for (int i =1; i <= M; i++)
   for (int j = 1; j <=N; j++)
    count += GetNumberOfSquaresRectangles(M-i+1, N-j+1);
return count;
}

No comments:

Post a Comment