Scrivio Interview library
ScenarioAdvanced6 min read · updated 13 November 2026

A company runs 30 self-managed Redis 6 deployments, some clustered, for caches, sessions and rate limits. It has decided to move them to a managed Valkey service in the same cloud with no downtime that users notice.

Design the migration per workload type, including how you move data under live traffic, validate it and roll back.

We classify the 30 deployments by what losing their data means: pure caches can start empty or warm up while reads move over gradually, while sessions, rate limits and queues need their data moved live or a period of dual writes. Data moves with the provider's online migration where available, or with a key-copying tool such as RIOT or SCAN plus DUMP and RESTORE, followed by a short write freeze or dual writes at cutover. Before moving we check compatibility, we validate with key counts, sampled comparisons and live metrics while traffic shifts per service by flag, and we keep the old deployment in sync until a bake period ends, moving the least critical workloads first.

Why this question is asked

Thirty Redis deployments built over years rarely look alike: some are throwaway caches, some hold sessions users would notice losing, and some are clustered with scripts nobody has read in a while. A migration plan that treats them all the same either takes forever or breaks something important. Interviewers ask this to see whether we can turn a big, risky move into a sequence of small, reversible ones. In this answer, we will classify the workloads, check compatibility, look at the ways to move data under live traffic, then cover cutover, validation, rollback and ordering.

1Classify the Workloads First

The single most useful question for each deployment is: what happens if the new one starts empty? For a pure cache, the answer is a burst of misses and a slower few minutes, which is acceptable if the warm-up is gradual. For sessions, users are logged out. For rate limits, counters reset, which is usually tolerable for a few seconds but not if they enforce paid quotas. For queues or anything used as primary storage, data is lost, which is never acceptable.

So we put each of the 30 deployments in one of these groups, along with its size, write rate, whether it is clustered, and which services use it. That inventory decides the method for each.

Migration method by workload
WorkloadIf it starts emptyMethod
Pure cacheMisses for a few minutesStart empty, shift reads gradually, or warm first
SessionsUsers logged outLive copy or dual writes, then cut over
Rate limitsCounters reset brieflyDual writes or accept a short reset
Queues, primary dataData lostLive replication, short write freeze at cutover

2Check Compatibility Before Moving Anything

Valkey is compatible with Redis 6 at the protocol and command level, but a managed service adds its own restrictions. For each deployment we list the commands actually used with INFO commandstats, and compare them with the service's restricted commands; CONFIG and KEYS are the usual casualties. We list any modules in use, since a managed Valkey may not offer them, and every Lua script, since a script may call a restricted command or touch keys that are not declared in KEYS, which matters in cluster mode.

We also check the connection settings: cluster mode versus non-cluster mode must match the client configuration; TLS is often mandatory on managed services; AUTH may become ACL users or cloud identity; and clients in cluster mode need topology refresh enabled, in Lettuce through ClusterTopologyRefreshOptions, so they follow the provider's failovers and maintenance.

3Moving Data Under Live Traffic

There are three ways to move data, from most to least convenient. Some providers offer an online migration that makes the managed instance replicate from the self-managed source, then promotes it at cutover. Where that is available and supports our source version and topology, it is the simplest. Otherwise we copy keys with a tool such as RIOT, which can do a snapshot copy followed by live replication using keyspace notifications, or with our own job that walks the source with SCAN and copies each key with DUMP and RESTORE, keeping its TTL.

Text
SCAN 0 MATCH sess:* COUNT 1000 -- 1) "48213" (next cursor) 2) up to ~1000 keys
DUMP sess:9f2c -- "\x0e\x01..." serialized value
PTTL sess:9f2c -- (integer) 1712000: remaining TTL in ms
-- on the target:
RESTORE sess:9f2c 1712000 "<dump>" REPLACE -- OK, same value and TTL

A plain copy is a snapshot: keys written after the job read them are missed. So for workloads that cannot lose writes, the copy is followed by one of two cutover methods. A brief write freeze stops writers for seconds, lets the last changes copy across, and switches. Dual writes make the application write to both old and new for a period, while reads stay on the old one until the new one is verified. Note that DUMP payloads are version-specific; copying from Redis 6 into Valkey works because Valkey reads older formats, but check this for your exact versions.

4Cutover and Validation, Service by Service

We switch each service through a configuration flag that picks the Redis endpoint, so one service at a time, or even a percentage of instances, moves to the new endpoint without a deploy. Caches move by shifting reads gradually so the new instance warms without a cold-start stampede on the database behind it.

Validation uses numbers. We compare key counts per pattern between old and new, compare a random sample of a few thousand keys value by value with their TTLs, and watch latency, error rates, hit rates and connection counts on the services that have moved. Any difference stops the rollout for that deployment.

Step throughOne deployment's move
  1. Inventory and compatibility checkcommandstats, scripts, modules, TLS, ACL
  2. Copy or replicate dataOnline migration, RIOT, or SCAN + DUMP/RESTORE
  3. Dual writes or write freezeFor data that cannot be lost
  4. Shift traffic by flagPer service, then all instances
  5. Counts and samples match?Plus latency and errors
    YesBake period with old kept in syncNoFlip flag back, investigate
  6. Retire the old deploymentAfter the bake period

6 steps in order. Play them, or step through them one at a time.

5Rollback and Ordering

Rollback is only real if the old deployment is still current. During the bake period, often one to two weeks, we keep it in sync, either through continued dual writes or by copying changes from new back to old, so that flipping the flag back loses nothing. Once the bake period ends cleanly, we stop syncing and decommission.

Finally, we order the 30 moves from least to most critical: a few internal caches first to prove tooling and runbooks, then customer-facing caches, then rate limits, then sessions and anything durable. Each early move teaches us something cheap; by the time we reach the session store, the procedure has been run many times.

6Follow-up questions

What do you do with a Lua script that relies on a command the managed service does not allow?

First find out why it uses that command; often it is CONFIG or KEYS used for convenience, and the script can be rewritten without it, for example by passing the needed keys in KEYS instead of looking them up. If the logic truly needs it, move that part into the application, with the atomicity provided another way, such as WATCH with MULTI and EXEC or a redesign of the data structure. We test the rewritten script against the managed service in staging before the migration, not during it.

Why not migrate all 30 in one weekend?

Because one unexpected incompatibility would then hit every workload at once, and the team would be debugging 30 things during the riskiest window. Small moves with a working rollback limit the blast radius of each mistake.

How do you migrate a clustered deployment into a non-clustered service or the reverse?

Key-level copying works across topologies, but the clients and scripts must change: multi-key commands and scripts need all keys in one slot in cluster mode, which may require hash tags in key names. That is a code change, so it is planned and tested before the data move.

7Conclusion

In this answer, we saw that a no-downtime move of 30 deployments starts by classifying each workload by what happens if it starts empty. We check compatibility with commandstats, scripts, modules and connection settings, move data with online migration, RIOT or SCAN with DUMP and RESTORE, and protect writes with a brief freeze or dual writes. Traffic shifts per service by flag while counts, samples and metrics are compared, the old deployment stays in sync through a bake period for rollback, and the moves go from least to most critical.

What to say in the interviewAbout 80 seconds aloud

Open with

I would start by classifying the 30 deployments by what happens if the new one starts empty. Pure caches can start empty or be warmed while reads move over gradually.

Then, if they want more

Sessions, rate limits and queues need their data moved, or a period of dual writes. Before anything moves, I would check compatibility per deployment: INFO commandstats for the commands in use against the provider's restrictions, modules, Lua scripts, cluster versus non-cluster mode, TLS, AUTH and ACL changes, and client settings like topology refresh.

For the data, I would use the provider's online migration if it replicates from our source, otherwise a tool like RIOT or a SCAN plus DUMP and RESTORE job that keeps TTLs, and then cut over with a short write freeze or dual writes.

Each service switches through a configuration flag, so I can move one service or a share of instances at a time. I validate with key counts per pattern, sampled value comparisons and latency and error rates. The old deployment stays in sync until a defined bake period ends, so rollback is just flipping the flag back.

And I would order the moves from the least critical caches to the sessions, so the procedure is well practised by then.

About this answer

Last updated
13 November 2026
Versions it names
Redis 6
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
Redis 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 per workload type, including how you move data under live traffic...": https://scrivio-interview-library.netlify.app/databases/redis-internals/74db3a42ca/