Monday, November 12, 2018

Today we continue discussing the best practice from storage engineering:
36) Container Docker containers are also immensely popular for deployment and every server benefit from portability because it makes the server resilient from the issues faced by the host.

37) Congestion control: when requests are queued to the storage server, it can use the same sliding window technique that is used for congestion control in a tcp connection. Fundamentally there is no difference between giving each request a serial number in either case and handling them with the boundaries of the received and the processed at a rate that can keep the bounds manageable.

38) Standard query operators:  many bookkeeping operations can be translated to aggregates over simple key-value collections.  These aggregates so do not necessarily have to be dedicated customized logic. Instead if there was a generic way to perform standard query operations, many of the accounting can simply become similar query patterns

39) Queue: Most requests to the storage server are processed on a first come first served basis. This naturally suits the use of a queue as a data structure to hold the requests. Queues may be distributed in order to handle large volumes of requests. With distributed queues, the requests may be sent to partitions where they can be served best. Semantically all distributed queue processors behave the same in terms of the handling of request. They simply get the requests relevant to their partition

40) Task Schedulers:  Queues are used not just with storage partitions. They are also used for prioritizing workloads. Background task processors usually have long running jobs. These jobs may take several quantum of time slices. Even if the job were to be blocking when executed, they may need to be interleaved with other jobs. The purpose of the task scheduler is to decide which job runs next on the processor. In order to facilitate retries and periodic execution, a cron tab may be set up for the job.

41) Coordinator for nodes: Just like a scheduler, a co-ordinator hands out tasks to agents on remote nodes. This notion has been implemented in many forms and some as services over http. In some cases, the web services have given way to a registry of tasks that all nodes can read and update states for an individual job.
#codingexercise
int GetNodeWithRightImbalancedLeaves(Node root, ref List<Node> result)
{
if (root == null) return 0;
if (root.left == null && root.right == null) return 1;
int left = GetNodeWithRightImbalancedLeaves(root.left, ref result);
int right = GetNodeWithRightImbalancedLeaves(root.right, ref result);
if (right > left)
{
 result.Add(root);
}
return left + right;
}

No comments:

Post a Comment