5 ms·
This is great! In my case, only reason for choosing Redis over Memcached was persisting to disk. With memcached being multi-threaded compared to Redis being sin
by ara24 7y ago
This is great! In my case, only reason for choosing Redis over Memcached was persisting to disk. With memcached being multi-threaded compared to Redis being single-threaded, I see a big win in simple use-cases for Memcached.
- halukakin 7y agoThe way i understand it, it is not crash safe. It can now persist data in some cases. However redis is crash safe to about 1 second before crash or so, if not even better.
- dallbee 7y agoWith fsync_always it's crash safe for all but the most pathological scenarios.
- TylerE 7y agoHow? It's persisting to a RAM disk. It only properly cleans up when sent a specific shutdown signal.
- dallbee 7y agoSorry fsync_always is a redis setting, not memcached. The fsync is to a real disk. The parent poster's comment about redis being crash safe to 1s is just the default.
- deleted 7y ago[deleted]
- gokhan 7y agoBut it's performance is way worst, almost voiding the case for choosing Redis.
- RhodesianHunter 7y agoI have not found this to be true. I suppose it depends on your use case and deployment.
- tus88 7y agoI do wonder what happens when a process writes to a memory mapped file, but crashes before the page is synced to disk. Does the write disappear?
- antirez 7y agoIf the OS is still alive, everything is ok (but the OS may sync different pages at different times and in any order if you don't fsync specific ranges with special calls). If the whole machine crashes (power issue, kernel panic, ...), what you find on disk can be a mess.
- derefr 7y ago> what you find on disk can be a mess Is this "can be" determined by the backing filesystem? E.g., would you expect to get a clean result from a log-structured or copy-on-write filesystem?
- alexnewman 7y agoI prefer to architect to use redis in an ephemeral way. Redis isn't exactly safe in the same way postgresql was up until very recently on newer linux. The semantics of fsync on Linux have been esoteric and poorly understood in the error cases. I would try to cause fsync to fail in another process, while memcached is shutting down and immediately recover. I wonder if the authors checked this scenario. Redis kindof does the right thing and will eventually put the right thing on disk but why do it?
- coded 7y agoWhat issue caused postgres to not be safe recently?
- alexnewman 7y agoFsync doesn't work the way you think it does https://www.google.com/url?sa=t&source=web&rct=j&url=https://www.percona.com/blog/2019/02/22/postgresql-fsync-failure-fixed-minor-versions-released-feb-14-2019/&ved=2ahUKEwiXsvXnneLkAhUOUt8KHZLeCr8QFjACegQIAhAB&usg=AOvVaw0oSQmeeR3e3YkGDJKnUFui https://www.google.com/url?sa=t&source=web&rct=j&url=https:/... PostgreSQL › wiki › Fsync_Errors Web results Fsync Errors - PostgreSQL wiki LWN.net › Articles PostgreSQL's fsync() surprise [LWN.net]
- anarazel 7y agoNote that that only was an issue in cases the storage system itself was failing (i.e. IO errors were generated). In contrast to protection against power failures etc, which was/is working correctly.
- alexnewman 7y agoUhm the first sentence is accurate. The second is not
- anarazel 7y ago
- chisleu 7y agoSharding is a fairly easy path to scale redis writes out across multiple processes/cores.