It works well, but you’ll pay well for it also.
In my last company, it was cheaper to roll our own on AWS, and maintain it, than use MSK.
We ran a “2.5” stretch cluster - 2 AZs, 3 brokers in each AZ, 2 ZKs in each AZ, and a single ZK in a 3rd AZ to maintain quorum if we lost an AZ. It was handling 30 TB or so of data a day (before compression), and our biggest topic was receiving 45MB/s at peak, IIRC.
MSK has some definite limitations - you can only configure a subset of broker properties, you can’t SSH into brokers and do terrible things to logs if needed (rare, but it does become handy at times), etc. I’m unsure if you can set a topic to have a replica count lower than the hard-coded MSK “num.replicas = number of AZs” but I know you can’t change that property on the broker level.
On the cost front, while MSK’s pricing includes inter-broker replication traffic for free, if you’re running it across 3 AZs (the default, other option is 2 AZs, but given how MSK works, if you lose an AZ you’ll lose ZK quorum and your cluster is broken), your applications producing and consuming from it will incur significant inter-AZ traffic costs.
In terms of scaling, MSK can increase your storage size automatically, but once increased, it can’t be decreased. If you need to add another broker, it’s still manual, but it’s just clicking a button or running a single CLI command.
I’m curious what your scaling issues were? We might be able to help you get your current cluster humming over in /r/apachekafka
Some general tips:
- Use rack (AZ) awareness to ensure Kafka is distributing leaders evenly across racks.
- Use rack-aware consuming so that consumers in AZ A can consumer from in-sync replicas (ISRs) in their own AZ to reduce inter-AZ traffic costs.
- Make sure that your `num.replicas` and `min.insync.replicas` are configured so that losing an AZ doesn’t drop your topic partitions below min-ISR - MSK’s defaults generally manage this - unless you’re running a 2-AZ cluster then the default value of minISR (2) will bork you, but as I mentioned earlier, due to ZK quorum requiring a majority of members remaining, losing an AZ will bork you anyway. Also be aware that having minISR = num.replicas can cause temporary issues, as sometimes a replica may be out of sync for a bit under heavy load scenarios. So definitely keep minISR at num.replicas - 1, at least.
- Use Cruise Control to ensure that replicas are distributed across racks/AZs so that rack-aware consumers can be fully utilised. MSK now supports Cruise Control, which is nice.
- You can often avoid having to scale a cluster by tuning your producers, and to a lesser extent, consumers, to minimise load on the cluster. Critical producer properties in this area are `linger.ms`, and `batch.size` - the fewer batches a producer sends to the cluster, the better for cluster load.
- Also, consider using compression to reduce size on disk.
- Make sure your partition counts for topics are actually relevant - partition count generally limits the number of concurrent consumers in one consumer group - a topic with 20 partitions means 20 concurrent consumers in one consumer group. If you have 100 partitions for a topic only consumed by 50 concurrent consumers in a group, you’re increasing overhead on your brokers unnecessarily. It’s always possible to add more partitions later (assuming you’re not relying on absolute ordering based on message key), but removing partitions requires deleting a topic and recreating it - or as I prefer, creating a new topic, migrating producers first, and then consumers to it (consumers can consume multiple topics, which is a nice way to migrate topics), and then dropping an old topic, so as to avoid data loss.
HTH, and as I said, if you have any further questions, come join us at /r/apachekafka, we’ve got members from Aiven, Confluent, Red Hat etc. who can help 