Facebook Interview Question
SDE1sCountry: United States
Upon storing
Break the value into blocks containing a value and an unique key generated for the following block, or null if no more blocks left. The first block has a regular key
Upon retrieving
Read the first block, store a value block, check the key portion of the block. Retrieve next block by the key, or stop.
This requires consideration amount of memcache experience to properly answer. Few of my options are
1> Secondary Indexing, Where we let cache to know its existence and once hit, can redirect to where it is located.
2> Serialization, storing raw bit value, and distributing to multiple cache location till it finds end of object.
Both of the above process are generally used depending upon the requirements.
without use case this is hard to answer out of the blue, a few questions that might help moving it forward:
- Chris October 25, 2017- How big is the data?
- Is it structured data or a stream (e.g. video, audio)?
- Is it just a configuration issue?
- What do you plan to do with the data once received?
- Does it fit in memory on the requesting server (the one that looks up the data in the cache)? How about, if it handles multiple requests? Does it just send the data to an other machine, server?
- can you break it down into smaller pieces and get those pieces individually (multi get)?
- can you work on parts of the data?
- can you compress the data? (does this make sense)
- maybe the server just streams the data back to client, so, I might help using ip-rewriting and make the cache servers send individual chunks to the client... not sure if memcached can do that...
... maybe you can add a use case and some numbers?