{人面不知何去处 桃花依旧笑春风}

redis的几个问题

Posted in Uncategorized by interma on 2013/03/13

没事读了一下hunangz的《redis设计与实现》
http://www.redisbook.com/en/latest/

写的很好,文档格式还特别好看,列几个有意思的点。

1,sds,Simple Dynamic String,要解决什么问题?
http://www.redisbook.com/en/latest/internal-datastruct/sds.html#redis

2,dictht/哈希表的结构
http://www.redisbook.com/en/latest/internal-datastruct/dict.html#id5
有个图,一看就懂~

3,rehash为什么要渐进进行?它的实现过程。
http://www.redisbook.com/en/latest/internal-datastruct/dict.html#id18
补充说明一下,python中的dict resize时就不是渐进的,set/insert item时有可能要调整。

4,rehash时的多线程竞争?
redis单线程。。。

5,温习skiplist
http://www.redisbook.com/en/latest/internal-datastruct/skiplist.html

6,ziplist的目的?以及实现
http://www.redisbook.com/en/latest/compress-datastruct/ziplist.html

7,redis的key为什么要加上类型?
http://www.redisbook.com/en/latest/datatype/object.html

8,亲切的小整数池
http://www.redisbook.com/en/latest/datatype/object.html#id3

9,redis的事务保证ACID了吗?
http://www.redisbook.com/en/latest/feature/transaction.html#acid
其中的I有可能影响并发能力。
温习一下ACID:
from http://en.wikipedia.org/wiki/ACID#Atomicity
-Atomicity requires that each transaction is “all or nothing”: if one part of the transaction fails, the entire transaction fails, and the database state is left unchanged.
原子性:全做/全不做
-The consistency property ensures that any transaction will bring the database from one valid state to another.
一致性:有效状态间迁移,不会跳到无效态(很久之前的有效态也算数)
-The isolation property ensures that the concurrent execution of transactions results in a system state that would be obtained if transactions were executed serially, i.e. one after the other.
隔离性:等效于某种顺序执行
-Durability means that once a transaction has been committed, it will remain so, even in the event of power loss, crashes, or errors.
持久性:一旦提交,全力保障永久有效。

10,lua脚本的安全性考虑
http://www.redisbook.com/en/latest/feature/scripting.html#id2

Tagged with: ,