Configuring memcached for a particular scenario
        Posted  
        
            by 
                pradeepchhetri
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by pradeepchhetri
        
        
        
        Published on 2012-12-15T14:01:45Z
        Indexed on 
            2012/12/15
            17:05 UTC
        
        
        Read the original article
        Hit count: 268
        
I have a web application which queries opentsdb server(which in backend using Hbase cluster) for the datapoints of different metrics and using dygraph javascript graphing library, I am plotting those metrics. Since getting all the datapoints of past one day from opentsdb for a particular metric is itself taking nearly 2 seconds, my application which is plotting nearly 25 metrics is becoming very slow.
In order to reduce this latency, I am thinking of using memcached module of php5 for caching all the queries. But I have few questions regarding memcached.
- Is there any way I can configure memcache to keep on updating its cache in the background by running some command line queries after particular interval of time. 
- Is there any way I can configure memcache to always reply for a query using cache instead of first updating its cache because my application just plots datapoints for past one day. Missing out some datapoints is not that critical. 
© Server Fault or respective owner