ç§ã話ãã®ã¯ãRedisã§ã®æååã®ä¿åæ¹æ³ãæååã®ä¿åã«äœ¿çšãããå éšæ§é ãRedisãå éšã§äœ¿çšããæé©åã®çš®é¡ã§ãã 倧ããªæ§é äœãå¹æçã«æ ŒçŽããæ¹æ³ãšããããã«åºã¥ããŠæ§ç¯ãããæååãŸãã¯æ§é äœã䜿çšãã䟡å€ããªãç¶æ³ã ã©ã€ã³ã¯Redisã®éèŠãªæ§é ã§ãããHSET / ZSET / LISTã¯ãããã®ããŒã¹ã«åºã¥ããŠæ§ç¯ãããå éšæ§é ãè¡šãå°ããªãªãŒããŒããããè¿œå ãããŸãã ãã®èšäºãå¿ èŠãªçç±-redisã¿ã°ã®stackoverflowã1幎以äžèªãã§ç©æ¥µçã«å¯Ÿå¿ããŠããŸãã ãã®éãéçºè ãRAMãæäœããRedisã®æ©èœãšé«éåã®ããã«æ¯æãå¿ èŠããããã®ãç解ããŠããªããšããäºå®ã«é¢é£ããŠãåžžã«ããŸããŸãªè³ªåã絶ãéãªãæµããŠããŸãã
å®éã«äœ¿çšãããã¡ã¢ãªéã®è³ªåã«å¯Ÿããçãã¯ããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ãã³ã³ãã€ã©ãããã»ã¹ã®ã¿ã€ãã䜿çšãããã¢ãã±ãŒã¿ïŒredisã§ã¯ãããã©ã«ãã§ã¯jemallocïŒã«ãã£ãŠç°ãªããŸãã centos 7ãå®è¡ããŠãã64ããããµãŒããŒã§ã¢ã»ã³ãã«ãããredis 3.0.5ã®ãã¹ãŠã®èšç®ãè¡ããŸãã
ããã§ã¯ãC / C ++ãæžããŠããªã人ããŸãã¯ãã¹ãŠãäœã¬ãã«ã§ã©ã®ããã«æ©èœãããã«ã€ããŠããŸã詳ãããªã人ã«ã¯ãããã§å°ãéå¥ãå¿ èŠã ãšæãããŸãã èšç®ãç解ããããããããã«ãããã€ãã®æŠå¿µãéåžžã«åçŽåããŸãããã C / C ++ããã°ã©ã ã§æ§é äœã宣èšãããã®äžã«ç¬Šå·ãªãæŽæ°ãã£ãŒã«ãïŒ4ãã€ãã®ç¬Šå·ä»ãæŽæ°ãªãïŒãããå Žåãã³ã³ãã€ã©ãŒã¯ãã®ãµã€ãºãå®éã®RAMã§8ãã€ãã«æ éã«èª¿æŽããŸãïŒx64ã¢ãŒããã¯ãã£ãŒã®å ŽåïŒã ãã®èšäºã§ã¯ãã¡ã¢ãªã¢ãã±ãŒã¿ã«ã€ããŠå®æçã«èª¬æããŸããããã¯ãã¡ã¢ãªããã¹ããŒãã«ãå²ãåœãŠãçš®é¡ã§ãã ããšãã°ãjemallocã¯ãå²ãåœãŠããããã©ã°ã¡ã³ãã®ã¢ã©ã€ã¡ã³ãã«äŸåããŠãã¡ã¢ãªã®æ°ãããããã¯ã®æ€çŽ¢é床ãæé©åããããšããŸãã jemallosã®ã¡ã¢ãªå²ãåœãŠãšã¢ã©ã€ã³ã¡ã³ãæŠç¥ã«ã€ããŠã¯ååã«èª¬æãããŠããŸãããéžæãããã©ã°ã¡ã³ãã®ãµã€ãºã¯æãè¿ã次æ°2ã«äžžãããããšããåçŽåã䜿çšããå¿ èŠããããšæããŸããããªããããå°ãã¯ã£ããããããšãé¡ã£ãŠããŸãã ãããã¯ãã€ã³ã¿ãŒããªã¿ãŒèšèªã§ã¯ãè«ççã«å¿é ããã¹ãã§ã¯ãªãããšã§ãããããã§ã¯ãããã«æ³šæãåãããããé¡ãããŸãã
Salvatore SanfilippoïŒå¥åantirezïŒã«ããèè ã«ããã©ã€ã³ã®æŠå¿µãšå®è£ ã¯ãSDSïŒSimple Dynamic Stringã github.com / antirez / sds ïŒãšåŒã°ããå€§æ ¹ãããžã§ã¯ãã®1ã€ã«ãããŸãã
+--------+-------------------------------+-----------+ | Header | Binary safe C alike string... | Null term | +--------+-------------------------------+-----------+ | `-> Pointer returned to the user.
ããã¯åçŽãª `c`æ§é ã§ããããã®èŠåºãã«ã¯ãçŸåšå²ãåœãŠãããŠããã¡ã¢ãªã®çŸåšã®ãµã€ãºãšç©ºãé åãè¡èªäœãããã³å€§æ ¹èªäœãè¿œå ããå¿ é ã®çµäºãŒããæ ŒçŽãããŸãã sdsè¡ã§ã¯ãããããŒã®ã³ã¹ããããããŒã®ãµã€ãºãå€æŽããæŠç¥ãããã³ã¡ã¢ãªãå²ãåœãŠãéã«æ§é ãæŽåããããã«ãã£ã«æãé¢å¿ããããŸãã
2015幎7æ4æ¥ã ã©ã€ã³ã®æé©åã§é·ã話ãçµãããŸãããããã¯å€§æ ¹3.1ã«åé¡ãããã¯ãã§ãã ãã®æé©åã«ãããã©ã€ã³ããããŒã®ã¡ã¢ãªãå€§å¹ ã«ç¯çŽãããŸãïŒåæãã¹ãã§16ïŒ ãã200ïŒ ïŒã å€§æ ¹ã®æ倧è¡é·ã®512MBã®å¶éãåé€ããŸãã ããã¯ãã¹ãŠãæååã®é·ããå€æŽãããšãã«ããããŒã®é·ããåçã«å€æŽãããããã«å¯èœã«ãªããŸãã ãããã£ãŠãããããŒã¯ãæ倧256ãã€ãã®æååã§ã¯3ãã€ãã65 kbæªæºã®æååã§ã¯5ãã€ããæ倧512 mbã®æååã§ã¯9ãã€ãããµã€ãºãuint64_tïŒ64ãããã«é©åããæååã§ã¯17ãã€ãïŒã®ã¿ãå æããŸã笊å·ãªãæŽæ°ïŒã ãšããã§ããã®å€æŽã«ãããå®éã®ãã¡ãŒã ã¯çŽ19.3ïŒ ã®ã¡ã¢ãªïŒã42 GBïŒãç¯çŽããŸãã ãã ããææ°ã®ããããŒ3.0.xã§ã¯ã8ãã€ã+ 1ãã€ãããæåŸã®ãŒããŸã§ãã¹ãŠãã·ã³ãã«ã§ãã æååãæååãã«å¿ èŠãªã¡ã¢ãªéãæšå®ããŠã¿ãŸãããïŒ16ïŒããããŒïŒ+ 7ïŒæååã®é·ãïŒ+ 1ïŒæ«å°Ÿã®ãŒãïŒ= 24ãã€ãïŒã³ã³ãã€ã©ãŒã¯2ã€ã®ç¬Šå·ãªãintã調æŽãããããããããŒããšã«16ãã€ãïŒã ãã®éãjemallocã¯32ãã€ããå²ãåœãŠãŸãã ãšãããããããçç¥ããŸãããïŒçç±ãåŸã§æããã«ãªãããšãæã¿ãŸãïŒã
æååã®ãµã€ãºãå€æŽãããšã©ããªããŸããïŒ è¡ã®ãµã€ãºã倧ãããããã§ã«ååãªã¡ã¢ãªãå²ãåœãŠãããŠããªãå Žåãå€§æ ¹ã¯å®æ°SDS_MAX_PREALLOCïŒsds.hã§å®çŸ©ããã1,048,576ãã€ãïŒã§æ°ããé·ãããã§ãã¯ããŸãã æ°ããé·ãããã®å€ããå°ããå Žåãã¡ã¢ãªã¯èŠæ±ãããéã®2åã«å²ãåœãŠãããŸãã æååã®é·ãããã§ã«SDS_MAX_PREALLOCãè¶ ããŠããå Žåããã®å®æ°ã®å€ã¯æ°ããèŠæ±ãããé·ãã«è¿œå ãããŸãã ãã®æ©èœã¯ããããããããã䜿çšãããšã¡ã¢ãªãæ¶ããããšãã話ã§éèŠã«ãªããŸãã ãšããã§ãããããããã«ã¡ã¢ãªãå²ãåœãŠãå Žåãsetbitã³ãã³ãã®å®è£ ã®ç¹æ§ã«ãããèŠæ±ãããéã®2åãåžžã«å²ãåœãŠãããŸãïŒbitops.cã®setbitCommandãåç §ïŒã
ããã§ãã©ã€ã³ãRAMã§32ãã€ããå æãããšèšãããšãã§ããŸãïŒã¢ã©ã€ã³ã¡ã³ããèæ ®ããŠïŒã hashedin.com ïŒ redisã¡ã¢ãªæé©åã¬ã€ã ïŒããé£äžã®ãã³ããèªãã 人ã¯ã100ãã€ãæªæºã®æååã䜿çšããªãããšã匷ããå§ãããããšãæãåºããããããŸããã ãset foo barãã³ãã³ãã䜿çšããå Žåãªã©ãçãæååãä¿åããã«ã¯ãã96ãã€ããè²»ãããŸãããã®ãã¡ã®90ãã€ãã¯ãªãŒããŒãããã§ãïŒ64ããããã·ã³äžïŒã 圌ãã¯cã§ããïŒ æ¬¡ã«èããŠã¿ãŸãããã
å€§æ ¹ã®ãã¹ãŠã®å€ã¯redisObjectåã®æ§é äœã«ä¿åãããŸãã ããã«ãããå€§æ ¹ã¯å€ã®ã¿ã€ãããã®å éšè¡šçŸïŒå€§æ ¹ã§ã¯ããããšã³ã³ãŒããšåŒã³ãŸãïŒãLRUã®ããŒã¿ãå€ã®å€ãåç §ãããªããžã§ã¯ãã®æ°ãããã³å€èªäœãç¥ãããšãã§ããŸãã
+------+----------+-----+----------+-------------------------+ | Type | Encoding | LRU | RefCount | Pointer to data (ptr*) | +------+----------+-----+----------+-------------------------+
å°ãåŸã«ãã³ã³ãã€ã©ã®ã¢ã©ã€ã¡ã³ããšjemallocæ©èœãèæ ®ããŠãã©ã€ã³ã®ãµã€ãºãèšç®ããŸãã æååã«é¢ããŠã¯ãæååãä¿åããããã«ã©ã®ãšã³ã³ãŒãã£ã³ã°ã䜿çšãããŠããããç¥ãããšãéåžžã«éèŠã§ãã çŸåšãå€§æ ¹ã¯3ã€ã®ç°ãªãã¹ãã¬ãŒãžæŠç¥ã䜿çšããŠããŸãã
- REDIS_ENCODING_INTã¯éåžžã«åçŽã§ãã é·ãå€ã«ãã£ã¹ããããå€ãLONG_MIN ã LONG_MAXã®ç¯å²ã«ããå Žåããã®åœ¢åŒã§æååãæ ŒçŽã§ããŸãã ãããã£ãŠãæååãdictãã¯ãã®ãšã³ã³ãŒãã£ã³ã°ã®åœ¢åŒã§æ£ç¢ºã«ä¿åããã1952672100ïŒ0x74636964ïŒãšããçªå·ã«ãªããŸãã REDIS_SHARED_INTEGERSã®ç¯å²ïŒ redis.hã§å®çŸ©ãããããã©ã«ãã§ã¯10000ã«çããïŒã®äºåã«å²ãåœãŠãããç¹å¥ãªå€ã®ç¯å²ã«ã¯ãåããšã³ã³ãŒãã䜿çšãããŸãã ãã®ç¯å²ã®å€ã¯ãå€§æ ¹ã®å§ãŸãã§ããã«åŒ·èª¿è¡šç€ºãããŸãã
- REDIS_ENCODING_EMBSTR㯠ãæ倧39ãã€ãã®æååïŒ object.cã®å®æ°REDIS_ENCODING_EMBSTR_SIZE_LIMITã®å€ïŒã«äœ¿çšãããŸãã ããã¯ãredisObjectãšsdsè¡ãå«ãæ§é äœããã¢ãã±ãŒã¿ã«ãã£ãŠå²ãåœãŠãããåäžã®ã¡ã¢ãªé åã«é 眮ãããããšãæå³ããŸãã ããã念é ã«çœ®ããŠãã¢ã©ã€ã¡ã³ããæ£ããèšç®ã§ããŸãã ãã ããããã¯å€§æ ¹ã®ã¡ã¢ãªãã©ã°ã¡ã³ããŒã·ã§ã³ã®åé¡ãšãã®å¯ŸåŠæ¹æ³ãç解ããäžã§éèŠã§ãã
- REDIS_ENCODING_RAW㯠ãé·ããREDIS_ENCODING_EMBSTR_SIZE_LIMITãè¶ ãããã¹ãŠã®è¡ã«äœ¿çšãããŸãã ãã®å Žåãptr *ã¯ãsdsè¡ã®ããã¡ã¢ãªé åãžã®éåžžã®ãã€ã³ã¿ãŒãæ ŒçŽããŸãã
EMBSTRã¯2012幎ã«ç»å Žããçãè¡ã§äœæ¥ãããšãã«ããã©ãŒãã³ã¹ã60ã70ïŒ åäžããŸããããã¡ã¢ãªãžã®åœ±é¿ãšãã®æçåã«é¢ããæ·±å»ãªç 究ã¯ãŸã ãããŸããã
æååãstringsãã®é·ãã¯ããã7ãã€ãã§ãã ãã®å éšè¡šçŸã®ã¿ã€ãã¯EMBSTRã§ãã ãã®æ¹æ³ã§äœæãããè¡ã¯ã次ã®ããã«ã¡ã¢ãªã«é 眮ãããŸãã
+--------------+--------------+------------+--------+----+ | robj data... | robj->ptr | sds header | string | \0 | +--------------+-----+--------+------------+--------+----+ | ^ +-----------------------+
ããã§ãæååãstringsããæ ŒçŽããããã«å¿ èŠãªRAMã®éãèšç®ããæºåãæŽããŸããã
ïŒ4 + 4ïŒ * + 8ïŒãšã³ã³ãŒãïŒ+ 8ïŒlruïŒ+ 8ïŒrefcountïŒ+ 8ïŒptrïŒ+ 16ïŒsdsããããŒïŒ+ 7ïŒè¡èªäœïŒ+ 1ïŒçµç«¯ãŒãïŒ= 56ãã€ãã
redisObjectã®åãšå€ã¯ãåãæ°åã®äžäœ4ããããšäžäœ4ãããã®ã¿ã䜿çšãããããã¢ã©ã€ã¡ã³ãåŸã®ããã2ã€ã®ãã£ãŒã«ãã¯8ãã€ãã䜿çšããŸãã
錻ã§é転ããŠããªãããšã確èªããŸãããã ãšã³ã³ãŒããšå€ãèŠãŠã¿ãŸãããã è¡ã®ãããã°ã«ããŸãç¥ãããŠããªãã³ãã³ãã1ã€äœ¿çšããŸã-DEBUG SDSLENã ã¡ãªã¿ã«ããã®ã³ãã³ãã¯å ¬åŒããã¥ã¡ã³ãã«ã¯å«ãŸããŠããŸãããã redis 2.6ã§è¿œå ããããããéåžžã«äŸ¿å©ã§ãã
set key strings +OK debug object key +Value at:0x7fa037c35dc0 refcount:1 encoding:embstr serializedlength:8 lru:3802212 lru_seconds_idle:14 debug sdslen key +key_sds_len:3, key_sds_avail:0, val_sds_len:7, val_sds_avail:0
䜿çšããããšã³ã³ãŒãã£ã³ã°ã¯embstrã§ãæååã®é·ãã¯7ãã€ãïŒval_sds_lenïŒã§ãã hashedin.comã®äººãã¡ã話ããŠãã96ãã€ãã¯ã©ãã§ããïŒ ç§ã®ç解ã§ã¯ããããã¯å°ãééã£ãŠããŠããset foo barãã䜿çšããäŸã§ã¯112ãã€ãã®RAMïŒå€ããšã«56ãã€ããããŒããšã«åãéïŒãå¿ èŠã§ããããã®ãã¡106ã¯ãªãŒããŒãããã§ãã
ããå°ãé«ããBITMAPã䜿çšããå Žåã®ã¡ã¢ãªã®ãã§ãŒãã«ã€ããŠã®è©±ãçŽæããŸããã ç§ã話ãããæ©èœã¯ãããã䜿çšããŠããäžéšã®éçºè ã®æ³šæããæŒããŠããŸãã ã¿ããªãèšæ¶ã®æé©åã«é¢ããã³ã³ãµã«ã¿ã³ãã¯ããã§å®æçã«çšŒãã§ããŸãã redis-labsãdatadogãªã©ã ããããããã³ãã€ãã¬ãã«ã®æäœãã³ãã³ããã¡ããªã¯redis 2.2ã§ç»å Žããããã«ãªã¢ã«ã¿ã€ã ã«ãŠã³ã¿ãŒïŒããšãã°Spoolã®èšäº ïŒã®åœã®æ©äººãšããŠäœçœ®ä»ããããã¡ã¢ãªãç¯çŽã§ããŸãã ã¡ã¢ãªãæé©åããããã®å ¬åŒã¬ã€ãã«ã¯ããã®ããŒã¿ãã¡ããªã䜿çšããŠãªã³ã©ã€ã³ã§ä¿åããããšã«é¢ããåºåã¹ããŒã¬ã³ããããŸããã1å人ã®ãŠãŒã¶ãŒã«ãšã£ãŠããã®ããŒã¿ã¯RAMãããã12ã¡ã¬ãã€ãããå æããŸãããã 説æã§ã¯ã SETBITãšSETRANGE㯠ãã¡ã¢ãªãå²ãåœãŠããšãã«ãµãŒããŒã©ã°ãçºçããå¯èœæ§ãããããšãèŠåããŸãããéèŠãªããšã¯çç¥ããŠããŸããããBITMAPã䜿çšãã¹ãã§ã¯ãªãå ŽåããŸãã¯ãBITMAPã®ä»£ããã«SETã䜿çšããæ¹ãããå Žåãã»ã¯ã·ã§ã³ãåç §ããŠãã ããã
ã©ã€ã³ãå€§æ ¹ã§ã©ã®ããã«æé·ããããç解ãããšããã®ãããããããèŠãããšãã§ããŸãïŒ
- ã¹ããŒã¹ããŒã¿ã«ã¯äœ¿çšããªãã§ãã ããã
- ãã€ããŒããšå®éã®è² è·ã®é¢ä¿ãç解ãââãŸãïŒäžã®äŸãåç §ïŒã
- ãããããããåãããã€ããã¯ã¹ãèæ ®ããŠãã ããã
äŸãèããŠã¿ãŸãããã æ倧1,000äžäººãç»é²ãããŠããã1,000äžäººç®ã®ãŠãŒã¶ãŒããªã³ã©ã€ã³ã§ãããšããŸãã
setbit online 10000000 1 :0 debug sdslen online +key_sds_len:6, key_sds_avail:0, val_sds_len:1250001, val_sds_avail:1048576
å®éã®ã¡ã¢ãªæ¶è²»éã¯2,298,577ãã€ãã§ã1,250,001ãã€ãããæçšãã§ãã ãŠãŒã¶ãŒã®1人ã®ã¹ãã¬ãŒãžã®ã³ã¹ãã¯çŽ2.3 MBã§ãã SETã䜿çšããå Žåãã64ãã€ãïŒ4ãã€ãã®ãã€ããŒããå«ãïŒãå¿ èŠã«ãªããŸãã ããŒã¿ã®ãŸã°ãããæžãããããããããã30ïŒ ã®ç¯å²ã«åãŸãããã«ãé©åãªéçŽééãéžæããå¿ èŠããããŸãããã®å Žåãå®éã«ãã®ããŒã¿æ§é ã«ã¡ã¢ãªãå¹æçã«äœ¿çšããŸãã ããã¯ãæ°çŸäžäººã®èŠèŽè ãããŠã10,000ã100,000人ããªã³ã©ã€ã³ã§èŠèŽããŠããå Žåãããããããããã®ç®çã§äœ¿çšãããšã¡ã¢ãªã®ãªãŒããŒãããã«ãªãå¯èœæ§ããããšããäºå®ã«åºã¥ããŠããŸãã
æåŸã«ãå€§æ ¹ã®ã©ã€ã³ã®ãµã€ãºå€æŽã¯ãã¡ã¢ãªãããã¯ã®äžå®ã®åå²ãåœãŠã§ãã ã¡ã¢ãªã®æçåã¯ãå€§æ ¹ã®å¥ã®ç¹ç°æ§ã§ãããéçºè ã¯ã»ãšãã©èããŸããã
info memory $222 # Memory used_memory:506920 used_memory_human:495.04K used_memory_rss:7565312 used_memory_peak:2810024 used_memory_peak_human:2.68M used_memory_lua:36864 mem_fragmentation_ratio:14.92 mem_allocator:jemalloc-3.6.0
mem_fragmentation_ratioã¡ããªãã¯ã¯ããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã«ãã£ãŠå²ãåœãŠãããã¡ã¢ãªïŒ used_memory_rss ïŒãšå€§æ ¹ã«ãã£ãŠäœ¿çšãããã¡ã¢ãªïŒ used_memory ïŒã®é¢ä¿ã瀺ããŸãã åæã«ã used_memoryãšused_memory_rssã«ã¯ãããŒã¿èªäœãšãä¿åããã³è¡šç€ºçšã®å éšå€§æ ¹æ§é ã®ä¿åã³ã¹ãã®äž¡æ¹ãæ¢ã«å«ãŸããŠããŸãã å€§æ ¹ã¯RSSïŒResident Set SizeïŒããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã«ãã£ãŠå²ãåœãŠãããã¡ã¢ãªã®éãšèŠãªããŸããã¡ã¢ãªããªãã¬ãŒãã£ã³ã°ã·ã¹ãã èªäœã«ãã£ãŠç©ççã«å²ãåœãŠãããå ŽåããŠãŒã¶ãŒããŒã¿ïŒããã³ãã®å éšãã¬ãŒã³ããŒã·ã§ã³ã®ã³ã¹ãïŒã«å ããŠãæçåã³ã¹ããèæ ®ãããŸãã
mem_fragmentation_ratioãç解ããæ¹æ³ã¯ïŒ å€2.1ã¯ãããŒã¿ã¹ãã¬ãŒãžã«å¿ èŠä»¥äžã«210ïŒ ã®ã¡ã¢ãªã䜿çšããããšã瀺ããŠããŸãã 1æªæºã®å€ã¯ãã¡ã¢ãªãäžè¶³ããŠããããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ãã¹ã¯ããããããšã瀺ããŸãã
å®éã«ã¯ãmem_fragmentation_ratioã®å€ã1ã1.5ã®ç¯å²å€ã«ããå Žåã¯ãäœãåé¡ãããããšãæå³ããŸãã è©ŠããŠãã ããïŒ
- å€§æ ¹ããªããŒãããŸãã åèµ·åããã«ã¢ã¯ãã£ãã«æžã蟌ãå€§æ ¹ãé·ããªãã»ã©ãmem_fragmentation_ratioãé«ããªããŸãã äž»ã«ã¢ãã±ãŒã¿ãŒã®æ©èœãåå ã§ãã ç¹ã«ãused_memoryãšused_memory_peakã«å€§ããªéããããå Žåã«åœ¹ç«ã€ããšãä¿èšŒãããŠããŸãã æåŸã®ã€ã³ãžã±ãŒã¿ã¯ãå€§æ ¹ã€ã³ã¹ã¿ã³ã¹ãèµ·åããŠãããããŸã§ã«å¿ èŠãšããŠããã¡ã¢ãªã®æ倧éã瀺ããŸãã
- ã©ããªçš®é¡ã®ããŒã¿ãšãã©ãã ãã®éãä¿åãããã確èªããŠãã ããã ãããã£ãŠãããŒã¿ãä¿åããã®ã«4 GBã§ååãªå Žåã¯ã32ãããå€§æ ¹ã¢ã»ã³ããªã䜿çšããŸãã å°ãªããšã64ãããã¢ã»ã³ããªã䜿çšããŠããå Žåã¯ãå°ãªããšã32ãããããŒãžã§ã³ã«Dameããããã€ããŠãã ããïŒrdbã¯å€§æ ¹ã®ããããµã€ãºã«äŸåããã32ãããããŒãžã§ã³ã®64ãããã€ã³ã¹ã¿ã³ã¹ã«ãã£ãŠäœæãããrdbãç°¡åã«å®è¡ã§ããŸãïŒã ã»ãŒç¢ºå®ã«ãããã«ããããã©ã°ã¡ã³ããŒã·ã§ã³ïŒããã³äœ¿çšãããã¡ã¢ãªã®éïŒãã7ïŒ ïŒã¢ã©ã€ã¡ã³ãã®ç¯çŽã®ããïŒæžå°ããŸãã
- éããšæ©èœãç解ããŠããå Žåã¯ãã¢ãã±ãŒã¿ãŒãå€æŽããŠã¿ãŠãã ããã å€§æ ¹ã¯ãglibmallocãjemallocïŒ facebookã®ãšã³ãžãã¢ãèããããšãèªãã§ãã ããïŒãtcmallocã§åéã§ããŸãã
ãã©ã°ã¡ã³ããŒã·ã§ã³ã«ã€ããŠè©±ããšããLRUããªã³ã«ããå€§æ ¹ã®è©³çŽ°ããéåžžã®æååããŒãå€æ°ããå Žåã®è¿œå ã®åé¡ãèæ ®ããŸããããããã¯ãã¹ãŠå¥ã®èšäºã«ãŸãšããããŠããŸãã ããªããããã«ã€ããŠæžã䟡å€ããããã©ããããããŠå€§æ ¹ã§äœæ¥ãããšãã«ããªãã«ãšã£ãŠä»ã«éèŠã ãšæãããææ¡ãå ±æããŠããããæè¬ããŸãã
ãŠãŒã¶ãŒpansaã¯ãã¹ã¯ããç¶æ³ã§ã¯ããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ãããã»ã¹ã«RAMã®äžéšãè¿ããåŸãå€§æ ¹ãused_memory_rssã®å€ãåèšç®ããªãããšãæ£ãã芳å¯ããŸãã å€§æ ¹ã¯ãããŒã¿ã«ã¢ã¯ã»ã¹ãããšãã«ãã®å€ããã§ã«åèšç®ããŸãã
ç®æ¬¡ïŒ
- Redisã®å
éšïŒã©ã€ã³
- Redisã®å
éšïŒããã·ã¥ããŒãã«ïŒããŒã1ïŒ
- Redisã®å
éšïŒããã·ã¥ããŒãã«ïŒããŒã2ïŒãšãªã¹ã
åèã®ããã®è¿œå è³æïŒ