clojure-uk

A place for people in the UK, near the UK, visiting the UK, planning to visit the UK or just vaguely interested to randomly chat about things (often vi and emacs, occasionally clojure). More general the #ldnclj
jiriknesl 2021-03-18T04:35:37.004Z

Morning

1
mccraigmccraig 2021-03-18T06:38:38.004500Z

¡morening!

djm 2021-03-18T06:41:30.004700Z

👋

dharrigan 2021-03-18T07:38:45.004900Z

Good Morning!

2021-03-18T09:00:59.005100Z

Morn'

joetague 2021-03-18T09:08:05.006Z

Morning... 🤞 my copy of Software Design for Flexibility arrives this morning. I might need to go buy more coffee grounds to set myself up for reading it

dharrigan 2021-03-18T09:09:11.006400Z

Oooh, would like your review of it when you are ready

alexlynham 2021-03-18T09:14:36.006500Z

morning

mccraigmccraig 2021-03-18T10:32:04.009400Z

oof - so one of our kafka-streams app ran out of capacity this morning - the 60 partitions i'd assigned to the topic a while back (thinking that it would be enough for a long time in the future) are not nearly enough

mccraigmccraig 2021-03-18T10:32:52.010400Z

do any of y'all have any experience with this - is it safe to add partitions to the existing topic, or is it better to create a new topic and migrate everything to there ?

alexlynham 2021-03-18T10:35:54.010500Z

paging @carr0t

danm 2021-03-18T10:36:59.010900Z

New topic, 100%, IMO

dharrigan 2021-03-18T10:37:44.012100Z

not a good idea to add partitions to an existing topic if you want to maintain partition assignment for keys

danm 2021-03-18T10:38:09.012600Z

If you add additional partitions to an existing topic, you lose guarantees about ordering if reprocessing in future or similar, because the message key -> partition algorithm is based on the number of partitions, so changing that means keys will move to different partitions

danm 2021-03-18T10:39:15.014100Z

If you're not going to reprocess old data, and you're all caught up, or you have some other means of ordering/deduping which means you don't care if a given key suddenly changes partition, or you just don't care about processing order in general, then OK

danm 2021-03-18T10:39:21.014400Z

But you want to be really sure about that

mccraigmccraig 2021-03-18T10:40:35.015700Z

we need the ordering guarantees of partitions - otherwise users will see out of order messages, badly ordered lists of conversations and general inconsistency

mccraigmccraig 2021-03-18T10:41:15.016600Z

so it sounds like i should [1] create a new topic, [2] switch routing over to send to new topic, but don't start processing from the new topic [3] drain old topic [4] start processing on new topic

danm 2021-03-18T10:44:45.020200Z

'drain the old topic'? I have to admit I've not used Kafka streams specifically. But in the past when i've wanted to do this my pattern has been [1] Create new topic, [2] Create 'duplicator', which runs through the old topic consuming all messages and writing them to the new topic (per-key order is maintained), [3] When the duplicator has caught up and is basically copying messages as soon as they appear on the old topic, switch off the app, wait for the duplicator to process potentially the last few messages (literally milliseconds, mostly likely), and switch the app back on now pointing at the new topic Streams having state in rocksDB and such may change how viable that is, it might mean it takes a lot longer to start back up on the new topic or whatever

dharrigan 2021-03-18T10:45:31.020600Z

Yes, I've done what Dan has done in the past too

mccraigmccraig 2021-03-18T10:51:36.024Z

that process would work for us... what do you use for duplicating topics ? confluent replicator, or something else ?

dharrigan 2021-03-18T10:57:33.024200Z

I wrote a bit of code in Clojure 🙂

danm 2021-03-18T11:14:38.025100Z

Likewise. It wouldn't surprise me if there was a Confluent tool to do it for you, that comes as part of the paid enterprise package, but at the time we were using the free OSS version

mccraigmccraig 2021-03-18T13:14:38.026Z

thanks @carr0t @dharrigan - all moved over to a new topic with 1440 partitions (vs 60 on the old) and everything is running smoothly again

1
dharrigan 2021-03-18T13:14:53.026200Z

:partywombat:

danm 2021-03-18T13:15:31.026700Z

Is this your own install, or MSK/similar?

mccraigmccraig 2021-03-18T13:15:53.027200Z

it's strimzi on k8s

danm 2021-03-18T13:15:58.027500Z

👍:skin-tone-2:

mccraigmccraig 2021-03-18T13:15:58.027600Z

our own

mccraigmccraig 2021-03-18T13:16:11.027900Z

strimzi has been great

mccraigmccraig 2021-03-18T13:16:53.028200Z

especially the topic management nouns

mccraigmccraig 2021-03-18T18:11:31.029100Z

well that was a "good" bug - an unexpectedly unbounded recursive call in some promise-based code ate the world