Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Curious, why fork in the main thread? Forking traditionally is a pretty heavyweight operation. Perhaps versioning might be more performant?


It 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.


Redis 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.


In Unix blocking means going into IO wait. In this case it's just slow when emulated ("paravirtualiuzed") by Xen.


Pretty 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.


Does "versioning" have a specific meaning in this context?


Like MVCC




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: