Redis源码阅读概述
本小菜鸡准备开始阅读Redis源码了,通过网上查阅各路大神的资料,特总结一下大家推荐的阅读顺序。
顺序
- step1: 基本数据结构,文件为sds.h, sds,c, adlist.h, adlist.c, dict.h, dict.c, redis.h中的zskiplist和zskiplistNode, t_zset.c中的zsl开头的函数, hyperloglog.c中的hllhdr和所有hll开头的函数。
- step2: 内存编码数据结构,文件为intset.h, intset.c, ziplist.h, ziplist.c。
- step3: 数据类型的实现,文件为object.c, t_string.c, t_list.c, t_hash.c, t_set.c, t_zset.c中除zsl开头的函数, hyperloglog.c中所有以pf开头的函数。
- step4: 数据库相关代码,文件为redis.h中的redisDb, db.c, notify.c, rdb.h, rdb.c, aof.c。选读,redis.h中的pubsubPattern和multiState和multiCmd, pubsub.c, multi.c, sort.c, bitops.c。
- step5: 客户端和服务器,ae.c, 所有的ae_*.c, networking.c, redis.h和redis.c中与单机redis有关的部分。选读scripting.c, slowlog.c, monitor.c。
- step6: 多机功能代码,replication.c, sentinel.c, cluster.c。
附上一个大佬的文章,如何阅读Redis源码?