Each bucket points to a linked list of directory entrys (Dir) which point to "fragment"s which is a contiguous piece of an "object" or "document".
For performance reasons (to take advantage of the L1 cache) Dir entries allocated for a bucket are taken first from the other 3 entries in the bucket. Each "fragment" (part of an object up to 2MB) has a Dir entry. The 8K figure is a lower bound on the size of objects and hence the number of fragments and therefore the number of Dir entries the cache must provide for. The freelist in Part is used to store the linked list of free Dir entries within a segment. The method evacuateWrite is used to evacuate documents when the write_pos is about to write over a document. The cache is organized like a cyclone buffer or a log-based file system and evacuateWrite is part of the "cleaner". The method "aggWrite" collects all the pending fragments and groups them into a single write (for seek efficiency) of up to 4MB. It then does the write and notifies the CacheVC's (some of which might be doing evacuations) when the write is complete. john On Tue, Mar 8, 2011 at 4:25 AM, 张练 <wahu0315...@gmail.com> wrote: > I have some questions with the design of class Part. I think the Part is > divided into several Segments, and each Segments contain 2^16 buckets, and > each buckets contain 4 object. In default, every object's size is > 8000(proxy.config.cache.min_average_object_size), and each object has an > opposite element Dir to store their position in Part. The member named > header in Part, whose type is PartHeaderFooter, has an array member > freelist > used to store each Segment's position message, and with these message, Part > use some macro, such as part_dirlen and so on, to find every object's exact > position. > But i can't understand the following members' usage: > What are the meaning of method evacuateWrite and aggWrite? And what is > the logic of the implement of these methods? > > -- > Best regards, > mohan_zl >