9

I'm working with Magento 1.9.0.1, and every now and again our Redis servers which host the Magento cache, (AWS ElastiCache) will go down. When this happens, Magento fatally errors until Redis is available again.

This might be a difficult question to answer quickly, but what I'm wondering is why can't Magento act like the cache is disabled when it can't connect to Redis, instead of fatally erring?

I'm not aware of any setting or any module that gives Magento this ability, but on the surface it doesn't seem difficult. Magento uses local.xml to figure out how to connect to the database, and the cache backends. It then connects to the database and looks at the cache options to know whether or not to use the cache. If told by the database to use a given cache, it switches some flag (probably a global variable or the property of a singleton,) and uses the cache backend for the rest of the request. Couldn't Magento be made to turn this back off during that request if a connection error occurs?

A slow site is better than a fatal error.

Edit: Evidently some people don't understand what I'm asking or didn't actually read this post.

  1. Is there a module that will give Magento the ability to function without fatal error when Redis is unavailable, when Redis is being used as the primary cache storage method.

  2. If not, could someone enlighten me on why this isn't possible or is very difficult?

3
  • This is a perfectly good question. I have faced the same issue and have the same question. Why cant magento realise that Redis server is not working and switch over to the traditional magento cache instead of fatally throwing up an error.
    – Vinu D
    Aug 17, 2015 at 9:46
  • 1
    @Tyler V, voting to re-open, do not see how this is unclear or off topic seems like an interesting problem and a valid question. I do not know of a module which solves this problem, it may not be something Magento does easily out of the box and would require a module developed for this. I guess you would need to research how the cache is called in Magento to before developing the module.
    – Holly
    Sep 10, 2015 at 14:35
  • The simplest solution would be a cron that pings Redis and if there is no answer, swaps local.xml with a variant that uses file caching. Jun 17, 2016 at 21:11

1 Answer 1

2

All you have to do just fix 3 issues/problems:

  1. Why redis fails? Heavy traffic, error, memory issues, networking?
  2. Timeouts and retries settings for connection?
  3. Your stack is up to date?

Obviously you can change some code and place your logic instead of error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.