Wednesday, September 26, 2018

The design of Queue Layer over object storage  
Problem statement:
Object Storage is perceived as backup and tertiary storage. This may come from the interpretation that this storage is not suitable for read and write intensive data transfers that are generally handled by file-system or database. However, not all data needs to be written deep into the object storage at once. The requirements for object storage need not even change while the reads and writes from the applications can be handled with a background processor. There can be a middle layer as a proxy for a file system to the application while utilizing the object storage for persistence.  This alleviates performance considerations to read and write deep into the private cloud each time. That is how this Queue Layer positions itself. It offers the same performance as enterprise message queue does to handle the workload and while it may use its own intermediate storage, it works as a staging for the data so that the data has a chance to asynchronously dispatched into object storage.
Queue service has been a commercially viable offering. Message Queue is an example of a Queue service that has shown substantial improvements to APIs. Since objects are accessed via S3 Apis, the use of such Queue service works very well. However, traditional Queue services have usually maintained ordered delivery of messages, retries, dead letter handling, along with journaled messages and Queue writes and their writes have been mostly write-throughs which reach all the way to the disk. This service may be looked at in the form of a cloud service that not only maintains its persistence in the object storage but also uses the hierarchy for isolating its queues.
Queue Service works closely with a cluster based storage layer or a database server and have traditionally been long standing products in the marketplace. RabbitMQ is a message broker that relays messages to processors. This Queue layer is well-positioned for web application traffic as well as those that utilize S3 APIs directly. Data reads and writes need not be synchronous anymore and callers and clients may do well to delegate it to the queues as a background task. Moreover the object storage can leverage geographical replication of objects within its layer. As long as this queuing layer establishes sync between say a distributed or cluster file system and object storage with duplicity-tool like logic, it can roll over all data eventually to persistence.
#codingexercise
Void generateAlternateCubes() {
Var cubes = GetCubes ();
cubes.Enumerate( (I , e) => { if ( (i%2 == 0) { Console.writeline (e); }} );
}

Tuesday, September 25, 2018

We were discussing the design of cache layer over  Object Storage. We have not compared this cache layer with a message queue server but there are interesting problems common to both. For example, we have a multiple producer single subscriber pattern in the periodic backups to the object storage. The message queue server or broker enables this kind of publisher-subscriber pattern with retries and dead letter queue. In addition, it journals the messages for review later. Messaging protocols are taken up a notch in performance with the use of a message queue broker and their reliance on sockets with steroids.  This leaves the interaction between the caches and the storage to be handled elegantly with well-known messaging framework. The message broker inherently comes with a scheduler to perform repeated tasks across publishers. Hence it is easy for the message queue server to perform as an orchestrator between the cache and the storage, leaving the cache to focus exclusively on the cache strategy suitable to the workloads.  Journaling of messages also helps with diagnosis and replay and probably there is no better store for these messages than the object storage itself. Since the broker operates in a cluster mode, it can scale to as many caches as available. Moreover, the journaling is not necessarily available with all the messaging protocols which counts as one of the advantages of using a message broker.  Aside from the queues dedicated to handle the backup of objects from cache to storage, the message broker is also uniquely positioned to provide differentiated treatment to the queues.  This introduction of quality of service levels expands the ability of the solution to meet varying and extreme workloads The message queue server is not only a nice to have feature but also a necessity and a convenience when we have a distributed cache to work with the object storage.

#codingexercise
Bool IsSubsetProduct(ref List<int> factors, int product) 
{ 
Assert (items.all (x => x > 0)); 
If (product == 1) return true; 
If (product <= 0) return false; 
if (items.Count() == 0 && product != 0) return false; 
Var last = factors.last(); 
factors.RemoveAt(factors.Count() - 1); 
if (last> product || product % last != 0 ) { 
Return IsSubsetProduct(ref factors, product); 
} 
Return isSubsetProduct(ref factors, product) |IsSubsetProduct(ref factors, product/last); 
} 


Monday, September 24, 2018

We were discussing the design of the Object cache layer versus the design of the Object Storage. The design from the cache may involve a very different deployment as compared to the object storage. There is no necessity for the cache layer to be handled by one server. There can be multiple servers within the object cache each with its own implementation of the server to determine the schedule of persistence of the objects to the store. This enables scale out of the cache layer across different nodes so that they handle only a small subset of objects. With a cluster-based deployment or the choice of a set of proxy servers, the cache may have a wide variety of choices for its implementation. The object storage is entirely cluster based and virtualizes the data center with its implementation of storage pool.  Its design is somewhat more restricted than the cache because it is storage oriented. The cache on the other hand is focused on the workloads and may choose to partition based on the object distribution to different cache servers. It can simply involve a distributed hash table and has similar distribution strategy as the gateway service in terms of the distribution of the objects to the designated caches. A Peer to peer network may be overlaid over the object storage to determine this object-cache distribution. There is no necessity to have a cluster only approach to the cache layer.  There are several benefits to this approach. First each cache is concerned with a small subset of the objects. Hence it is able to serve this workload better than if everything was part of the same cache. Second the implementation of the cache is now independent of the compute at that peer which allows far more commodity servers than if they were part of a cluster. Third each and every cache may store objects to the same object storage on the backend but provide the option to be bound to a specific workload allowing scale up where necessary.  Finally, the ability of such a cache to perform flush to disk is entirely encapsulated within the peer in a deeply isolated stack which enables far superior performance than a distributed file system. All these considerations make the cache layer stand out from the storage layer.  

Sunday, September 23, 2018

The cache layer can just as well utilize versioning if the updates were frequent and the objects were small and numerous. All the concerns with the persistence reside with the storage layer including the form and representation of the objects. Whether the objects are saved as repeated full byte-ranges of the objects or incremental updates to previous version is entirely the storage layers concern. On the other hand, the cache layer determines the schedule and the load of the updates. Therefore, it may choose to persist some objects more often than others.  The dynamic schedule is very helpful even to the customers workload because not all workloads can be satisfied by the same schedule. There are really two aspects to this dynamic schedule. First the cache layer determines which objects belong to which groups based on policies that can be evaluated on the nature of the workload. For example, heavy continuous writes require frequent persistence otherwise there is a chance that the updates might be lost. Light weight writes with heavy reads do not require frequent persistence otherwise the cached object will become invalidated more often than is necessary. Second, the cache layer decides between flush and backup operations. These operations are governed by the pools of treatments to objects that the cache layer maintains. The cache layer becomes smart merely by associating a group to a pool. While it may allow customizations to how the objects are mapped to groups, it reserves the administrative mapping of groups to pools of service levels. The pools have varying schedules for flush and backup operations. The flush to local disk and the backup from local disk to object storage are performed the same without any dependence on the object or the schedule. As long as the objects fall in one of the queues, it will be serviced.  The flush operation is largely unknown to the object storage since it is a convenience only for the cache layer to prevent data loss. The backup operation to object storage is however as streamlined as possible so that the data ingestion rate never goes down and the load can be met with adequate service level agreement. The cache layer provides the ability to fine tune the behavior at an object level and whether it stores segments or files before sending the object to the storage layer is its own concern. The two layers have mutually independent concerns but provide synergy in the form of a wider appeal of a durable store for all data generators. This cache layer could be internalized into the object storage but there is more benefit if they are separate. Unlike a gateway service that provide address resolution of an object to a specific site, a cache layer cannot be brought into the object storage because the name resolution is different from augmented read and write paths. If the object resides in the storage and is merely accessed via address resolution, there are no changes to the write on the object. On the other hand, the cache layer is heavy on the writes to the object storage and tries to be smart about sending the objects to the store. If this were to be part of the object storage, it would unnecessarily affect the writes of all objects. The object storage incurs cost to provide the kind of storage it does. It becomes harder for the object storage to provide the quality of service to individual workloads when it is performing distributed operations in a global store. The cache layer provides benefits outside the domain of the object storage assuming the latter is already the best for its domain. Therefore, the object cache and the object storage have to be separate layers and may be implemented with different designs



Saturday, September 22, 2018

We resume our discussion of using a cache layer with Object Storage. We said we could let objects age before they make it to storage. There were several benefits to this approach. First we need store the objects as versions. Second we could take incremental backups. Third along with the backup we retained the ability to reconstruct the object though archived data is generally not retrieved. We utilize archiving techniques like deduplication to reduce the footprint of the storage. Also, the data is made invulnerable when the old data is not modified by the new data. The new data is written separately and the good data from the old is never lost. This is demonstrated by many of the public clouds. For example, Windows Azure uses extent and many storage appliances do something similar especially with stream storage. This holds true with reconstruction as well and not just with versioning. Consequently, even deduplication appliances practice data invulnerability with their efforts to find segments that change.
Why do we focus on reconstruction as opposed to versioning of objects from the cache? This depends entirely on the schedule of the backup of objects from the cache to the object storage and the footprint we want to keep in the storage tier. The cache layer and the storage layer are separate. Both of them can have processing that can make those respective layers smart.

When we have immutable representation of data no matter how it is stored, it can provide immense benefits to data security, audit and restore. This idea for invulnerability is seen in many different forms of technologies. It not only helps with preservation but also helps with error codes. As long as the data has not changed, the error codes do not change. This is primarily the motivation behind durability.

Friday, September 21, 2018

Today we take a break from our discussions on Object Storage to review a few methods for topic detection in documents.
# Divides the region proposals on the Intersection-over-union value
def divideset(proposals,iou,value):
       # Make a function that tells us if a proposal is a candidate or not.
       split_function=None
       if isinstance(value,int) or isinstance(value,float):
              split_function=lambda proposal:proposal[iou]>=value
       else:
              split_function=lambda proposal:proposal[iou]==value
       # Divide the proposals into two sets
       set1 = [proposal for proposal in proposals if split_function(proposal)]
       set2 = [proposal for proposal in proposals if not split_function(proposal)]
       return (set1, set2)


Def gen_proposals(proposals, least_squares_estimates):
       # a proposal is origin, length, breadth written as say top-left and bottom-right corner of a bounding box
       # given many known topic vectors, the classifer helps detect the best match.
       # the bounding box is adjusted to maximize the intersection over union of this topic.
       # text is flowing so we can assume bounding boxes of sentences
       # fix origin and choose fixed step sizes to determine the adherence to the regression
       # repeat for different selections of origins.
       pass

Thursday, September 20, 2018

We were discussing that data can be allowed to age in one later before making its way to another. Let us consider now how to use this aging of objects. We transfer the objects from the cache to the storage when its updates have accumulated to one of the scheduled transfers. This interval could be very small or very large depending on the capability of the cache. By buffering the objects in the cache without writing it to object storage, we provide the ability to study the updates on the object. This might mean byte range updates to the object. If the objects are small, the updates don’t matter as the whole object can be overwritten. If the objects are large, keeping track of the byte range updates helps with the consolidation and re-organization of the updates. Why is this useful? The object storage takes the smallest unit of data storage as the object. It has no notion of what content that object has. Therefore, it sees the objects as byte ranges and keeps track of the updates to the objects in the form of byte ranges. By doing some of this early translation of overlapping byte range updates to non-overlapping updates, we make it easier for the object storage to persist the object. That is not all. How the object cache persists to the object storage may be entirely proprietary to the cache-based solution. Instead of relying on the versioning from the object storage, cache-based solution may propose to store incremental updates. The versioning had several drawbacks. It made unnecessary copies of every version and the whole object was copied. While it was simpler to get the whole object back, it was not necessary to make copies of the byte ranges that did not change. Moreover, with the repackaging of the objects, we now had the chance to perform deduplication of what we store. This allows us to reconstruct the object with what we store because typically not all of the contents change at once.