News for hackers. Stuff that matters.
Re:Ask HN: What Technologies to Learn in 2020? by steve_adams_86 on Sunday January 05, 2020 @01:42PM (#21963011)
I inherited a code base that has major issues stemming from the developers not realizing what postgres can do.

It's reliant on Kafka with a bizarrely complex queue system for answering questions from users automatically in a distributed, scalable fashion. It has schema-less messages shooting around referencing database rows and tables with zero certainty that anything will exist when the message arrives. It works, but it's a real mess and it breaks remarkably easily.

There's nothing about it that couldn't have been done more easily and perfectly scalably enough with a single database. The product will probably never be large enough to need something like Kafka.

I really, really agree with you. Better database knowledge would have put us weeks ahead on this project already, and it's still very early.

Re:Ask HN: What Technologies to Learn in 2020? by alimw on Monday January 06, 2020 @07:30AM (#21968611)
This is exactly what I'd expect of something called Kafka.
Re:Ask HN: What Technologies to Learn in 2020? by throw51319 on Monday January 06, 2020 @04:14PM (#21973384)
Isn't the DB completely separate from solving this problem? Why was Kafka used?
Re:Ask HN: What Technologies to Learn in 2020? by steve_adams_86 on Wednesday January 08, 2020 @01:42AM (#21988952)
My thinking here is that had the original devs had a better grasp on redis and postgres, they never would have tried using Kafka in the first place. I can't imagine the problem ever requiring the throughput of Kafka, and there would likely be several other scaling issues in the way of utilizing Kafka to its full potential anyway.

I'm pretty sure a redis-based queue like Bull (https://github.com/OptimalBits/bull) would have sufficed for queuing message responses directly on the server (or multiple instances of the server), and while Kafka works fine for long term storage of logs, our use case for the data makes it so it would be far better stored directly in postgres.

Postgres is apparently also a decent pub/sub solution, though I'm not sure if it's superior to Kafka in this case.

The worst part is that the alternative architecture using a redis queue and postgres for message history is very simple, easy to maintain, benefits from the ability to normalize data, and is comfortably boring. Kafka is not that. It's a miserable beast sometimes, and it presents hurdles all the time for many of us. It's good at what it does and people should consider it (or Pulsar) if their problem requires a high throughput message broker. For everyone else, it's a really risky investment for small or no returns over alternatives. It's the worst decision the developers made in this application by a wide margin.