Closed HarderWork closed 9 years ago
Please add to the ticket your cache config, i.e. what is $config
when it fails?
Interesting. I'll take a look at this later today, that doesnt sound like it should be happening...
I've also had problems using Redis to Go. I upgraded my plan to "Mini" and it fixed the problem. I also have &timeout=60
appended to my connection string. I can't remember if that was part of the fix or if I left that there accidentally while trying to fix my problems.
You're probably going to find you're having problems with your sessions next. I had to change the cache
session handler.
From https://devcenter.heroku.com/articles/redistogo
Why am I hitting my connection limit with one Dyno? This is often caused by customers using the nano free plan. One connection is used by one worker, but often other connections can be made to Redis. We would recommend upgrading to our lowest plan to see if this solves the issue. Otherwise we would recommend setting a hard limit on your application code.
Upgraded plan to "Mini" solved the 'CacheException'
error! Thanks for pointing me in that direction.
But instead I got random - but frequent - database connection problems on the web.2
dyno. I tried to set the session handler to 'cache'
instead of 'php'
, but I guess thats what @thegallagher is talking about. Any tips and tricks on how to solve that part?
Can you paste examples of the db connection errors?
@HarderWork I think I had this issue too. I ended up having to append &persistent=0
to my database connection string. This made my fixed my problem but I don't think it's the right way to do it.
Setting your session handler to cache
allows your sessions to be shared between the 2 web dynos. This is a separate issue which I ran into when using multiple web dynos.
I probably should have reported all of these issues but I'm usually quiet until I can provide instructions to reproduce or fix a problem.
@josegonzalez It's a basic app-template project, so I'm just running on pages/home. And on web.2
it gets a lot of "Cake is NOT able to connect to the database." I didn't dig deeper at the moment. @thegallagher I'm to incompetent to be quiet :)
@HarderWork Now I know I'm not the only one with these problems I'll be more motivated. I'm curious to know if &persistent=0
fixed your problem?
CacheException:
Solved by upgrading Redis To Go from Nano to Mini ($9/month at the moment). Changing duration
and timeout
didn't have any effect.
Cake is NOT able to connect to the database:
Solved by adding &persistent=0
to the DATABASE_URL
The only thing I changed in the app-template was to set 'cache'
instead of 'php'
as the default session handler in core.php. Don't know if it's relevant for this problem though.
Thanks for the help!
I've followed the bible on how to create a new app using composer. I enable redistogo and set environment variables as proposed.
The app gets up and running nicely on heroku when I'm running a single dyno. But when I try to scale the app (heroku ps:scale web=2) I get a lot of Internal Server Errors. Enabling debug mode and I found out that the error message is:
Scaling down to 1 dyno and the problem is gone. Any ideas on how to solve this?
UPDATE: I ran a debug(env('CACHE_URL')); just before the call to Cache::config I get the same result both when it works and when it fails. The connection string looks like this:
I don't know how to debug Cake core when running in Heroku production environment.
Update 2: I've got the error in 2 different projects on 2 different Heroku deployments. I think @josegonzalez can reproduce it on http://pastebin.herokuapp.com/ since I've followed that tutorial.
Update 3: I added