Skip to content

rotor: Enhance Redis support #1185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

dmeremyanin
Copy link
Contributor

@dmeremyanin dmeremyanin commented Mar 9, 2025

Overview

This PR introduces key enhancements to Redis support:

  1. Redis Sentinel support - automatic failover and HA for Redis instances.
  2. Redis can now be used as the exclusive persistent storage solution, replacing MongoDB.
  3. Metrics tracking for Redis storage.

No breaking changes introduced - it supports smooth migration from Redis to MongoDB for users who still wish to use MongoDB.

Motivation

Our workload has shown that Redis outperforms MongoDB significantly in terms of resource efficiency. Specifically, MongoDB was consuming nearly 1 CPU core per replica and 750MB of memory at just ~250 requests per second, which we believe is excessive for such a simple use case as K/V storage.

Although Jitsu's documentation states that Redis is deprecated in favor of MongoDB, I believe this decision should be reconsidered. Based on our internal performance tests, Redis offers a more efficient solution than MongoDB for our workload. Redis' resource usage is far more optimal, making it a more suitable choice in scenarios with high-performance demands.

Supporting both MongoDB and Redis would provide greater flexibility, allowing users to choose the best storage solution for their needs. For users who don't require features like identity stitching and prefer Redis for its speed and resource efficiency, this approach would also result in more cost-effective Jitsu deployments.

*
* Example `REDIS_URL` and `REDIS_SENTINEL_ADDRESS` values for Redis Sentinel:
* - Redis URL: `redis://username:password@/3?name=mymaster`
* - Redis Sentinel Address: `sentinel1:26379,sentinel2:26379,sentinel3:26379`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A separate REDIS_SENTINEL_ADDRESS env variable is required because ioredis doesn't support configuring Redis Sentinel directly through the connection URL. Redis Sentinel requires a list of sentinel addresses to be passed separately.

@dmeremyanin dmeremyanin force-pushed the redis-persistent-store branch from f4662f6 to d3e689f Compare March 9, 2025 09:21
1. Added Redis Sentinel support
2. Redis can now be used as the sole persistent storage for functions
3. Integrated metrics tracking
@dmeremyanin dmeremyanin force-pushed the redis-persistent-store branch from d3e689f to 665af35 Compare March 9, 2025 18:02
@absorbb absorbb merged commit 652d4eb into jitsucom:newjitsu Mar 10, 2025
1 of 4 checks passed
@absorbb
Copy link
Contributor

absorbb commented Mar 10, 2025

@dmeremyanin
Thank you. Especially for the performance data

@absorbb
Copy link
Contributor

absorbb commented Mar 10, 2025

also beta image is ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants