ã¢ããªã±ã¼ã·ã§ã³ãªã©OSããä¸ã«ä½ãããé«æ°´æºã®ããã°ã©ã ã§ã¯ãã¼ãã¦ã§ã¢ã®é度ã¨å®¹éãèæ ®ããªãæ°å¦çãã£ãã·ã¥ã¢ã«ã´ãªãºã ã使ãã主ã«ãããæ¬ç¨¿ã®å¯¾è±¡ã¨ããããã¼æ¢ç´¢ç¨ãããã¨æ示çãã£ãã·ã¥ãµã¤ãº(対ã¨ãªãå¤ãä¿æããã¦ãããã¼ã®ãµã¤ãº)ã¯è¨ç®éã«å«ã¾ããªãã
LRU
æãåç´ãã¤é«æ§è½ãªåºç¤çãã£ãã·ã¥ã¢ã«ã´ãªãºã ããã®ããæ§è½æ¯è¼ã®ãã¼ã¹ã©ã¤ã³ã¨ãã¦å¸¸ã«ä½¿ç¨ããããéã«è¨ãã°å®ç¨æä½æ°´æºã®æ§è½ã§ãããã¹ãã£ã³èæ§çç¡ã§ã¹ãã£ã³ä¸çºã§ãã£ãã·ã¥ã¨ãããçããªã»ããããã¼ãããããç´ãã«ãªãããé常ã«èãä¸ç¢ºå®ãªæ§è½ã¨ãªããã³ããã¼ã¯ã«ãããæ§è½ã表é¢ä¸ãã»ã©æªããªãè¦ãã¦ãå®éã®æ§è½ã¯ãã®ãããªå¤ä¹±ã«ãã大ããä½ä¸ããããããã®ããLRUããé«åº¦ãªä¸»è¦ã¢ã«ã´ãªãºã ã¯ãã¹ã¦å¤§ãªãå°ãªãã¹ãã£ã³èæ§ãåãã¦ãããã¡ãªã¿ã«ããã°ã©ãã³ã°è¨èªæ大ã®ããã±ã¼ã¸ããã¼ã¸ã£ã§ããJavaScript(NPM)ã¯ããã±ã¼ã¸æ°100ä¸ä»¥ä¸ãèªãã«ããããããLRUããã¾ã¨ããªãã£ãã·ã¥ã®å®è£ ããªãnodeãTinyLFUã®ãããªäººæ°ã®ãã¬ã¼ãºãä»ããååã«ååã¨ç¡é¢ä¿ã®å®è£ ãè²¼ãä»ããã¯ãªãã¯ãã¤ãã®è©æ¬ºããã±ã¼ã¸ã¨ããã¨ã©ã¼ãåãå£ããã¬ã©ã¯ã¿ã°ããè±å¯ãªã¹ã©ã ã¿ãããªç¶æ ã¨ãªã£ã¦ãããå¾çºã®Rust(10ä¸ããã±ã¼ã¸æªæº)ã¨Goã¯çè«çã«åªããå®è£ ãã¬ã³ã¬ã³è¿½å ããã¦ãã®ã«å ¨ä½çã«çè«çã«åªããå®è£ ã«ä¹ãããã£ãã·ã¥ãæãåæ©çã§åå§çãªLRUãã使ããªãè¶ ä½ç©ºé£è¡ããã°ã©ãã³ã°ã«çåãä¸æºãæããçè«çæé¤ãæã¤å¤©ä¸çã®ããã°ã©ãã«ä»äºãæ°ã¾ããã§éããåªããå®è£ ãæµãã§ããã ããã¾ã§åã®æ½°ããæ§ã延ã 使ãç¶ãæéãã§ãã¦ãæµè¡ãã®ã¹ã³ããã§é£½ããããåãç©´ãä½åº¦ãæã£ã¦ã¯åãç¶ãããå½ãã©ã³ãä½ãã«å¤ããããããJSerã¯ãªãªãã£ã¼ã注ç®ãéããããã«èåãªååãå½è£ ãã¦åå空éã¨æ¤ç´¢çµæãæ±æããæä½æ°´æºã®ããã°ã©ããéã¾ã£ã¦ããã«ç®¡çããã¦ãªãã®ã§ã¨ã«ãã質ã¨æ²»å®ãæªãã使ãå´ã容éè¶ ããã¨ã¯ã©ãã·ã¥ãããã£ãã·ã¥ãã©ãããã£ãã·ã¥ã¨æãè¾¼ãã§æ¯é±200ä¸DLãã¦ä½¿ã£ã¦ããã¢ãªä¸çã質ã¯éããçã¾ããã¨ã¯ä½ã ã£ãã®ãã
- https://www.npmjs.com/package/tinylfu
- https://www.npmjs.com/package/w-tinylfu
- https://www.npmjs.com/package/node-cache
- https://blog.sandworm.dev/one-in-two-new-npm-packages-is-seo-spam-right-now
Clock
主ã«OSããã¼ã¸ã³ã°ã®ããã«ä½¿ç¨ãããLRUã®é«éãªè¿ä¼¼ã¢ã«ã´ãªãºã ãã¨ã³ããªã®è¿½å ãO(n)ã§ããããã¢ããªã±ã¼ã·ã§ã³ãªã©ã§ä½¿ç¨ããä¸è¬çãªãã£ãã·ã¥ã¢ã«ã´ãªãºã ã¨ãã¦ã¯LRUããä½éã¨èªèãããã®é åã§ã¯ä½¿ç¨ããã¦ããªããåºãè延ãã誤ã£ãèªèã§ããããªã¹ãã使ç¨ããªãClockã¯GC管çä¸ã®ä½éãªãªã¹ãã«ããå®è£ ãããLRUãããé«éã«ãªããããã®ã§ããããã«ãããæ¼ç®ã«ããææªè¨ç®éO(n)ãå°ãªãã¨ã32åé«éåã§ãããJavaScript(V8)ã«ãããçè ã®å®è£ ã§ã¯æã人æ°ãã¤ä¸»è¦å®è£ ã®ä¸ã§æéã®LRUå®è£ ã§ããIsaacsã®LRU(ISCCache: lru-cacheãLRUCache: çè ã«ããããé«éãªãJavaScriptã«ãããæéã®LRUå®è£ ãDW-Cache: Dual Window Cache)ã®çåãã2åã®é度ãå®ç¾ãã¦ããä»ã®å¤ãã®è¨èªã§ãåæ§ã«O(n)ã®Clockã®ã»ããO(1)ã®LRUããé«éã«ãªãå¯è½æ§ããããã¾ãè¿ä¼¼ã¨ããã¨ä½æ§è½ã®å°è±¡ããããä¸è¨ä¸»è¦ãã³ããã¼ã¯ã§æ¯è¼ããã¨Clockã®ã»ããLRUãããããçã1-2%åå¾é«ãå ´åãå¤ã5-10%以ä¸é«ãå ´åããããããçã®è¦³ç¹ãããLRUããClockã®ã»ããåªãã¦ããããªãæã ã¯é·å¹´LRUã«çããã¦ããã®ãã
'Clock new x 982,257 ops/sec ±4.80% (102 runs sampled)' 'ISCCache new x 11,457 ops/sec ±1.49% (117 runs sampled)' 'LRUCache new x 21,184,221 ops/sec ±0.18% (123 runs sampled)' 'DW-Cache new x 5,459,649 ops/sec ±0.41% (123 runs sampled)' 'Clock simulation 100 x 10,520,040 ops/sec ±2.24% (120 runs sampled)' 'ISCCache simulation 100 x 8,148,950 ops/sec ±1.87% (119 runs sampled)' 'LRUCache simulation 100 x 9,110,929 ops/sec ±2.52% (118 runs sampled)' 'DW-Cache simulation 100 x 6,778,262 ops/sec ±2.27% (120 runs sampled)' 'Clock simulation 1,000 x 8,738,216 ops/sec ±2.20% (118 runs sampled)' 'ISCCache simulation 1,000 x 7,298,708 ops/sec ±1.85% (119 runs sampled)' 'LRUCache simulation 1,000 x 8,120,011 ops/sec ±2.55% (117 runs sampled)' 'DW-Cache simulation 1,000 x 6,656,796 ops/sec ±2.28% (119 runs sampled)' 'Clock simulation 10,000 x 8,546,724 ops/sec ±2.24% (119 runs sampled)' 'ISCCache simulation 10,000 x 6,479,979 ops/sec ±1.81% (120 runs sampled)' 'LRUCache simulation 10,000 x 7,455,903 ops/sec ±2.42% (120 runs sampled)' 'DW-Cache simulation 10,000 x 6,469,169 ops/sec ±1.95% (121 runs sampled)' 'Clock simulation 100,000 x 5,733,062 ops/sec ±1.61% (118 runs sampled)' 'ISCCache simulation 100,000 x 3,179,438 ops/sec ±1.84% (109 runs sampled)' 'LRUCache simulation 100,000 x 3,746,025 ops/sec ±2.09% (116 runs sampled)' 'DW-Cache simulation 100,000 x 3,319,309 ops/sec ±2.16% (114 runs sampled)' 'Clock simulation 1,000,000 x 2,949,250 ops/sec ±3.75% (104 runs sampled)' 'ISCCache simulation 1,000,000 x 1,487,123 ops/sec ±3.06% (100 runs sampled)' 'LRUCache simulation 1,000,000 x 1,725,359 ops/sec ±4.29% (106 runs sampled)' 'DW-Cache simulation 1,000,000 x 1,740,517 ops/sec ±2.10% (110 runs sampled)'
SLRU (Segmented LRU)
LRUãåºå®æ¯çã§åå²ããã£ãã·ã¥ãããã®æç¡ã§æ ¼ç´å ãå¤ãããé©åãªæ¯çã§ããã°LRUããé«ãæ§è½ãæå¾ ã§ãããé©åãªæ¯çã¯ç¨éã¨ç¶æ³ã«ããç°ãªãå½ç¶åçãªå¤åã«ã¯å¯¾å¿ã§ããæ±ç¨ã®LRUãç¹åã®SLRUã®é¢ä¿ã«ãããããã試ç¨åºé(åºæ¬20%)ãè¶ ããåå©ç¨è·é¢ã®ãã¼ã¿ã¯éã«ä»ã®ãã¼ã¿ã¸ã®ããããåºéè¶ éåãªãéã絶対ã«ãããããªããã対象ã®ã¯ã¼ã¯ãã¼ãã«ããã¦è©¦ç¨åºéãä¸è¶³ããªããäºå調æ»ãè¦ãããSLRUã«ã¯ãã£ãã·ã¥ãåã¾ãã¾ã§ã¯è¦å®ã®æ¬æ¥ã®è©¦ç¨åºéãè¶ ãã¦æ大ã§100%ã¾ã§è©¦ç¨åºéã延é·ããããã¨ã§æ¬æ¥ããææå¯è½ãªåå©ç¨è·é¢ãé·ãé«ããããçã§éå§ããããã«ä¿è·åºéã¸ã®ãããã«ããææå¯è½åå©ç¨è·é¢ã延é·ãããç¶æ ã§åä½ããæé»ã®ååãã¼ãã¹ãããããã®ãã使ç¨éå§ç´å¾ã¯ååãã¼ãã¹ã«ãããããçãé«ãã¨ãã¯ã¼ã¯ãã¼ãããã¬ã³ãã大ããå¤åããã¨ä¿è·åºéã¸ã®ãããã®æ¸å°ããªãã¡ææå¯è½åå©ç¨è·é¢ã®æ¸å°ã«ããææå¯è½åå©ç¨è·é¢ãæ¬æ¥ã®è©¦ç¨åºéã«è¿ã¥ãå¾ã ã«ã¾ãã¯æ¥æ¿ã«ãããçãä½ä¸ããå¯è½æ§ããããã¤ã¾ãååãã¼ãã¹ã«ãããã¼ã¹ãã失ãã¨äºåº¦ã¨åãæ»ããã¯ã¼ã¯ãã¼ãã®ä¸é¨ãåãåã£ãä¸è¬çãªãã³ããã¼ã¯ã§ã¯ãããçãé大ã¨ãªãå¯è½æ§ãããããæ£ç¢ºãªæ¯è¼ã¨è©ä¾¡ãã§ããªãããã®ããã«20%ã¨ãã試ç¨åºéã®å°ããã«ããã¯ã¼ã¯ãã¼ãã«ãã£ã¦ã¯ãã£ãã·ã¥ãå ¨ãæ©è½ããªããªãã¾ãã¯ã¯ã¼ã¯ãã¼ãããã¬ã³ãã®å¤åã«è¿½å¾ã§ãããããçãä½ä¸ããå¯è½æ§ãããã¨ããçè«çåé¡ã¨ä¿¡é ¼æ§ã®ä½ããSLRUãå é²çãã£ãã·ã¥ã¢ã«ã´ãªãºã ã®æ¯è¼å¯¾è±¡ã«å«ã¾ããªãçç±ã§ããããé«ããããçãå¾ãããç¶æ³ã§ãéã«ä¿è·åºéã®ä¸è¶³ã«ãããããçã伸ã³ãç¸å¯¾çã«ä½ä¸ããå¯è½æ§ããã帯ã«é·ã襷ã«çãæ±ãã«ãããããã
ARC (Adaptive Replacement Cache)
SLRUã®æ¯çããã£ãã·ã¥ãµã¤ãºã®(æ¬ä½ã¨åããã¦)2åã®å±¥æ´ã¨ãã£ãã·ã¥ãããã«ããåçã«å¤æ´ãããã¨ã§åçãªå¤åã«å¯¾å¿ãããé«ããããçãã人æ°ããã£ããç¹è¨±ã«ãã使ç¨ãå¶éããã¦ãããã¨ã¨4ã¤ã®ãªã¹ããæä½ãããªã¼ãã¼ãããã®é«ãããå¿é¿ããã¦ããããã®ããå¤ãã®ãããã¯ããLRUã«çããããSLRUãå£åçARCã¨ãã¦ä»»æã®åºå®æ¯çã§å¦¥åãã¦ä½¿ããç²é£¾æ¬ é¥ã¯ã½ã¢ã«ã´ãªãºã ã®LIRSãé¨ããã¦æ¡ç¨ãå½ç¶ã¯ã©ãã·ã¥ããããã¾ããä½æ§è½ãª(S)LRUã«æ»ããã¨ãã§ããæ°æ§ã§é¨ãé¨ã使ãã¯ãã«ãªã£ã(ãããã©ã¤ã¨ã¿ãªã§ã¯ç¹è¨±ã«æµè§¦ããªãããæ¹å¤ããARCã使ãå ´åãããããã )ããã®å¾ã¯ãã£ã±ãè¡èããã£ã¦ããã£ãã·ã¥ã¢ã«ã´ãªãºã ã®æ§è½ã¯ã¯ã¼ã¯ãã¼ãã«ä¾åãARCã¯ããã»ã©åªããã¢ã«ã´ãªãºã ã§ã¯ãªãã¨ãã£ã¹ããç¶ãã¦ãã(代ããã®åªããã¢ã«ã´ãªãºã ãæ示ã§ããããã§ããªãã®ã«)ãå®éARCã¯ã¹ãã£ã³èæ§ãä½ãã«ã¼ãèæ§ããªãããç¾å¨ã§ã¯æ代é ãã®ã¢ã«ã´ãªãºã ã¨è¨ã£ã¦ãéè¨ã§ã¯ãªãå®è£ ã«ä½¿ããã«ãã¤ã³APIã®å¶éã«ããLRUããå±¥æ´ã®ã¶ãå°ãªããµã¤ãºããæå®ã§ããªãå ´åããã(JavaScriptã®V8ã®Mapã¯æ大224ã¨ã³ããªã ãããå°ãªã1000ä¸ã§ãLRUãè½ã¡ãå ´åãè¦ããARCã¯ããã500ä¸ã§è½ã¡ã)ããªãARCã®åºæ¬ç¹è¨±ã¯ãã§ã«åãã¦ãã*1ããã§ã«ä¸ä½äºæã®DWCãããããç¨æ¸ã¿ã§ãããã¾ããæ»ã£ã¦ããã¨è¨ããã¦ãããé ãï¼
LIRS
ãã£ãã·ã¥ãµã¤ãºã®æ大2500åã®å±¥æ´ãä¿æããããæ¡ç¨ãããã¯ããã¡ã¢ãªä¸è¶³ã§ã¯ã©ãã·ã¥ããã¦ããè©æ¬ºã¢ã«ã´ãªãºã ãã©ããä»ã®ã¢ã«ã´ãªãºã ã«å¤ãããå±¥æ´ãµã¤ãºããã©ã¡ã¼ã¿åãã¦è²¬ä»»è»¢å«ãã¦ç¡çãã使ã£ã¦ããããæ¬å½ã®æ§è½ã¯èª°ã«ãããããªããè«æãèåã§å¤æ°ã®æåãããã¯ãã§æ¡ç¨å®ç¸¾ããã£ã¦ãä¿¡é ¼ã§ããåªããã¢ã«ã´ãªãºã ã§ãã証æã«ã¯ãªããªãã®ã§ãããå±¥æ´ã¯LIRæ«å°¾ã¾ãã¯HIRã¨ã³ããªã«ããããããæ大å¤ã«éããã¾ã§æ¡å¤§ãç¶ããããããã¨æ¡ä»¶ãæºããã¾ã§å±¥æ´ããã©ãä¸æ¬åé¤ããããã¬ã¤ãã³ã·ã¹ãã¤ã¯ã®åå ã¨ããªããã¡ã¤ã³ã¡ã¢ãªã®ã©ã³ãã ã¢ã¯ã»ã¹ã¬ã¤ãã³ã·ç´100nsãåºæºã¨ããã¨Linked Listã ãã§ãå±¥æ´å«ã10,000,000ã¨ã³ããªã®ä¸æ¬åé¤ã§1ç§ã®åæ¢ã¨ã¹ãã¤ã¯ã¨ãªãè¾æ¸ã®åé¤ãåãããã¨ããã«æªåãããã¾ãã¹ã«ã¼ãããããªã¹ããªã©ã®é常ã«é·ãåç §ã®GCã«ã¯æ¥éã«æè¦æéãå¢ãã転æç¹ãããå ´åãããæ°åã®å±¥æ´ã§ãã¹ã«ã¼ããããæ¥éã«ä½ä¸ãããããã®ãããªGCãæã¤è¨èªã§ã¯ã¡ã¢åãªã©ã®ãã£ãã·ã¥ã«ããé«éåã50%以ä¸ã¨ä½ãå ´åå±¥æ´ãµã¤ãºã転æç¹ãè¶ ããã¨LRUããã£ãã·ã¥ãªãã®ã»ããéããªããªã¹ã¯ãé«ã(JavaScriptã®V8ã§ã¯Doubly Linked Listã¯1ä¸ãã10ä¸ãã¼ããMapã¯10ä¸ãã100ä¸ã¨ã³ããªä»è¿ããã¹ã«ã¼ãããããã¼ãæ°10åãããç´1/2ãã1/3ã«æ¥éã«ä½ä¸ããããå¤åãã)ããã¼ã®æ¤ç´¢ã«ãããã使ã£ã¦ããã°å½ç¶ããããå±¥æ´ã®ã¶ãè¥å¤§åããã³ä½éåããLIRSã®å®ç¨çãªå±¥æ´ãµã¤ãºã®æ¨å¥¨å¤ã¯3â10åã§ãããã¯ã©ãã·ã¥ã®å®å®³ã¨ãããã®åé¡ã«ãããããã使ããç¶ããã®ã¯å½æã«ã¼ãèæ§ã®ããé«æ§è½ãã£ãã·ã¥ã¢ã«ã´ãªãºã ãä»ã«ãªããã¾ãã(S)LRUã«æ»ããªãã£ãããã§ããããç¾å¨ã¯ä»ã«ãã«ã¼ãèæ§ãæã¤DWCã¨W-TinyLFUãããã¨ã£ãã«å¯ä¸ã®é¸æè¢ã§ã¯ãªããªã£ã¦ããããããã¦å±éºã§æ§è½ãããããªãLIRSã使ãå¿ è¦ã¯ãªãããªãè¿å¹´ã®ç 究ã§ã¯ãã¼ã®å±¥æ´ãµã¤ãºã¯ãã£ãã·ã¥ãµã¤ãºã®2åãè¦ç¯çæ¨æºã¨ãªã£ã¦ããæ§åã伺ãä»å¾é©åãªå±¥æ´ãµã¤ãºãå®ã¾ãã¾ã§ãããã3åãé度ã ããã
TinyLFU
é常ã«é«æ§è½ãªæ°ãã£ãã·ã¥ã¢ã«ã´ãªãºã ã¨ãã¦ç¥ããã¦ãããå®éã«ã¯æ¬å½ã«æ§è½ãé«ãã®ã¯W-TinyLFUã ãã§TinyLFUã®ãããçã¯ç·åçã«ã¯LRUããæªããã¨ãè«æã«æè¨ããã¦ããã人æ°ã®é«ãRistrettoã¯ç¹ã«è«æéãã®SLRUã§ãªãLFUãã¡ã¤ã³ãã£ãã·ã¥ã«ä½¿ç¨ãã¦ãããããããçã大ããä½ä¸ããã¯ã¼ã¯ãã¼ããçãã¦ãããã¨ã«æ³¨æããªããã°ãªããªã(OLTPã§ã¯LRUããå¤§å¹ ã«æªãããã¬ã³ãã®å¤åã大ããã¯ã¼ã¯ãã¼ãã§ã¯LFUã®ç¹æ§ã«ããåæ§ã«æ§è½ãä½ãå¯è½æ§ããã)ããã«ã¼ã ãã£ã«ã¿(CountMinSketch)ã¯åé¤æä½ä¸å¯è½ã§ãããããã£ãã·ã¥ã¨ã³ããªãåé¤ããã»ã©å½é½æ§ããã³å½é°æ§ãå¢ãä¸å®æéå ã®ä»»æã¾ãã¯æå¹æéè¶ éã«ããåé¤æ°ã«æ¯ä¾ãã¦æ§è½ãä½ä¸ãããã¾ããã«ã¼ã ãã£ã«ã¿ããã¼ã¹ãã¢ã¯ã»ã¹ã§é£½åãæ§è½ãSLRUã®æ°´æºã«ã¾ã§ä½ä¸ããå¯è½æ§ãããããæ§è½å£åã®èå¼±æ§ãæ±ãã¦ããã«è¿ãç¶æ ã§ããé©åã«ãªã¼ãã¹ã±ã¼ã«ã§ããªããã°æ»æãèå¿ãªå¤§éã¢ã¯ã»ã¹ã§æ³å®ä»¥ä¸ã®æ¥éãªæ§è½å£åã«èããããªãå¯è½æ§ããããã¹ãã£ã³èæ§çç¡ã®LRUã»ã©ã§ã¯ãªããW-TinyLFUã®å±éº(ä¸å®å ¨)ãªæªå®æåã¨ããã®ãTinyLFUã®å®æ ã§ããç¨éã«å¯¾ãã¦ãã¬ã¼ããªãã許容å¯è½ãæ¤è¨ã¨æ¤è¨¼ãªãã«ä½¿ãã¹ãã§ãªãã¢ã«ã´ãªãºã ã§ãããããã«å®æçã«ãã«ã¼ã ãã£ã«ã¿ã®ä¸æ¬ãªã»ããã®ããã®é常ã«å¤§ããªå復å¦çãèµ°ãã¬ã¤ãã³ã·ã¹ãã¤ã¯ãçããããã«ã¼ã ãã£ã«ã¿ã®ãµã¤ãºã¯ãã£ãã·ã¥ãµã¤ãº(æ大ã¨ã³ããªæ°)ã®10åã§ãããããã£ãã·ã¥ãµã¤ãºã10,000,000ã§100,000,000å(Ristrettoãªã©å®è£ ã¨ãµã¤ãºã«ãã£ã¦ã¯æ大ã§ããã«2x4ã§8åã®800,000,000åãã¡ã¢ãªæ¶è²»ã¯1è¦ç´ 8bit(1byte)ã§ãããã400MB(100MBx4)ãã800MB(200MBx4))ã®å復å¦çã¨ãªããå復1å10nsã§ã1ç§(8ç§)ã®åæ¢ã¨ã¹ãã¤ã¯ãçãããã£ãã·ã¥ãµã¤ãºãè¨èªãå®è£ ã«ãã容æã«æªåããã(W-)TinyLFUã®ã¬ã¤ãã³ã·ã¯è¨±å®¹é度ãè¶ ãã¦ããå°ãªãã¨ãç¾å¨ã®å®è£ ã§ã¯ãªã³ã©ã¤ã³ãµã¼ãã¹ãªã©ã¬ã¤ãã³ã·ãèæ ®ãããç¨éã§ã¯ã¨ã³ã¿ã¼ãã©ã¤ãºã¬ãã«ã§ã¯ã¹ã±ã¼ã©ããªãã£ãä½ããã¦ä½¿ãç©ã«ãªããªãã ãã(ã«ãããããããªã³ã©ã¤ã³ã§ä½¿ã£ã¦ãã¨ããã¯ãããããã£ãã·ã¥ãµã¤ãºããã»ã©å¤§ãããªããã¹ãã¤ã¯ã«æ°ã¥ãã¦ãªããæ¾ç½®ãã¦ãã)ã(W-)TinyLFUã¯è¿å¹´äººæ°ã®é«ããã£ãã·ã¥ã¢ã«ã´ãªãºã ã ãã¬ã¤ãã³ã·ã«é大ãªæ¬ é¥ãåå¨ããã«ãããããããããèªèããç²ç®çã«ä½¿ããã¦ããããã«è¦ããããªã(W-)TinyLFUã¯ãã¼ããã«ã¼ã ãã£ã«ã¿ã«å¤æããå¿ è¦ããããããã¼ã®ãã¤ã³ã¿ã®ã¢ãã¬ã¹ãåããªããããªå¤æã³ã¹ããé«ãè¨èªã§ã¯ãªã¼ãã¼ããããé«ã(JavaScriptã¯é常ã«ãªã¼ãã¼ããããé«ããªãè¨èªã®ä¸ã¤ã§ãã)ãã¾ããã¤ã³ã¿ã®ã¢ãã¬ã¹ã使ç¨ããå ´åã¯ã¢ãã¬ã¹ã®åå©ç¨ã«ããå½é½æ§ãçããããçãä½ä¸ããå¯è½æ§ãããã©ã®ãããªç¶æ³ã§ã©ã®ç¨åº¦ä½ä¸ãããã¯æªç¥æ°ã§ãã(åãã¢ãã¬ã¹ãé »ç¹ã«åå©ç¨ãããã°å½ç¶èããä½ä¸ãã)ããã³ããã¼ã¯ã«ä½¿ç¨ããã¦ãããããã¯ã¢ã¯ã»ã¹ã«ããã¦ãæ¸ãè¾¼ã¿ç¯å²ã®ã¢ãã¬ã¹ã«ããã¦åãåé¡ãçããã¯ãã§ãããã«ã¼ã ãã£ã«ã¿ããæ¸ç®ããã¨ããªãã¨ã«ããããã精度ãä½ä¸ãããå ¬å¼å®è£ ã§ããCaffeineã«ããã¦ããã®ç²¾åº¦ä½ä¸ãçããªãæ¹æ³ã§æ¸¬å®(æ¸ãè¾¼ã¿ç¯å²ã¯ãã£ãã·ã¥ã«è¿½å ã¾ãã¯ç¡å¹åãããªããã°ãªããªãã¯ãã ãåã«å¦çãçç¥ããã¦ãã)ããã¦ããããæ¸ãè¾¼ã¿ãå«ãã¯ã¼ã¯ãã¼ãã®å ¬è¡¨ããã¦ãããããçã¯èª¤ã£ã測å®æ¹æ³ã«ããä¸æ£ç¢ºãªãã®ã§ããçããããã
W-TinyLFU
æããããçã®é«ããã£ãã·ã¥ã¢ã«ã´ãªãºã ã ãåé¤é »åº¦ãé«ããã¬ã¤ãã³ã·è¦ä»¶ãããå ´åã¯åè¿°ã®åé¡ã®ããæ¡ç¨ã§ããªãã ãããããè¦ãããW-TinyLFUã®ãããçã¯ããããåçã¦ã¤ã³ãã¦ã®ãã®(ã¾ããæ¯çæå®ãé ãããã§ãªã¼ãããã³ã°ã§ã¯ãªããã)ã§åºå®ã¦ã¤ã³ãã¦ã®å®è£ ã使ããªãã°é©åãªã¦ã¤ã³ãã¦æ¯çãèªåã§è¨å®ããªããã°ãªããªããåçã¦ã¤ã³ãã¦ã®W-TinyLFUã¯ãã£ãã·ã¥ãé »ç¹ã«ä½ãç´ããã¬ã¤ãã³ã·ã«å¯å®¹ã¾ãã¯ãã£ãã·ã¥ãµã¤ãºãå°ããã¨ã³ããªãé »ç¹ã«åé¤ãããã®è¨èªã§å¹ççã«å®è£ ã§ããã®ã§ããã°åªããæ§è½ãæå¾ ã§ããããã ãCaffeineã§ã¯åçã¦ã¤ã³ãã¦ã¨ã¤ã³ã¯ãªã¡ã³ã¿ã«ãªã»ãããå®è£ ããã¦ãããã®ã®ä¸¡æ¹ã使ç¨ããå ´åã®ãããçã¯æããã§ãªãåçã¦ã¤ã³ãã¦ã¨ã¤ã³ã¯ãªã¡ã³ã¿ã«ãªã»ãããåããå®è£ ãæå¾ éãå ¨è¬çã«é«æ§è½ã§ãããã¨ãå®è¨¼ãããã¼ã¿ã¯ãªããã¾ãã¤ã³ã¯ãªã¡ã³ã¿ã«ãªã»ããããå ´åã§ã1ã¢ã¯ã»ã¹ãã¨ã«é åè¦ç´ ã40å(10x4)ããªã»ããããªããã°ãªããæ¬è³ªçã«ãªã¼ãã¼ããããé«ãããã¬ã¤ãã³ã·ã¸ã®è¦æ±æ°´æºã®é«ãã¤ã³ã¡ã¢ãªKVSãã¡ã¢åãªã©ã§ã®æç¨æ§ã¯éå®çã¨ãªããããå¾ãªããã¨ã³ããªãµã¤ãºãå°ãããã°åè¿°ã®ããã«ãªã¼ãã¼ãããã®æ¯çãä¸ãããããçã§è£ããªãã»ã©ãã£ãã·ã¥ãµã¤ãºãã¨ãããçãä¸ãããããã«OSãè¨èªã®ã¡ã¢ãªå²ãå½ã¦æ¹æ³ã«ãã£ã¦ã¯åè¿°ã®ããã«ã¡ã¢ãªã¢ãã¬ã¹ã®é »ç¹ãªåå©ç¨ã«ãããããçãèããä½ä¸ããå¯è½æ§ãããããä¿¡é ¼æ§ãä½ããè¦ããã«æ§è½ä½ä¸è¦å ãå¤ãDWCã®ããã«ä½ãèããä½ã«ã§ã使ããã¢ã«ã´ãªãºã ã§ã¯ãªãåãåããæªããDWCã¯ä¸è½ãªè»½éç´ã§ããW-TinyLFUã¯æ¡ä»¶ãæºããã°æé«æ§è½ãçºæ®ããééç´ã§ããããªãW-TinyLFUã¯å½¢å¼çã«ã¯ã¨ã´ã£ã¯ã·ã§ã³ã¢ã«ã´ãªãºã ãªãã«ã¯æ©è½ããªãã¢ãããã·ã§ã³ã¢ã«ã´ãªãºã ã ãåçã¦ã¤ã³ãã¦ãåãããã®ã¯æ¬è³ªçã«ã¯ARCãDWCã¨åæ§ã«ã¦ã¤ã³ãã¦ãã£ãã·ã¥(LRU)ã¨ã¡ã¤ã³ãã£ãã·ã¥(SLRU)ã®2ã¤ã®ãã£ãã·ã¥æ¯çãé©å¿çã«èª¿æ´ããã¨ã´ã£ã¯ã·ã§ã³ã¢ã«ã´ãªãºã ã§ããã¨è¨ããã
è©ä¾¡é ç®
*1:https://patents.google.com/patent/US7167953B2/enãããä¸ã¤è¿½å ã®ç¹è¨±https://patents.google.com/patent/US20070106846A1/enããããã©ãé¢ä¿ãããããããããªã