3 ms·
Curious, why fork in the main thread? Forking traditionally is a pretty heavyweight operation. Perhaps versioning might be more performant?
by toddh 12y ago
Curious, why fork in the main thread? Forking traditionally is a pretty heavyweight operation. Perhaps versioning might be more performant?
- scott_karana 12y agoDoes "versioning" have a specific meaning in this context?
- toddh 12y agoLike MVCC
- pja 12y agoIt looks like redis is using fork to generate checkpoints of the database. Which is quite a neat hack - use the copy-on-write memory properties of modern unix fork() implementations to implement persistent checkpoints of database state. It does mean that forking the entire process is pretty much the point of the exercise however.
- eldavido 12y agoRedis uses a reactive architecture using non-blocking I/O. They fork to get a point-in-time consistent snapshot that can be written to disk. The problem is that fork blocks, and while blocked, it stalls the event loop, subjecting incoming requests to stalls.
- xxs 12y agoPretty much this: doing blocking operations in your poller thread is a big no, even if it appears clever. Btw, I am not sure one can call "reactive architecture" if using a single thread.
- fulafel 12y agoIn Unix blocking means going into IO wait. In this case it's just slow when emulated ("paravirtualiuzed") by Xen.