Live data from Hacker News

Publishing with Apache Kafka at The New York Times

confluent.io

151–157 of 157 posts

Re: Publishing with Apache Kafka at The New York Times

#151
post #36

> Traditionally, databases have been used as the source of truth ... [but] can be difficult to manage in the long run. First, it’s often tricky to change the schema of a database. Adding and removing fields is not too hard, but more fundamental schema changes can be difficult to organize without downtime. This argument sounds self-contradicting. Kafka doesn't let you change its schema at all! At least postgres gives…

Postgres could in fact be used here by creating an append-only table similar to: id, data (JSON field) However, Postgres doesn't have good support for creating derived append-only logs (=streams) from that table. Kafka has Kafka Streams and KafkaSQL. And producer+consumer APIs that are a good fit for NYTs use case. > Am I missing something? Remember that in addition to schema changes, NYT also wants to avoid row chan…

Pretty much all databases are already a transaction log that gets materialized. Postgres and many other RDBMS take in changes, write to the WAL, then provide tables that are views of the latest data of each row.

If you want total history and the database doesn't support this automatically then you can easily insert news rows instead (like you described) and then just create an SQL view that then shows the latest versions of each row, while also adding views for all kinds of other data access patterns. Companies have been doing this for decades because it's self-contained, fast, and reliable.

Using Kafka and separate processes to do this is deconstructing the RDBMS into separate layers that you now have to manage yourself. Useful if you really have that kind of scale but at 100GB of data, it's just silly. Use kafka as a work queue but leave the database work to actual database software.

Re: Publishing with Apache Kafka at The New York Times

#152

Earlier quoted context omitted.

Had to reparse "throw out ..." a few times before I understood what you saying. Initially I thought you were withdrawing your former endorsement.

I parsed and reparsed just like you and I stalled again, while I imagined the sentence again as "throw up", trying to make a quick fix. OP has picked a tricky one..

Apologies! It's an expression I use commonly, like "let me throw this idea out there..." Now that you bring my attention to it, however, it does seems backwards, and I'm sure it's baffling to non-native speakers. Thanks for the heads-up.

Re: Publishing with Apache Kafka at The New York Times

#153
post #97

Earlier quoted context omitted.

> Through its various protocols Kafka topics can be configured to be guaranteed forwards, backwards, or bi-directionally compatible. Sure but backwards and bi-directional compatibility inhibits the evolvability of schemas. Something as simple as adding a new required field for example is not backward compatible in avro. I understand why this is, and that in a huge database, it's not that simple in SQL either. But in…

Ummm sure about that? Something as simple as adding a new required field and maintaining compatability is the explicit use case for Avro. I personally do this in production... I know LinkedIn does too... Seriously: that would be a show stopper beyond show stoppers, and would make Kafka useless. Backwards and bi-directional compatibility are the specific facilities that enable safe schema evolution. From the docs: "Ba…

> A new required field _with a default value_

In what sense is this field required when you attempt to produce a value using the new schema, and everything is fine if you omit the "required" field?

> And, frankly, if you're thinking about database in the singular form then you're not thinking about an environment that really needs a schema evolution policy

We don't have 100s but certainly 10s of databases. But we use a schema evolution policy because we're attempting to use kafka as the system of record for our event log.

Re: Publishing with Apache Kafka at The New York Times

#154
post #129

Earlier quoted context omitted.

The problem with an RDBMS is that the schema is retroactive -- every time you update the schema, both old and new data must validate against it. There's another approach, which is to also version the schema. Every record is conceptually a pair of [schema, data]. This puts a burden on the application -- every client must be able to understand old schemas -- but the benefits are considerable. The most trivial benefit i…

id uuid ts timestsmp data jsonb solved it for you :) and thats will have ACID and all the other features of RDBMS that kafka does not have. It will also allow you to create transactionally consistent "views" representing whatever you need implemented in a few lines of SQL vs complex standalone services.

Not quite. The JSON overhead can become quite problematic. Not to mention, Postgres's JSON support isn't where I'd like it to be. :(

Re: Publishing with Apache Kafka at The New York Times

#155

Earlier quoted context omitted.

Kafka is not a messaging queue. It's a log. The same underlying structure used within our RDBMS to provide all the guarantees Kafka provides. As for logs and databases, they are duals. https://www.confluent.io/blog/turning-the-database-inside-ou...

>Kafka is not a messaging queue. It's a log. Kafka bills itself as a "messaging system". >The same underlying structure used within our RDBMS to provide all the guarantees Kafka provides. Is there perhaps a reason that people use the RDBMS scaffold atop this "underlying structure"? The point I'm making is that Kafka is not safe for use cases that demand robust data storage and integrity, at least not in comparison to…

Small and friendly correction: Kafka bills itself as "a distributed streaming platform".

Also, a heads up: we'll soon publish a blog post on the subject of "is it ok to (permanently) store data in Apache Kafka".

Re: Publishing with Apache Kafka at The New York Times

#156
post #129

Earlier quoted context omitted.

id uuid ts timestsmp data jsonb solved it for you :) and thats will have ACID and all the other features of RDBMS that kafka does not have. It will also allow you to create transactionally consistent "views" representing whatever you need implemented in a few lines of SQL vs complex standalone services.

Not quite. The JSON overhead can become quite problematic. Not to mention, Postgres's JSON support isn't where I'd like it to be. :(

What features are you missing?
Post reply on HN