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); 
} 


No comments:

Post a Comment