How to warm up RAM storage
Hi,
I'd like to know how to warm up the RAM cached copy of some keys stored in the disk database.
My use case is serving images, so for example when the server is generating the html page with say 10 images in it, it knows right away that those 10 images are going to be requested once the browser parses the html page, one request for each 'img' html tag. So I would like to use the time it takes to send the page through the network, parse it in the browser, and again the latency to the image server for the 10 requests, to warm membase RAM copy with those 10 images.
I am thinking in spawning a component that hits membase while the page is being sent by the web server, so I guarantee that the images are going to be already in RAM (if they were in spinning disks), effectively reducing the disk seek time for each image.
I can't afford right now to have a copy of each image in RAM, that's why I want at least to improve the waiting time as much as I can.
I am wondering what's the best way to do it, from the documentation it says that the tiered storage (RAM and one type of disk so far) uses an LRU cache. I guess that I could do a GET(s) on the keys I want and then the images are going to be temporarily in RAM, so when the requests arrive they would be served from RAM. Is this reasoning correct? Is it a deterministic LRU algorithm, I mean no optimizations that would decide to drop some items not in LRU order some time?
Is there a way to make the images be taken to RAM without actually getting them? like a "exists" command that copies the value to RAM if it's not there. Any other ideas that could help in this use case?
Thanks,
Sebastian.
Sebastian, you're best bet is to use a 'multi-get' on the list of keys for those images. They will be brought to RAM and you could actually ignore the return values for the first request.
Perry
Forum support is great for free but sometimes you need a guaranteed response time and dedicated resources for your questions or issues.
Consider purchasing enterprise-level support from Couchbase: http://www.couchbase.com/products-and-services/overview
Call or email "sales -at- couchbase-dot- com" today!