Closed josephglanville closed 11 years ago
Won't merge this for now. I'm talking to Joseph about the usefulness of a Redis backend.
@aflatter would like to know your thoughts on a Redis backend too
@tarcieri Some quick thoughts: I personally would prefer a single implementation for persisting logs. I'm not sure how useful it is to store them in a database requiring a separate daemon. Just logging to files means less setup cost and not having yet another layer of adapters means less maintenance.
@aflatter seems good, thanks for the explanation (not a fan of Redis for this use case either ;)
Agreed, as I explained to @aflatter via email I intended to use Redis as an example implementation because I wasn't up to speed on how Celluloid works with blocking IO. I have since implemented a Kyotocabinet backend (could just as easily use LevelDB, MDB or BDB..) that is both faster and simpler.
FYI, in the Redis-specific case, there's Celluloid::Redis which uses Celluloid::IO (and is therefore nonblocking):
https://github.com/celluloid/celluloid-redis
That's not to say Redis is a good idea here, though ;)
Hehe yeah, this was implemented using Celluloid::Redis because at the time I thought I would need libraries written with the Celluloid::IO framework to prevent blocking of the other actors while the log_replicator is writing entries to disk. Atleast what I have observed is this IO seems to be happening in a separate thread... is this a safe assumption or have I miss-understood what Celluloid does for me here and I still need a way of doing non-blocking IO on the log file?
@josephglanville blocking I/O is okay, but if Celluloid::IO is used then actors can continue to receive messages while they're in the middle of I/O operations. For Redis this is mostly useful with PUB/SUB sockets since they can block indefinitely (see also: BRPOP(LPUSH))
This implements an initial pass at a persistent log in Redis.
It also adds another example script which uses this new log backend and an initial set of specs to describe the Floss::Log class.