<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jan 23, 2013, at 21:40 , Aliaksandr Valialkin wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Wed, Jan 23, 2013 at 2:00 PM, Igor Sysoev <<a href="mailto:igor@sysoev.ru">igor@sysoev.ru</a>> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> - unlike nginx's file-based cache, stores all cached data in two files - one file is used for index, while the other file is used for cached data. These files aren't vulnerable to fragmentation, since their sizes never change after the application start.<br>
<br>
Well it eliminates the cache file fragmentation on file system, but how do you eliminate<br>
cached objects fragmentation inside the cache file?<br></blockquote><div><br></div><div>Cached objects fragmentation is eliminated by the following mechanisms build into ybc:</div><div>- cached object data always occupies a single contiguous memory region.</div>
<div>- cached objects are stored in a circular log. So newly objects may only overwrite the oldest objects stored in the log. This way the log cannot contain holes (except for stale, rolled back or overwritten objects).</div></div></blockquote><div><br></div>These holes mean that the algorithm has sources of the fragmentation.</div><div><br><blockquote type="cite"><div class="gmail_quote">
<div>- frequently requested objects with sizes smaller than the given threshold are periodically moved into the log's head. This guarantees that small hot objects will be always packed into the smallest possible memory region located near the log's head. Big objects with sizes exceeding multiple memory pages aren't moved, because there is no much sense in their defragmentation.</div>
</div></blockquote></div><div><br></div>What will happen with hot ~100K size objects? Will they be eventually overwritten with some new objects, probably<div>requested only once?<br><div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><br class="Apple-interchange-newline">--<br>Igor Sysoev<br></span></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Georgia; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><a href="http://nginx.com/support.html">http://nginx.com/support.html</a></span></div></span></span>
</div>
<br></div></div></body></html>