# A week of alternatives, and the migration I did not make

> Our MemoryDB clusters run Redis 7, and on AWS that line has nowhere left to go - 7.2 and above are Valkey only. A week of pricing the alternatives against a socket fan-out and a job queue, and the answer was to stay.

- Author: Deyan Peev (https://deyanpeev.com)
- Published: 2024-12-10
- Tags: Redis, Valkey, AWS, BullMQ, WebSockets, Databases, Migration
- URL: https://deyanpeev.com/posts/a-week-of-alternatives

We run Amazon MemoryDB on Redis 7. In October AWS added Valkey to both
ElastiCache and MemoryDB, and after that it was fairly clear where things were
heading. Redis OSS on AWS tops out in the 7.x line, and 7.2 and above are Valkey.
Whatever Redis ships next isn't arriving on the service we're on.

Nothing breaks this quarter because of it. But it's the sort of thing you
either look at now, with time, or look at in a hurry later, so we spent a week
on it. We changed nothing in the end. I still think the week was worth it, and
this is what it bought.

# Two things that sit on Redis

Only two things depend on it, and the evaluation was really just about those.

The socket layer, first. The platform pushes live updates to browsers, and
the instances serving those sockets are behind a load balancer, so a message
raised on one instance has to reach clients connected to another. That fan-out
is Redis pub/sub. If it stops, the product visibly stops updating.

The other is [BullMQ](https://deyanpeev.com/posts/bullmq-and-the-mongo-queue-i-did-not-use), which I
have written about choosing. It's the queue behind Stripe webhook
reconciliation, seat recalculations and invoice generation. What it relies on is
quite specific: blocking list operations, sorted sets for delayed and retried
jobs, and a substantial amount of Lua running server-side to make its state
transitions atomic.

For both of them Redis is part of what makes them correct (it is not a cache we
could lose), and that decided more of the week than any price did.

# The three options

**Stay on MemoryDB for Redis 7.** Costs nothing today. It accepts that the
version line is terminal and that the decision comes back later, on someone
else's schedule.

**MemoryDB for Valkey.** The forward path within the service we already use.
Priced 30 per cent below MemoryDB for Redis OSS, and data written isn't charged
up to 10 TB a month, with anything above that at a rate well below the Redis
equivalent. Our write volume is queue traffic and socket fan-out, no bulk data,
so for us that second part matters more than the headline percentage.

**Redis's own managed offering.** Redis Enterprise Cloud runs on AWS and can be
bought through the Marketplace on the consolidated bill, under the collaboration
agreement the two companies have had since 2022. Here you follow the software
and leave the AWS-native service behind. You stay with the people writing Redis.

# Mostly compatibility, very little price

Very little of the week went on price. That surprised me, though in hindsight
it shouldn't have.

The saving from Valkey is real, but it's a percentage of a bill that isn't one
of our larger ones. A 30 per cent reduction on a line item nowhere near the top
of the invoice is nice to have, and it doesn't justify a risky migration by
itself. That took about a morning to establish. After that, price was only ever
going to be a tie-breaker, and there was no tie.

Most of the week went on compatibility, and specifically on the Lua. Valkey at
this point is Redis 7.2.4 with a different name, so on paper everything BullMQ
does is supported. But BullMQ's guarantees come from scripts that assume precise
semantics for how commands behave under concurrency, and "the command exists" is
a much weaker statement than "the command behaves identically under contention".
To establish the stronger one you have to run the queue under real load against
the new engine and watch for the failure modes that only show up when two
workers race. You can't get that from reading the docs.

The socket layer was easier to convince ourselves about. Pub/sub is old, simple,
and identical across both. It's also where a subtle failure would be most
visible to customers though, becuase it doesn't error, it just stops delivering.

The Redis Cloud option came apart too, on operational grounds and not technical
ones. Moving there means leaving an AWS-native service, so our own VPC and
networking work, a different support relationship, a different monitoring
story, and a vendor relationship somebody has to own. All doable. The problem we
had didn't justify any of it.

# Why we stayed

Because what was forcing a decision wasn't urgent, and everything on offer was
a change to the datastore underneath a queue and a live socket fan-out.

We'd be taking real risk, the kind that surfaces under production concurrency,
weeks after a migration, in code whose correctness depends on server-side script
semantics. In exchange we would get a percentage of a moderate bill and the
feeling of being ahead of a deprecation that hasn't been scheduled against us
yet. Not a good trade.

# What the week actually produced

No migration, and three things I wouldn't have had otherwise.

We know what we depend on. There's now a written list of which Redis behaviours
the platform relies on, feature by feature, and where each one is used. It took
a day to make, and it is the input to this decision whenever it comes back.

We also know what the migration looks like. The actual sequence, including the
tedious bit, which is proving the queue's script semantics under load and not
just assuming them. When there is a reason to do it we won't be starting from a
blank page.

And we know what would change our minds: a security fix we can't get, a client
library dropping support for the version we're on, or a published
end-of-support date with a quarter attached to it. A week to decide to do
nothing does sound like a week wasted, I know. But those triggers are written
down now.
