News for hackers. Stuff that matters.
Re:Waltz: A Distributed Write-Ahead Log by neuland on Monday September 09, 2019 @06:36PM (#20923243)
Looks like this also uses Zookeeper. Does anyone know of a simple streaming log system / database? Like, SQLite3 for streaming? I'm using this for personal projects more and more, and the solutions I see in this space are always big, distributed and hard to setup and keep running.

I've been using a simple file format that just writes each message out sequentially in a simple format like: [event-id][event-type][event-size][event-bytes]. And there's a small TCP server that speaks Redis protocol to support remote access. But it's not really production code, rather something I hacked together over a couple weeks in the evening.

Re:Waltz: A Distributed Write-Ahead Log by Xorlev on Monday September 09, 2019 @09:33PM (#20924360)
https://github.com/xorlev/slogd

This is a project of mine I use for some side projects for exactly that reason: I want streaming logs & pubsub semantics. It's basically Kafka xtra-lite. It doesn't have a super simple TCP protocol (though I wouldn't say no to a PR adding one!), it's dual-available over gRPC and HTTP (JSON API).

Disclaimer: It's definitely one of my low-activity side projects and subject to change at any time.

Re:Waltz: A Distributed Write-Ahead Log by manigandham on Monday September 09, 2019 @07:16PM (#20923563)
If you're already using the Redis protocol then Redis v5 has Streams as a first-class data structure.

It's fast, has consumer groups (like Kafka), and also supports individual message acknowledgement.

Re:Waltz: A Distributed Write-Ahead Log by atombender on Tuesday September 10, 2019 @12:42AM (#20925091)
Is Redis Streams backed by disk? How does it perform when the size of the stream exceeds available RAM?

Also, what's Redis' multi-node failover/high availability story these days (with streams)? Last I heard, it wasn't that great [1], but it's been a while.

[1] https://aphyr.com/posts/283-jepsen-redis

Re:Waltz: A Distributed Write-Ahead Log by manigandham on Tuesday September 10, 2019 @04:33PM (#20933370)
Redis is an in-memory data store that has different options for persistence (snapshots + oplog) but it's not designed to persist every operation immediately. All data structures are covered including Streams.

Redis keeps the entire working set in RAM so it'll start dropping writes or freeze if you run out of memory. This is where the simplicity and speed comes from and is a fundamental limitation.

There's a simple replica system that works well but failover switching is the problem and requires a separate process or running the Redis Sentinel. There's also Redis Cluster but that just shards the keyspace and doesn't offer any scalability with a single key or stream, and is still hard to manage with the same failover issues.

The OP asked for a single-node option so I suggested Redis, if you need a serious messaging cluster then I recommend Kafka or Pulsar instead.

Re:Waltz: A Distributed Write-Ahead Log by atombender on Tuesday September 10, 2019 @05:08PM (#20933763)
Thanks. That confirms pretty much the picture I had in my head of how Redis works these days.

It's frustrating that there's no obvious middle ground this and Kafka and Pulsar, both of which are memory-hungry JVM apps with multiple external dependencies. Both require ZooKeeper; Pulsar also requires BookKeeper. None of these components are operationally simple.

I'm a fan of NATS itself, but NATS Streaming's clustering design leaves a lot to be desired. In particular, it punts on failover/HA, asking you to instead run an SQL database or shared file system that provides this. (An obvious low-maintenance option here would be CockroachDB, but NATS doesn't support it.)

Re:Waltz: A Distributed Write-Ahead Log by manigandham on Tuesday September 10, 2019 @07:32PM (#20935016)
There are other options. RabbitMQ [1] is the usual although clustering has always been fragile.

If you dont care about open-source then there are plenty of other options like AMPS [2] or Solace [3]. The latter has a free edition.

1. https://www.rabbitmq.com/

2. http://www.crankuptheamps.com/

3. https://solace.com/

Re:Waltz: A Distributed Write-Ahead Log by atombender on Tuesday September 10, 2019 @07:47PM (#20935141)
I wouldn't put RabbitMQ in this category — it is a classical message broker, not a log. Once you've consumed a message, it's gone, unless you have set it up so ACKed messages are funneled into another queue, but that stuff is finicky and doesn't patch over the fact that underneath it's designed for mutable, ephemeral queues. In particular, you can't peek back into the queue to find older items. You have zero visibility into the contents of the queuem, and you certainly can't treat it as a dependable database.

And, as you say, fragile. I've run RMQ in production for years and I would be very happy if I could throw it out. It's the least well-behaved component in any stack I've used it in. Even Elasticsearch (shudder) is better at not losing data. Not just the clustering, either. Even for a persistent queue, RMQ will start to chug RAM for any message that is delivered but not yet ACKed, for example, making it dangerous for apps that want to batch large groups of messages for efficiency. (It seems to me that it was not designed for that at all, but for one-by-one consumption, which is of course much slower.)

I'm looking for a mature distributed log that is clustered and lightweight. Kafka except, say, written in Go.

Re:Waltz: A Distributed Write-Ahead Log by manigandham on Wednesday September 11, 2019 @03:19AM (#20937402)
Try out Solace then. It's fast and supports HA for the free edition with throughput limits.
Re:Waltz: A Distributed Write-Ahead Log by zcw100 on Monday September 09, 2019 @06:38PM (#20923262)
Re:Waltz: A Distributed Write-Ahead Log by manigandham on Monday September 09, 2019 @07:14PM (#20923549)
Note that NATS on it's own is just a pub/sub system and doesn't have any queuing or persistence. There is no "log". You need the NATS Streaming server for that which implements persistence while communicating over NATS.
Re:Waltz: A Distributed Write-Ahead Log by afrodc_ on Monday September 09, 2019 @07:34PM (#20923686)
I was looking into https://github.com/liftbridge-io/liftbridge. I believe he was a maintainer of NATS streaming and wanted to make something lightweight and Kafka-esque.
Re:Waltz: A Distributed Write-Ahead Log by corford on Monday September 09, 2019 @08:37PM (#20924068)
Liftbridge looks cool but right now you need use their protobuf defs and cook your own client lib if you want bindings outside of go.
Re:Waltz: A Distributed Write-Ahead Log by manigandham on Monday September 09, 2019 @08:50PM (#20924122)
Liftbridge is an experiment and has no real production users. NATS Streaming is already fine for lightweight single-host usage. If you really need to scale to multiple servers then I recommend skipping NATS Streaming and going straight to Kafka or Apache Pulsar.
Re:Waltz: A Distributed Write-Ahead Log by dmix on Tuesday September 10, 2019 @01:59AM (#20925435)
Have any more lighter-weight recommendations that fit the queuing and persistence category?
Re:Waltz: A Distributed Write-Ahead Log by manigandham on Tuesday September 10, 2019 @07:37PM (#20935060)
RabbitMQ is another option. Clustering is fragile, but it's fine if you just need a single-node: https://www.rabbitmq.com/

There are also proprietary systems like Solace: https://solace.com/

Other than that, there are embedded queuing/log libraries or you can just dump the messages into a key/value store or write them out to a file yourself.

Re:Waltz: A Distributed Write-Ahead Log by graetzer on Tuesday September 10, 2019 @09:14AM (#20927748)
Maybe the pub-sub pattern of https://zeromq.org/ could work for that
Re:Waltz: A Distributed Write-Ahead Log by james-mcelwain on Tuesday September 10, 2019 @08:24AM (#20927396)
Kafka is moving towards eliminating the ZK dependency, while will make it easier to run as a single node if you don't care about HA.
Re:Waltz: A Distributed Write-Ahead Log by orthecreedence on Tuesday September 10, 2019 @04:13PM (#20933144)
Hey, is there a tracker somewhere for this? I've always been into trying Kafka, but I heard horror stories about ZK so having it removed would be nice.
Re:Waltz: A Distributed Write-Ahead Log by elvinyung on Monday September 09, 2019 @06:47PM (#20923347)
Just curious, have you looked into Redis streams?
Re:Waltz: A Distributed Write-Ahead Log by corford on Monday September 09, 2019 @08:38PM (#20924071)
Redis streams?