redis / node-redis

Redis Node.js client
https://redis.js.org/
MIT License
16.86k stars 1.87k forks source link

ioredis vs node-redis #2658

Open chasemcdo opened 9 months ago

chasemcdo commented 9 months ago

Description

I've been working with Redis for a couple projects, more specifically with Redis Sentinel. I had originally been using the this package, but found it was lacking support for Sentinel. As such we migrated to ioredis in search of this support.

I am wondering why both packages exist and if there is any documentation on how someone might decide between the two if they are both supported?

chayim commented 9 months ago

@chasemcdo We're actually in progress, adding Sentinel support to node-redis right now. We recommend node-redis, as it's on track for being the most full fledged client for nodejs, including support for new Redis capabilities like JSON, Search, and others. Similarly, RESP3 support is almost ready as well.

chasemcdo commented 9 months ago

@chasemcdo We're actually in progress, adding Sentinel support to node-redis right now. We recommend node-redis, as it's on track for being the most full fledged client for nodejs, including support for new Redis capabilities like JSON, Search, and others. Similarly, RESP3 support is almost ready as well.

@chayim does that mean ioredis will be deprecated soon? My main confusion is in why they both exist and seem to be supported. The ioredis docs contain migration guides to go from node-redis to ioredis which imply that ioredis might be the way to go.

Is Sentinel Support something that’ll be coming soon or not for a while given the issue for it was opened back in 2012 #302 ?

sfxdoluwasegun commented 9 months ago

@chasemcdo Would be helpful if a tentative timeframe for release is shared, would help us better manage our anticipation. Thanks for the good work!

stondini commented 8 months ago

Hello,

Choosing the correct NodeJS Redis library is not obvious as:

@chasemcdo's question about ioredis deprecation is relevant.

ehaynes99 commented 6 months ago

To answer the "why both exist" question, ioredis was created as an alternative client 9 years ago by an individual: https://github.com/luin

According to his profile page:

I created ioredis, one of the most popular clients for Redis. It was acquired by Redis Ltd. in 2023.

On Jun 15, 2023, this commit was added that changed the links to reflect the new owner: https://github.com/redis/ioredis/commit/9c175502b53b400a31bd8bddc8e9a469856bc820

So at this point, it looks weird that both are owned by https://github.com/redis and both "supported". However, since then, only one commit has been made to remove sponsor links and such from the README, so it's effectively unmaintained now.

For a long time, it had more functionality than this library (including sentinel support). However, over time there was an increasing amount of functionality with no direct support, and those had to be hand-rolled using raw commands. e.g. JSON commands. This is especially painful with TypeScript, and I've seen/worked on custom wrappers for this in multiple projects.

This project is now a monorepo that's written in TypeScript and includes direct support for more of the modern features: https://github.com/redis/node-redis/tree/master/packages

I'm not involved with either project, just a long time user, so I can only speculate as to the deprecation strategy, but once this supports sentinel (sounds like soon: https://github.com/redis/node-redis/issues/302#issuecomment-1930456228), I don't know of any other reason to continue using it.