深入Redis内部-Redis 源码讲解【转】
    Redis 作为 NoSQL 数据库的杰出代表,一直广受关注,其轻量级的敏捷架构,向来有存储中的瑞士军刀之称。下面推荐的一篇文章,从源码的角度讲解了Redis 的整个工作流程,是了解 Redis 流程的绝佳文章。强烈推荐:
原文链接:Redis: under the hood
目录:
- 
Startup
- 
Beginning global server state initialization
 
- 
Setting up command table
 
- 
Loading config file
 
- 
initServer()
- 
Shared objects
 
- 
Event loop
 
- 
Databases
 
- 
TCP socket
 
- 
Server cron
 
- 
Registering connection handler with event loop
 
- 
Opening the AOF
 
 
- 
Back up to?main() 
- 
Restoring data
 
- 
Event loop setup
 
- 
Entering the event loop
 
 
 
- 
Processing a request & returning a response
- 
Handling a new connection
 
- 
Reading a command from a client
 
- 
Executing the command and responding
 
 
- 
Summary
 
- 
Next time — tracing a?SET and?GET
 
Redis 启动流程图:
Redis 命令处理流程图: