ãã®è¬çŸ©ã¯ãã·ã¹ãã 管çè ã ãã§ãªããè² è·ã®é«ãã·ã¹ãã ããã°ã©ã ã®éçºè ã«ã圹ç«ã¡ãŸãã ãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®ã«ãŒãã«ãšã®çžäºäœçšãã©ã®ããã«çºçããããç解ããã®ã«åœ¹ç«ã¡ãŸãã
èŠçŽ
åžžé§ã¡ã¢ãª -ããã¯çŸåšããµãŒããŒãã³ã³ãã¥ãŒã¿ãŒãã©ãããããã®RAMã«ããã¡ã¢ãªãŒã®éã§ãã
å¿åã¡ã¢ãªã¯ããã¡ã€ã«ãã£ãã·ã¥ã®ãªãã¡ã¢ãªãšããã£ã¹ã¯äžã«ãã¡ã€ã«ããã¯ãšã³ããæã€ã¡ã¢ãªã§ãã
ããŒãžãã©ãŒã«ãã¯ã¡ã¢ãªã¢ã¯ã»ã¹ãã©ããã§ãã ä»®æ³ã¡ã¢ãªãæäœãããšãã®éåžžã®ã¡ã«ããºã ã
http://www.slideshare.net/yandex/linux-44775898ã§ã®ãã¬ãŒã³ããŒã·ã§ã³ã¯å©çšã§ããŸããã
ã¡ã¢ãªã®ããŒãž
ã¡ã¢ãªãŒã®åŠçã¯ããŒãžããšã«æŽçãããŠããŸãã éåžžãã¡ã¢ãªãµã€ãºã¯å€§ãããã¢ãã¬ã¹æå®ã¯ãããŸããããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ãšããŒããŠã§ã¢ãåã¢ãã¬ã¹ãåå¥ã«åŠçããããšã¯ããŸã䟿å©ã§ã¯ãªãããããã¹ãŠã®ã¡ã¢ãªã¯ããŒãžã«åå²ãããŸãã ããŒãžãµã€ãº-4 KBã ç°ãªããµã€ãºã®ããŒãžããããŸãããããã2 MBã®å·šå€§ããŒãžãš1 GBã®ããŒãžã§ãïŒä»æ¥ã¯èª¬æããŸããïŒã
ä»®æ³ã¡ã¢ãªã¯ãããã»ã¹ã®ã¢ãã¬ã¹ç©ºéã§ãã ããã»ã¹ã¯ç©çã¡ã¢ãªã§ã¯ãªããä»®æ³ã¡ã¢ãªã§çŽæ¥åäœããŸãã ãã®ãããªæœè±¡åã«ããã誀ã£ãã¡ã¢ãªã¢ãã¬ã¹ãå¥ã®ããã»ã¹ã®ã¢ãã¬ã¹ã«èª€ã£ãŠã¢ã¯ã»ã¹ã§ãããšèããã®ã§ã¯ãªããã¢ããªã±ãŒã·ã§ã³ã³ãŒããèšè¿°ãããããªããŸãã ããã«ãããã¢ããªã±ãŒã·ã§ã³éçºãç°¡çŽ åããã以äžã§èª¬æããã¡ã«ããºã ã«ãããã¡ã€ã³RAMã®ãµã€ãºãè¶ ããããšãã§ããŸãã ä»®æ³ã¡ã¢ãªã¯ãã¡ã€ã³ã¡ã¢ãªãšã¹ã¯ããããã€ã¹ã§æ§æãããŸãã ã€ãŸããä»®æ³ã¡ã¢ãªã®éã¯ãååãšããŠç¡å¶éã®ãµã€ãºã«ããããšãã§ããŸãã
ã·ã¹ãã å ã®ä»®æ³ã¡ã¢ãªã管çããããã«ã
overcommit
ãã©ã¡ãŒã¿ãŒããããŸãã 圌ã¯ãã¡ã¢ãªã®ãµã€ãºãåå©çšããªãããã«ããŸãã sysctlã§ç®¡çããã次ã®3ã€ã®å€ã«ãªããŸãã
- 0ãããã©ã«ãå€ã§ãã ãã®å Žåããã¥ãŒãªã¹ãã£ãã¯ã䜿çšãããŸããããã«ãããã·ã¹ãã ã«ãããããå€ãã®ä»®æ³ã¡ã¢ãªãããã»ã¹ã«å²ãåœãŠãããšãã§ããªããªããŸãã
- 1-å²ãåœãŠãããã¡ã¢ãªã®éã«åŸããªãããšã瀺ããŸãã ããã¯ãããšãã°ã倧éã®ããŒã¿ãå²ãåœãŠãŠç¹å¥ãªæ¹æ³ã§ããããæäœããèšç®ããã°ã©ã ã§åœ¹ç«ã¡ãŸãã
- 2-ããã»ã¹å ã®ä»®æ³ã¡ã¢ãªã®éãå³å¯ã«å¶éã§ãããã©ã¡ãŒã¿ãŒã
ãã¡ã€ã«
/proc/meminfo
ã®è¡
CommitLimit
ãš
Commited_AS
ã§ãã³ãããããã¡ã¢ãªã®éã䜿çšéãå²ãåœãŠå¯èœãªéã確èªã§ããŸãã
ã¡ã¢ãªãŸãŒã³ãšNUMA
ææ°ã®ã·ã¹ãã ã§ã¯ããã¹ãŠã®ä»®æ³ã¡ã¢ãªãNUMAããŒãã«åå²ãããŠããŸãã 1ã€ã®ããã»ããµãš1ã€ã®ã¡ã¢ãªãã³ã¯ïŒã¡ã¢ãªãã³ã¯ïŒãåããã³ã³ãã¥ãŒã¿ãŒãã§ããŸããã ãã®ã¢ãŒããã¯ãã£ã¯UMA ïŒSMPïŒãšåŒã°ããŠããŸããã ãã¹ãŠãéåžžã«æ確ã§ããïŒãã¹ãŠã®ã³ã³ããŒãã³ãã®éä¿¡ã®ããã®1ã€ã®ã·ã¹ãã ãã¹ã ãã®åŸãäžäŸ¿ã«ãªããã¢ãŒããã¯ãã£ã®éçºãå¶éããå§ãããã®çµæãNUMAãçºæãããŸããã
ã¹ã©ã€ããããããããã«ããããã£ãã«äžã§äºãã«éä¿¡ãã2ã€ã®ããã»ããµããããããããã«ã¡ã¢ãªãã³ã¯ãšéä¿¡ããããã®ç¬èªã®ãã¹ããããŸãã ãã®å³ãèŠããšãNUMAããŒãã®CPU 1ããRAM 1ãžã®é 延ã¯ãCPU 1ããRAM 2ãžã®é 延ã®ååã«ãªããŸãããã®ããŒã¿ãšãã®ä»ã®æ å ±ã¯ã
numactl hardware
ã³ãã³ãã䜿çšããŠ
numactl hardware
ã
ãµãŒããŒã«ã¯2ã€ã®ããŒããšãã®æ å ±ïŒåããŒãã®ç©ºãç©çã¡ã¢ãªã®éïŒããããŸãã ã¡ã¢ãªã¯åããŒãã«åå¥ã«å²ãåœãŠãããŸãã ãããã£ãŠã1ã€ã®ããŒãã§ãã¹ãŠã®ç©ºãã¡ã¢ãªãæ¶è²»ããä»ã®ããŒãã®è² è·ãæžããããšãã§ããŸãã ãããåé¿ããã«ã¯ïŒããŒã¿ããŒã¹ã®ç¹æ§ã§ãïŒãã³ãã³ãnumactl interleave = allã䜿çšããŠããã»ã¹ãéå§ã§ããŸãã ããã«ããã2ã€ã®ããŒãéã§ã¡ã¢ãªå²ãåœãŠãåçã«åæ£ã§ããŸãã ããã§ãªãå Žåãã«ãŒãã«ã¯ãã®ããã»ã¹ã®å®è¡ãã¹ã±ãžã¥ãŒã«ãããããŒããéžæãïŒCPUã¹ã±ãžã¥ãŒãªã³ã°ïŒãåžžã«ã¡ã¢ãªãå²ãåœãŠãããšããŸãã
ãŸããã·ã¹ãã å ã®ã¡ã¢ãªã¯ã¡ã¢ãªãŸãŒã³ã«åå²ãããŸãã åNUMAããŒãã¯ããã®ãããªãŸãŒã³ã«ããã€ãåå²ãããŠããŸãã ãããã¯ãã¢ãã¬ã¹ç¯å²å šäœã§éä¿¡ã§ããªãç¹æ®ãªããŒããŠã§ã¢ããµããŒãããã®ã«åœ¹ç«ã¡ãŸãã ããšãã°ãZONE_DMAã¯æåã®ã¢ãã¬ã¹ã®16 MBãZONE_DMA32ã¯4 GBã§ãã
/proc/zoneinfo
ã¡ã¢ãªãŸãŒã³ãšãã®ã¹ããŒã¿ã¹ã確èªã
/proc/zoneinfo
ã
ããŒãžãã£ãã·ã¥
Linuxã®ããŒãžãã£ãã·ã¥ãä»ããŠããã¹ãŠã®èªã¿åãããã³æžã蟌ã¿æäœãããã©ã«ãã§å®è¡ãããŸãã ããã¯åçãªå€§ããã§ããã€ãŸããããã空ããŠããã°ããã¹ãŠã®èšæ¶ãé£ã¹ãã®ã¯åœŒã§ãã å€ããžã§ãŒã¯ã«ããããã«ããµãŒããŒã«ç©ºãã¡ã¢ãªãå¿ èŠãªå Žåã¯ããµãŒããŒããã¡ã¢ãªãåŒãåºããŠãã ããã ããŒãžãã£ãã·ã¥ã¯ãèªã¿åã£ããã¹ãŠã®ãã¡ã€ã«ãããŒãžã«åå²ããŸãïŒåè¿°ã®ããã«ãããŒãžã¯4 KBã§ãïŒã ããŒãžãã£ãã·ã¥ã®ç¹å®ã®ãã¡ã€ã«ã«ããŒãžããããã©ããã確èªããã«ã¯ã
mincore()
ã·ã¹ãã ã³ãŒã«ã䜿çšããŸãã ãŸãã¯ããã®ã·ã¹ãã ã³ãŒã«ã䜿çšããŠèšè¿°ãããvmtouchãŠãŒãã£ãªãã£ã䜿çšããŸãã
é²é³ã¯ã©ãã§ããïŒ ãã£ã¹ã¯ãžã®æžã蟌ã¿ã¯ããã«ã¯è¡ãããŸããããããŒãžãã£ãã·ã¥ã§è¡ãããããã¯ã»ãŒç¬æã«è¡ãããŸãã ããã§ã¯ãèå³æ·±ããç°åžžããèŠãããšãã§ããŸãããã£ã¹ã¯ãžã®æžã蟌ã¿ã¯ãèªã¿åããããã¯ããã«é«éã§ãã äºå®ãïŒãã¡ã€ã«ã®ãã®ããŒãžãããŒãžãã£ãã·ã¥ã«ãªãå ŽåïŒèªã¿åãæã«ã¯ããã£ã¹ã¯ã«ç§»åããŠåæçã«å¿çãåŸ æ©ããã¬ã³ãŒãã¯ããã«ãã£ãã·ã¥ã«ç§»åããŸãã
ãã®åäœã®æ¬ ç¹ã¯ãå®éã«ã¯ããŒã¿ãã©ãã«ãèšé²ãããŠããªãããšã§ããããŒã¿ã¯åã«ã¡ã¢ãªå ã«ããããã€ããã£ã¹ã¯ã«ãã©ãã·ã¥ããå¿ èŠããããŸãã åããŒãžã«ã¯ãèšé²æã«ãã§ãã¯ããŒã¯ãä»ããããŸãïŒããŒãã£ãšåŒã°ããŸãïŒã ãã®ãããªããŒãã£ããŒãžã¯ããŒãžãã£ãã·ã¥ã«è¡šç€ºãããŸãã ãããã®ããŒãžã®å€ããèç©ããå Žåãã·ã¹ãã ã¯ãããããã£ã¹ã¯ã«ãã³ãããæéã§ãããšç解ããŸããããããªããšããããã倱ãå¯èœæ§ããããŸãïŒé»æºãçªç¶å€±ããããšãããŒã¿ã倱ãããŸãïŒã
ããã»ã¹ã¡ã¢ãª
ãã®ããã»ã¹ã¯ã次ã®ã»ã°ã¡ã³ãã§æ§æãããŠããŸãã ã¹ã¿ãã¯ã¯å°ãããªããŸãã 圌ã«ã¯æé·ã§ããªãéçããããŸãã
次ã«mmapé åããããŸãïŒ
mmap()
ã·ã¹ãã ã³ãŒã«ãä»ããŠéããããŸãã¯äœæãããã¹ãŠã®ã¡ã¢ãªãããããã»ã¹ãã¡ã€ã«ããããŸãã 次ã«ã䜿çšå¯èœãªæªå²ãåœãŠã®ä»®æ³ã¡ã¢ãªã®å€§ããªã¹ããŒã¹ããããŸãã äžããäžã«ããŒããæé·ããŸã-ããã¯å¿åã®èšæ¶é åã§ãã 以äžã¯ãç§ãã¡ãç«ã¡äžããŠãããã€ããªã®é åã§ãã
ããã»ã¹å ã®ã¡ã¢ãªã«ã€ããŠè©±ããŠããå ŽåãããŒãžã®æäœãäžäŸ¿ã§ããååãšããŠãããã»ã¹å ã®ã¡ã¢ãªã®å²ãåœãŠã¯ãããã¯åäœã§è¡ãããŸãã 1ã€ãŸãã¯2ã€ã®ããŒãžãéžæããå¿ èŠã¯ã»ãšãã©ãããŸãããéåžžãç¹å®ã®ããŒãžééãããã«éžæããå¿ èŠããããŸãã ãã®ãããLinuxã«ã¯ä»®æ³ã¡ã¢ãªé åïŒVMAïŒãªã©ãããããã®ããã»ã¹ã®ä»®æ³ã¢ãã¬ã¹ç©ºéå ã«ããçš®ã®ã¢ãã¬ã¹ç©ºéãèšè¿°ããŸãã ãã®ãããªåVMAã«ã¯ç¬èªã®æš©å©ïŒèªã¿åããæžã蟌ã¿ãå®è¡ïŒãšã¹ã³ãŒãããããŸãããã©ã€ããŒããŸãã¯å ±æïŒã·ã¹ãã å ã®ä»ã®ããã»ã¹ãšãå ±æãïŒããããšãã§ããŸãã
ã¡ã¢ãªå²ãåœãŠ
ã¡ã¢ãªã®å²ãåœãŠã¯4ã€ã®ã±ãŒã¹ã«åããããšãã§ããŸãããã©ã€ããŒãã¡ã¢ãªã®å²ãåœãŠãšã誰ããšå ±æïŒå ±æïŒã§ããã¡ã¢ãªã®å²ãåœãŠããããŸãã ä»ã®2ã€ã®ã«ããŽãªã¯ãå¿åã¡ã¢ãªãšãã£ã¹ã¯äžã®ãã¡ã€ã«ã«é¢é£ä»ããããã«ããŽãªã«åå²ãããŸãã æãäžè¬çãªã¡ã¢ãªå²ãåœãŠé¢æ°ã¯ãmallocããã³freeã§ãã
glibc malloc()
ã«ã€ããŠèª¬æãããšãå¿åã¡ã¢ãªãèå³æ·±ãæ¹æ³ã§å²ãåœãŠãŸããããŒãã䜿çšããŠå°ããªããªã¥ãŒã ïŒ128 KBæªæºïŒãš
mmap()
ã倧ããªããªã¥ãŒã ã«å²ãåœãŠãŸãã ãã®å²ãåœãŠã¯ãã¡ã¢ãªãããæé©ã«äœ¿çšããã·ã¹ãã ã«ç°¡åã«è»¢éã§ããããã«ããããã«å¿ èŠã§ãã ããŒãã«ååãªã¡ã¢ãªãå²ãåœãŠãããŠããªãå Žåã
brk()
ã·ã¹ãã ã³ãŒã«ãåŒã³åºãããããŒãã®å¢çãæ¡åŒµãããŸãã
mmap()
ã·ã¹ãã ã³ãŒã«ã¯ããã¡ã€ã«ã®å 容ãã¢ãã¬ã¹ç©ºéã«ãããã³ã°ããŸãã
munmap()
ã¯è¡šç€ºã解æŸããŸãã
mmap()
ã¯ãå€æŽã®å¯èŠæ§ãšã¢ã¯ã»ã¹ã¬ãã«ãå¶åŸ¡ãããã©ã°ããããŸãã
å®éãLinuxã¯èŠæ±ããããã¹ãŠã®ã¡ã¢ãªãäžåºŠã«å²ãåœãŠãããã§ã¯ãããŸããã ã¡ã¢ãªå²ãåœãŠã®ããã»ã¹-ããã³ãããŒãžã³ã°-ã¯ãã·ã¹ãã ã®ã«ãŒãã«ã«ã¡ã¢ãªã®ããŒãžãèŠæ±ãããããOnly Allocatedãšãªã¢ã«åé¡ããããšããäºå®ããå§ãŸããŸãã ã«ãŒãã«ã¯ããã»ã¹ã«å¿çããŸããããã«ã¡ã¢ãªããŒãžãããã䜿çšã§ããŸãã ãããŠãä»ã«ã¯äœãèµ·ãããŸããã ç©ççãªå²ãåœãŠã¯çºçããŸããã ãããŠãããã¯ãã®ããŒãžã«èšé²ããããšããå Žåã«ã®ã¿èµ·ãããŸãã ãã®æç¹ã§ãã¢ããŒã«ã¯ããŒãžããŒãã«ã«ç§»åããŸãããã®æ§é ã¯ãããã»ã¹ã®ä»®æ³ã¢ãã¬ã¹ãRAMã®ç©çã¢ãã¬ã¹ã«å€æããŸãã ãã®å Žåãå³ãããããããã«ãMMUãšTLBã®2ã€ã®ãŠããããé¢ä¿ããŸãã ããã«ãããå²ãåœãŠãé«éåããä»®æ³ã¢ãã¬ã¹ãç©çã¢ãã¬ã¹ã«å€æããããšãã§ããŸãã
ããŒãžããŒãã«ã®ãã®ããŒãžã«å¯Ÿå¿ãããã®ããªããã€ãŸãç©çã¡ã¢ãªãšã®æ¥ç¶ããªãããšãç解ããåŸããã£ã¹ã¯ãžã®ã¢ã¯ã»ã¹ããªããããããŒãžãã©ãŒã«ãïŒãã®å Žåã¯ãã€ããŒïŒãã€ããŒïŒïŒãååŸããŸãã ãã®ããã»ã¹ã®åŸãã·ã¹ãã ã¯å°çšã¡ã¢ãªããŒãžã«èšé²ã§ããŸãã ããã»ã¹ã§ã¯ãããã¯ãã¹ãŠééçã«è¡ãããŸãã ãŸããããã»ã¹ã®ãã€ããŒããŒãžãã©ãŒã«ãã«ãŠã³ã¿ãŒã1ãŠãããå¢å ããããšã確èªã§ããŸãã ãŸããããŒãžã®ã³ã³ãã³ãã®ããã«ãã£ã¹ã¯ã«ã¢ã¯ã»ã¹ããå ŽåïŒ
mmpa()
å Žå
mmpa()
ã¯ãé倧ãªããŒãžãã©ãŒã«ãããããŸãã
Linuxã§ã¡ã¢ãªãæäœããéã®ç§-ã®1ã€ã§ããæžã蟌ã¿æã³ããŒã§ã¯ãéåžžã«é«éãªããã»ã¹ïŒãã©ãŒã¯ïŒãäœæã§ããŸãã
ãã¡ã€ã«ãšã¡ã¢ãªãæäœãã
ã¡ã¢ãªãµãã·ã¹ãã ãšãã¡ã€ã«ãµãã·ã¹ãã ã¯å¯æ¥ã«é¢é£ããŠããŸãã ãã©ã€ããçŽæ¥æäœããããšã¯éåžžã«é ããããã«ãŒãã«ã¯RAMãã¬ã€ã€ãŒãšããŠäœ¿çšããŸãã
malloc()
ã¯ããå€ãã®ã¡ã¢ãªã䜿çšããŸãããŠãŒã¶ãŒç©ºéãžã®ã³ããŒãçºçããŸãã ããå€ãã®CPUãæ¶è²»ããã
mmap()
ä»ããŠãã¡ã€ã«ãæäœããŠ
mmap()
å Žåãããå€ãã®ã³ã³ããã¹ãã¹ã€ãããååŸãããŸãã
ã©ã®ãããªçµè«ãå°ãåºãããšãã§ããŸããïŒ ã¡ã¢ãªãšåæ§ã«ãã¡ã€ã«ãæäœã§ããŸãã ã¬ã€ãžãŒã¬ã€ãã£ã³ã°ããããŸããã€ãŸããéåžžã«å€§ããªãã¡ã€ã«ããããã§ããå¿ èŠãªå Žåã«ã®ã¿ããŒãžãã£ãã·ã¥ãä»ããŠããã»ã¹ã®ã¡ã¢ãªã«ããŒããããŸãã ãŸããã·ã¹ãã ã³ãŒã«ã®äœ¿çšãå°ãªããªããæçµçã«ã¡ã¢ãªãç¯çŽãããããããã¹ãŠãé«éã«ãªããŸãã ãŸããããã°ã©ã ã®æåŸã§ã¯ãã¡ã¢ãªã¯ã©ãã«ã移åãããããŒãžãã£ãã·ã¥ã«æ®ããŸãã
æåã¯ãã¹ãŠã®æžã蟌ã¿ãšèªã¿åããããŒãžãã£ãã·ã¥ãçµç±ãããšèšãããŠããŸããããäœããã®çç±ã§ãã®åäœããé¢ããå¿ èŠãããå ŽåããããŸãã InnoDBã䜿çšããMySQLãªã©ãäžéšã®ãœãããŠã§ã¢è£œåã¯ãã®æ¹æ³ã§åäœããŸãã
è¿ãå°æ¥ããã®ãã¡ã€ã«ã䜿çšããªãããšãã«ãŒãã«ã«äŒããããšãã§ããç¹å¥ãªã·ã¹ãã ã³ãŒã«ã䜿çšããŠããŒãžãã£ãã·ã¥ããããŒãžã匷å¶çã«ã¢ã³ããŒãã§ããŸãã
- posix_fadvideïŒïŒ;
- madviseïŒïŒ;
- mincoreïŒïŒã
vmtouchãŠãŒãã£ãªãã£ã¯ãããŒãžãã£ãã·ã¥ãããã¡ã€ã«ããããŒãžãåé€ããããšãã§ããŸã-ãeãããŒã
å èªã¿
å èªã¿ã«ã€ããŠè©±ããŸãããã ããŒãžãã£ãã·ã¥ã䜿çšããŠãã£ã¹ã¯ãããã¡ã€ã«ããã¹ãŠã®ããŒãžã«èªã¿èŸŒããšãããŒãžãã©ãŒã«ããéåžžã«å€ããªããããŒã¿ã®ããã«ãã£ã¹ã¯ã«ã¢ã¯ã»ã¹ããããšããããããŸãã ãããã£ãŠãReadaheadã®ãµã€ãºãå¶åŸ¡ã§ããŸããæåã®ããŒãžãš2çªç®ã®ããŒãžãèªã¿åããšãã«ãŒãã«ã¯ããããã3çªç®ã®ããŒãžãå¿ èŠã§ããããšãç解ããŸãã ãŸãããã£ã¹ã¯ã«ç§»åããã®ã¯è²»çšãããããããäºåã«ãã¡ã€ã«ãããŒãžãã£ãã·ã¥ã«ã¢ããããŒãããå°æ¥çã«ãã¡ã€ã«ããå¿çããããšã§ãäºåã«ããå°ãèªãããšãã§ããŸãã ãããã£ãŠãå°æ¥ã®éãã¡ãžã£ãŒããŒãžãã©ãŒã«ãã¯ããã€ããŒãã€ããŒããŒãžãã©ãŒã«ãã«çœ®ãæããããŸãã
ã ããç§ãã¡ã¯çã«èšæ¶ãäžããŸããããã¹ãŠã®ããã»ã¹ã¯å¹žãã§ãçªç¶ç§ãã¡ã®èšæ¶ã¯çµãããŸããã ä»ãç§ãã¡ã¯äœãšã圌女ã解æŸããå¿ èŠããããŸãã ã«ãŒãã«å ã®ç©ºãã¡ã¢ãªãèŠã€ããŠå²ãåœãŠãããã»ã¹ã¯ãããŒãžåå©çšãšåŒã°ããŸãã ã¡ã¢ãªãŒã«ã¯ãåãå»ãããšã®ã§ããªãã¡ã¢ãªãŒã®ããŒãžããããŸã-ããã¯ãããããŒãžïŒããã¯ãããŠããïŒã ãããã«å ããŠãããŒãžã«ã¯ããã«4ã€ã®ã«ããŽãªããããŸãã ã·ã¹ãã å šäœã®é床ãäœäžãããããã¢ã³ããŒãããªãã«ãŒãã«ããŒãžã ã¹ã¯ããå¯èœãªããŒãžã¯ãã¹ã¯ããããã€ã¹ä»¥å€ã®å Žæã§ã¯ã¢ã³ããŒãã§ããªãå¿åã¡ã¢ãªã®ããŒãžã§ãã åæå¯èœãªããŒãž-ãã£ã¹ã¯ãšåæã§ããããŒãžãããã³èªã¿åãå°çšã®éããŠãããã¡ã€ã«ã®å Žå-ãã®ãããªããŒãžã¯ã¡ã¢ãªããç°¡åã«æ¶å»ã§ããŸãã ç Žæ£å¯èœãªããŒãžã¯ãåã«ãªããã¢ãŠãã§ããããŒãžã§ãã
è£å ç¡æãªã¹ãã®ãœãŒã¹
ç°¡åã«èšãã°ãã«ãŒãã«ã«ã¯1ã€ã®å€§ããªç©ºããªã¹ããããïŒå®éãããã§ã¯ãããŸããïŒãããã»ã¹ã«çºè¡ã§ããã¡ã¢ãªããŒãžãæ ŒçŽãããŸãã ã«ãŒãã«ã¯ãããã»ã¹ã«ã¡ã¢ãªããã°ããå²ãåœãŠãããã«ããã®ãªã¹ãã®ãµã€ãºããŒã以å€ã®ç¶æ ã«ç¶æããããšããŸãã ãã®ãªã¹ãã«ã¯ãããŒãžãã£ãã·ã¥ãã¹ã¯ãããã«ãŒãã«ã¡ã¢ãªãOOMãã©ãŒã®4ã€ã®ãœãŒã¹ãè¿œå ãããŠããŸãã
ãããã¡ã¢ãªé åãšã³ãŒã«ãã¡ã¢ãªé åãåºå¥ããããããç ç²ã«ããŠäœããã®åœ¢ã§ããªãŒãªã¹ããè£å ããå¿ èŠããããŸãã ããŒãžãã£ãã·ã¥ã¯ãLRU / 2ãã¥ãŒã®ååã«åºã¥ããŠããŸãã ããŒãžã®ã¢ã¯ãã£ããªã¹ãïŒã¢ã¯ãã£ããªã¹ãïŒãšããŒãžã®éã¢ã¯ãã£ããªã¹ãïŒéã¢ã¯ãã£ããªã¹ãïŒãããããããã®éã«ã¯äœããã®æ¥ç¶ããããŸãã 空ããªã¹ãã«ãã¡ã¢ãªå²ãåœãŠã®ãªã¯ãšã¹ããå°çããŸãã ã·ã¹ãã ã¯ããã®ãªã¹ãã®å é ããããŒãžãæäŸããéã¢ã¯ãã£ããªã¹ãã®æ«å°Ÿããã®ããŒãžã¯ãªã¹ãã®æ«å°Ÿã«åé¡ãããŸãã ããŒãžãã£ãã·ã¥ãä»ããŠãã¡ã€ã«ãèªã¿åããšãããããã®ããŒãžã«å°ãªããšã1å以äžã¢ã¯ã»ã¹ããªãå Žåãæ°ããããŒãžã¯åžžã«å é ã«ç§»åããéã¢ã¯ãã£ããªã¹ãã®æåŸã«ç§»åããŸãã ãã®ãããªã¢ããŒã«ãéã¢ã¯ãã£ããªã¹ãã®ã©ããã«ããå ŽåãããŒãžã¯ã¢ã¯ãã£ããªã¹ãã®å é ã«çŽæ¥ç§»åãããã®æ«å°Ÿã«åãã£ãŠåãå§ããŸãã ãã®æç¹ã§åã³ã¢ã¯ã»ã¹ããããšãããŒãžã¯åã³ãªã¹ãã®äžçªäžã«çªãæããŸãã ãããã£ãŠãã·ã¹ãã ã¯ãªã¹ãã®ãã©ã³ã¹ããšãããšããŸããæãããããªããŒã¿ã¯åžžã«ã¢ã¯ãã£ããªã¹ãã®ããŒãžãã£ãã·ã¥ã«ããã空ããªã¹ãã¯ãããã®è²»çšã§è£å ãããããšã¯ãããŸããã
ãŸããããã§èå³æ·±ãåäœã«æ³šç®ãã䟡å€ããããŸãïŒç©ºããªã¹ããè£å ããããã®çµæãéã¢ã¯ãã£ããªã¹ãããå°çããŸããããŸã å²ãåœãŠã®ããã«éä¿¡ãããŠããªãããŒãžã¯ãéã¢ã¯ãã£ããªã¹ãïŒãã®å Žåãéã¢ã¯ãã£ããªã¹ãã®å é ïŒã«æ»ãããšãã§ããŸãã
åèšã§ãã¢ã¯ãã£ããã³ãéã¢ã¯ãã£ããã³ãã¢ã¯ãã£ããã¡ã€ã«ãéã¢ã¯ãã£ããã¡ã€ã«ã解é€äžèœã®5ã€ã®ã·ãŒããååŸããŸãã ãã®ãããªãªã¹ãã¯ãåNUMAããŒãããã³åã¡ã¢ãªãŸãŒã³ã«å¯ŸããŠäœæãããŸãã
cgroupã«é¢ããããã€ãã®èšè
cgroupã䜿çšãããšãããã€ãã®ããã»ã¹ãä»»æã®ãã©ã¡ãŒã¿ãŒã«å¶éã§ããŸãã ãã®å Žåãã¡ã¢ãªã«èå³ããããŸããã¹ã¯ãããªãã§ã¡ã¢ãªãå¶éã§ããŸãããã¡ã¢ãªãšã¹ã¯ãããã§ããŸãã ã°ã«ãŒãããšã«ãOut Of Memory Killerãåºå®ã§ããŸãã cgroupsã䜿çšãããšãããŒãžãã£ãã·ã¥ãªã©ïŒ/sys/fs/cgroup/memory/memory.statïŒã䜿çšããŠãå¿åã¡ã¢ãªããã³éå¿åã¡ã¢ãªã®ã³ã³ããã¹ãã§ããã»ã¹ãŸãã¯ããã»ã¹ã°ã«ãŒãã®ã¡ã¢ãªäœ¿çšéã«é¢ããçµ±èšãç°¡åã«ååŸã§ããŸãã ã¡ã¢ãªãéãããŠããcgroupã䜿çšããå ŽåãããŒãžã®åå©çšã«ã¯æ¬¡ã®2ã€ã®ã¿ã€ãããããŸãã
- ã·ã¹ãã å šäœã®ã¡ã¢ãªãæ€çŽ¢ãããšãã®ã°ããŒãã«ãªåå-ã·ã¹ãã ã®ç©ºããªã¹ããè£å ããŸãã
- cgroupã®ããããã§ã¡ã¢ãªã解æŸãããšãã®ã¿ãŒã²ããã®åå©çš-ã¡ã¢ãªãäžè¶³ããŠããå Žåã
æ¬
ããã€ã¹ãšã¡ã¢ãªã䜿çšããLinuxã®åäœã詳ãã調ã¹ããå Žåã¯ã以äžãèªãããšããå§ãããŸãã
- ã·ã¹ãã ããã©ãŒãã³ã¹ïŒãšã³ã¿ãŒãã©ã€ãºããã³ã¯ã©ãŠãã
- Linuxã·ã¹ãã ããã°ã©ãã³ã°ïŒã«ãŒãã«ãââãã³Cã©ã€ãã©ãªãšçŽæ¥å¯Ÿè©±ã
- Linuxã«ãŒãã«éçºïŒç¬¬3çïŒã