Skip to content
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

question: Redis crash does not crash main application, is it possible? #124

Open
rppimenta opened this issue Jan 2, 2025 · 6 comments
Open

Comments

@rppimenta
Copy link

Hi everyone

I'm including Rails Performance in the project I'm working on. The initial configurations are ok. But I'd like to configure it in a way that if something fails in Rails Performance (a failure with Redis, for example) my application won't crash.

In some tests I did, with a small EC2 for Redis, I ran out of memory and my application ended up crashing.

Is there a way to configure this? Or would I have to make a change to the code?

Thanks

@igorkasyanchuk
Copy link
Owner

Hi,
Hmm, so the application crashes after you have no memory in the Redis?

A fix is needed, in the place where the app writes to Redis - wrap it with a begin/rescue block for a specific exception.

@igorkasyanchuk
Copy link
Owner

also, I suggest to reduce the duration for caching, I don't know how small is your instance and what traffic you have

for me, I leave default 4.hours and it's enough to cover app with 4gb RAM on server and 60 rpm.

@rppimenta
Copy link
Author

That's it, the application crashes.

I was looking at the Rails Performance code to identify where I would need to get involved with rescue.

I believe that Redis was very undersized in our first test, so I wouldn't want the application to crash if there is a problem with Rails Performance Redis, until we identify the correct machine size.

The project runs on a cluster, which can have up to 40 web pods and 30 API pods, so there is a lot of data recorded.

@igorkasyanchuk
Copy link
Owner

Check this

def self.save_to_redis(key, value, expire = RailsPerformance.duration.to_i)

Try to fork and use your work and test how it works for you

@rppimenta
Copy link
Author

Thanks,

I'll try it out

@rppimenta
Copy link
Author

Thanks

it's worked

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

No branches or pull requests

2 participants