2011/4/27 ChangCheng <ccai...@msn.com> > > Hi: > I have some query about mechanisms for save and remove data from cache > No1: > I believe there is a big hash table when the TS Running in memory, i would > like to know when and how TS save this table into disk? > Does ATS save it into disk when this table changed? or save it into disk in > fixed-time slices? > How can ATS keep this table correct if ATS crashed during running? >
The directory is sync'd at the rate of 2MB/sec when it is dirty. The cache is a cyclone buffer and the current write pointer is sync'd with the directory. On resumption from a crash/hard stop, the recovery code reads forward from the write pointer just like a log-based file system and rebuilds the directory. This can take a while, so a clean shutdown (which will sync the directory) is advisable for productions systems with very large caches. > No2: > For limited hard Disk, how Can TS remove expired object from cache and keep > popular objects in Cache? > The cache is a cyclone buffer, and it will always write down every miss. For limited hard disk there are some options, including pinning objects in the cache and an option which is currently disabled called HIT_EVACUATE which will evacuate (save) objects when they are hit in the last half of the buffer. Alternative cache organizations can be much more expensive in terms of seeks/write. The current cyclone buffer is well suited to systems with adequate disk space. There is interest in making the cache pluggable, but I don't think it is ready for prime time. > For example. there are few objects only visit once and never be used again? > How can TS know their expired day and remove it? > Is there a separate Thread to check cache and keep it popular? > Not sure what you are getting at, but a cyclone buffer + hit evacuation can do a good job with adequate disk bandwidth. Large caches can typically hold a couple weeks worth of material, by which time the amortized cost of reloading popular content is low so hit evacuation is not necessary. > Thanks >