Quick revision
The short answer
Clients and brokers agree on protocol versions with an ApiVersions request, so a newer broker serves an older client only within the version range it still supports, and Kafka 4.0 removed very old protocol versions (KIP-896), so clients older than roughly 2.1 can no longer connect. We find them from broker request metrics broken down by API version and from the client software name and version that clients report (KIP-511), joined with client ids and principals to find owners, remembering that many non-Java clients depend on their bundled librdkafka. Then we upgrade clients first against a 4.x staging cluster, block known-bad versions, and roll the brokers while watching for connection failures and UNSUPPORTED_VERSION errors.
What to remember
In this answer, we saw that clients and brokers negotiate versions with ApiVersions, that Kafka 4.0 removed very old protocol versions so the oldest clients, roughly before 2.1, can no longer connect, and how to find them with per-version request metrics, the deprecated-request metric and the client software name and version from KIP-511, joined with client ids and principals. Non-Java clients are judged by their bundled librdkafka or native implementation. Clients are upgraded and tested first, bad versions are blocked, and brokers are rolled while watching for UNSUPPORTED_VERSION errors.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Clients and brokers agree on protocol versions with an ApiVersions request, so a newer broker serves an older client only within the version range it still supports, and Kafka 4.0 removed very old protocol versions (KIP-896), so clients older than roughly 2.1 can no longer connect. We find them from broker request metrics broken down by API version and from the client software name and version that clients report (KIP-511), joined with client ids and principals to find owners, remembering that many non-Java clients depend on their bundled librdkafka. Then we upgrade clients first against a 4.x staging cluster, block known-bad versions, and roll the brokers while watching for connection failures and UNSUPPORTED_VERSION errors.
Why this question is asked
Kafka's compatibility story used to be simple: newer brokers talked to any old client. Kafka 4.0 ended that for very old clients, and on a cluster with 300 applications, some built years ago by teams that no longer exist, a broker upgrade can break production services that nobody remembers. Interviewers ask this to see whether we understand how version negotiation works and whether we can turn that into an inventory and a safe plan. In this answer, we will recap how clients and brokers negotiate versions, see what 4.0 removed, find the affected clients with metrics, handle non-Java clients, and then plan the upgrade.
1A Quick Recap: How Versions Are Negotiated
Every Kafka request type, such as Produce, Fetch or Metadata, has its own version number, and each new feature adds a version. When a client connects, it first sends an ApiVersions request, and the broker answers with the range of versions it supports for every request type. The client then uses, for each request type, the highest version that both sides support.
This is why mixing client and broker versions usually just works: a new client uses older request versions with an old broker, and an old client uses its older versions with a new broker. It works as long as the broker still supports the old versions, and that is exactly what 4.0 changed.
2What Kafka 4.0 Removed
Kafka 4.0 dropped old protocol versions that had been deprecated for a long time (KIP-896), along with the old message formats v0 and v1. The practical result is a new baseline: 4.0 brokers support clients from about version 2.1 onwards, and older clients that only speak the removed versions fail to connect or get UNSUPPORTED_VERSION errors. The exact versions removed per request type are listed in the KIP and the upgrade notes, so check them rather than relying on a single cutoff.
There are related changes to remember in the same upgrade. Kafka 4.0 runs only in KRaft mode, so a cluster still using ZooKeeper must migrate to KRaft on a 3.x bridge release first. And the 4.x Java client needs Java 11 or later, which matters for applications that later upgrade their client library.
3Finding the Clients That Would Break
Brokers can tell us who speaks which versions. Request metrics are broken down by request type and version, so we can see whether anything still uses old versions. Kafka 3.x brokers also added a metric aimed at this upgrade, counting requests that use versions 4.0 removes, labelled with the client software name and version (DeprecatedRequestsPerSec; check that your 3.x release has it). Since KIP-511, clients report their software name and version in ApiVersions, and brokers expose connection counts by those labels.
| Application | Library and version | Uses removed versions? | Action |
|---|---|---|---|
| billing-sync | Java client 1.1.0 | Yes | Upgrade to a 3.x or 4.x client |
| fraud-scorer | Go, wraps librdkafka 2.3 | No | None |
| legacy-etl | Python, librdkafka 0.11.6 | Yes | Upgrade library, retest |
| web-events | Node.js, pure JS library | Check | Test against 4.x staging |
| unknown (10.4.7.21) | No software name | Yes | Find owner from network logs |
Metrics tell us which software versions exist, but not who owns them. For that we join with identities: the client.id clients send, the authenticated principal (each application should have its own SASL user or certificate), and the source IP addresses from connection logs. The result is an inventory table of application, owner, language, library and version, and whether it is safe for 4.x. Clients that are too old to report a software name at all are suspicious by definition.
4Non-Java Clients Need Their Own Check
Many Go, Python, .NET and Node.js clients are wrappers around librdkafka, a C library, so what they support depends on the librdkafka version they bundle, not on the wrapper's own version number. A Python service pinned to an old confluent-kafka package may carry a librdkafka that is years old. Other clients are written natively in their language and implement the protocol themselves, each with its own support matrix. So for each non-Java client we record both the wrapper and the protocol implementation underneath, and we test it rather than trust the documentation.
5Running the Upgrade Without Outages
Clients go first. We give owners the inventory, a deadline and a 4.x staging cluster to test against, ideally with a contract test that produces and consumes through every API they use, including transactions or the admin client. Meanwhile we block new deployments of known-bad library versions in the build pipeline, so the list does not grow. We track the deprecated-request metric until it reaches zero across all brokers for a full business cycle, including monthly batch jobs.
Then we roll the brokers one at a time, waiting for under-replicated partitions to return to zero after each. We watch connection failures, authentication errors and UNSUPPORTED_VERSION errors in broker logs and client dashboards, and stop if anything appears. Only after all brokers run the new version and the cluster is stable do we finalise the new metadata version with kafka-features.sh, because that step is the one that cannot be easily undone.
6Follow-up questions
Can a 4.x Java client talk to old 3.x brokers?
Yes, within limits: the 4.x Java client also dropped support for very old brokers, so it needs brokers from about 2.1 onwards. Version negotiation handles the rest by choosing the highest common version. So upgrading clients before brokers is safe for any reasonably current cluster.
What if one critical application cannot be upgraded before the deadline?
Options include running it against a separate small 3.x cluster fed by MirrorMaker 2 for a limited time, or delaying the broker upgrade for the clusters it uses. Either way, the exception gets an owner and an end date, because supported 3.x releases will not last forever.
7Conclusion
In this answer, we saw that clients and brokers negotiate versions with ApiVersions, that Kafka 4.0 removed very old protocol versions so the oldest clients, roughly before 2.1, can no longer connect, and how to find them with per-version request metrics, the deprecated-request metric and the client software name and version from KIP-511, joined with client ids and principals. Non-Java clients are judged by their bundled librdkafka or native implementation. Clients are upgraded and tested first, bad versions are blocked, and brokers are rolled while watching for UNSUPPORTED_VERSION errors.
Open with
First, how compatibility works. When a client connects it sends ApiVersions, the broker answers with the version range it supports for each request type, and they use the highest common version.
Then, if they want more
That's why mixed versions usually work. But Kafka 4.0 removed very old protocol versions, from KIP-896, so roughly anything older than a 2.1 client can't talk to a 4.x broker anymore. Also 4.0 is KRaft-only, so ZooKeeper clusters must migrate first. To find the affected clients, I would use the brokers.
Request metrics are broken down by API version, and recent 3.x brokers have a metric for requests that use versions 4.0 removes, labelled with client software name and version, which clients report since KIP-511. I would join that with client ids, the authenticated principals and source IPs to get an inventory with owners.
For Go, Python, Node and .NET, I check the librdkafka version they bundle or the native library's support, not just the wrapper's version. Then clients go first: owners get a deadline and a 4.x staging cluster to test against, and the build pipeline blocks known-bad library versions.
When the deprecated-request metric has been zero for a full business cycle, including monthly jobs, I roll the brokers one by one, watching for connection failures and UNSUPPORTED_VERSION errors, and only finalise the metadata version at the end, since that's the step that's hard to undo.
About this answer
- Last updated
- 13 November 2026
- Versions it names
- Kafka 4.0, Java 11
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Kafka documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "How do you find which clients would break against 4.x brokers and run the upgrade...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-internals/6e15cbf277/