Scrivio Interview library
DesignAdvanced6 min read · updated 13 November 2026

Your company will move 150 services from a self-managed Kafka cluster in its data centre to a managed Kafka service in the cloud, which uses its own IAM-based authentication and private networking.

Design the migration: connectivity, security, data replication, client changes and the cut-over order.

We build private connectivity sized for replication plus client traffic, with bootstrap DNS names we can repoint; map every principal and ACL to the provider's identity model and test client libraries and Spring Boot settings early; replicate topics with MirrorMaker 2 or the provider's tooling using IdentityReplicationPolicy so names stay the same, with configs and translated offsets. Then we cut over flow by flow: consumers first, reading the replicated topics from translated offsets, then producers, so no event lands where its consumers are not. We migrate in waves with rollback plans, freeze topic changes on the old cluster, and retire it once every topic shows no clients.

Why this question is asked

Moving 150 services between Kafka clusters is less a Kafka problem than a coordination problem: every service has its own team, release schedule and configuration, and events flow between them. Interviewers ask this design question to see whether we can plan a migration where nothing is lost, ordering surprises are understood, and each step can be undone. In this answer, we will cover connectivity, security and client changes, data replication, the cut-over order for a single flow and why it is consumers first, and finally how to organise the waves and retire the old cluster.

1Connectivity: Private Links and Repointable Names

During the transition, two kinds of traffic cross between the data centre and the cloud: replication from the old cluster to the new one, and client traffic from services that have moved to one side while their partners are on the other. We size the private links, such as a dedicated interconnect or VPN, for both at peak. If the old cluster takes 80 MB/s in and replication adds the same again, plus clients reading across, we may need well over 200 MB/s of reliable capacity, with headroom for catching up after a pause.

We also stop putting broker host names in service configuration. Each environment gets a bootstrap DNS name, such as kafka-orders.internal, that we can repoint. Then moving a service is a configuration change, and rolling back is a DNS or config change too.

2Security and Client Changes

The managed service uses the provider's identity model, IAM roles or service accounts, rather than our SASL/SCRAM users or mTLS certificates. We export every principal and ACL from the old cluster and map each one to an identity and policy in the new model, ideally generated from code so nothing is missed. A service that read orders and wrote shipments must get exactly those permissions.

Clients may need a different SASL mechanism, often OAUTHBEARER, or the provider's own authentication library on the classpath. That affects every Java service, so we test it early: pick two representative services, one on an old Spring Boot version and one current, and make them connect, produce and consume against the new cluster. Old client versions that cannot use the new mechanism must be upgraded before their wave, which can be the longest part of the plan.

Java
# Spring Boot settings for an IAM-style OAUTHBEARER login (class names depend on the provider library)
spring:
kafka:
bootstrap-servers: kafka-orders.internal:9098
security:
protocol: SASL_SSL
properties:
sasl.mechanism: OAUTHBEARER
sasl.jaas.config: org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required;
sasl.login.callback.handler.class: <provider's login callback handler>

3Replicating the Data

We replicate with MirrorMaker 2, or the provider's migration tooling if it offers something equivalent. For a one-way move we use IdentityReplicationPolicy, which keeps topic names unchanged, so orders stays orders rather than becoming dc.orders, and services do not need new topic names. MirrorMaker 2 also syncs topic configurations and, through its checkpoint connector, translates consumer group offsets into the target's offsets.

We watch replication lag per topic, because a cut-over waits until lag is near zero. We also check the provider's limits early: partitions per cluster, message size and the configs we may set. If the old cluster has 40,000 partitions and the service allows 10,000 per cluster, we either clean up first or split across clusters, and that must be known before the first wave.

4Cut-Over Order for One Flow: Consumers First

Consider one flow: the order service produces to orders, and billing and shipping consume it. If we moved the producer first, new events would land in the new cluster while the consumers still read the old one, and they would miss them, unless we replicate backwards as well. So we move the consumers first. They stop on the old cluster, start on the new one from the translated offsets, and read the replicated topic, which is still being fed from the old cluster by MirrorMaker 2. Nothing is missed, and the consumers now work against the new cluster.

Then we move the producer. Once it writes directly to the new cluster, MirrorMaker 2 is stopped for that topic. At the switch there is a brief window where the last replicated records and the first direct records can interleave for the same key, and offset translation is approximate, so consumers may see a few records twice. Idempotent consumers, which recognise an event id they have already applied, absorb both.

Step throughMoving one flow: consumers first, then producers
ProducerOld clusterMirrorMaker 2New clusterConsumers
produce orders
read orders
write orders, same name
step 1: consume from translated offsets
step 2: producer repointed by DNS
step 3: stop mirroring this topic
keep consuming; dedupe the overlap

7 messages in order. Play them, or step through them one at a time.

Consumers always read where new events arrive, so no event lands where nobody reads it.

5Waves, Rollback and Retiring the Old Cluster

We group the 150 services into waves along flows, starting with a low-risk flow owned by a willing team, so the runbook is tested before the critical flows move. Each wave has a rollback plan: since consumers moved first, rolling back a wave means pointing them back at the old cluster from offsets translated the other way, which needs a reverse replication flow for that wave's topics or a short dual-run.

While the migration runs, we freeze topic changes on the old cluster, so the replicated configurations do not drift. A topic is finished only when it shows no producers and no consumers on the old cluster for an agreed period, for example two weeks, which we check from broker request metrics and consumer group listings. Only then do we stop its replication and delete it, and the old cluster is retired when its last topic is gone.

6Follow-up questions

Why not move producers and consumers of a flow at the same time?

Because 150 services cannot be released at exactly the same moment, and a partial switch would split events between clusters. Moving consumers first makes each step safe on its own: until the producer moves, MirrorMaker 2 keeps the new cluster complete, so the consumers can move days before the producer.

What about Kafka Streams applications?

They are both consumers and producers, with internal topics. The usual approach is to move the application once its input topics are replicated, let it rebuild its state stores on the new cluster from those inputs, and treat its output topics as a producer switch for downstream consumers. Its internal changelog and repartition topics are excluded from replication, since the new instance creates its own.

7Conclusion

In this answer, we designed a migration of 150 services to managed Kafka. Private links are sized for replication and cross-environment client traffic, and repointable DNS names make moves and rollbacks configuration changes. Principals and ACLs are mapped to the provider's identity model, and client libraries are tested early. MirrorMaker 2 with IdentityReplicationPolicy keeps topic names and translates offsets. Each flow moves consumers first and producers second, with idempotent consumers absorbing the short overlap. Waves with rollback plans, a freeze on topic changes and a no-client period before deletion complete the move.

What to say in the interviewAbout 80 seconds aloud

Open with

I would plan it in five parts. Connectivity first: private links between the data centre and the cloud sized for replication plus client traffic during the transition, and bootstrap DNS names I can repoint, so moving a service or rolling back is a config change.

Then, if they want more

Security: export every principal and ACL and map them to the provider's IAM roles or service accounts, and test early that our client versions and Spring Boot configs work with the new SASL mechanism or provider library, because old clients may need upgrading.

Data: replicate with MirrorMaker 2 or the provider's tooling using IdentityReplicationPolicy so topic names stay the same, sync configs, translate consumer offsets, watch lag, and check provider limits like partitions per cluster. Cut-over order per flow: move consumers first, reading the replicated topics from translated offsets, then move producers, so no event lands where its consumers are not.

At the switch per-key order can briefly interleave and there may be duplicates, so consumers must be idempotent. Finally, migrate in waves with rollback plans, freeze topic changes on the old cluster meanwhile, and delete each old topic only after it shows no clients for an agreed period, then retire the cluster.

About this answer

Last updated
13 November 2026
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 "Design the migration: connectivity, security, data replication, client changes and the...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-operations/7f18aa8830/