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
[#33753] implementation of Redis caching #3615
Conversation
{ | ||
if ((class_exists('Redis')) != true) | ||
{ | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this returns false because Redis doesn't exist then there's no fall backs and you're going to get all kind of PHP Errors I think
Also is there any reason why you don't call the isSupported method here instead of repeating this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just copying what Memcache(d) and @andrewnester did.
Will it return with all kind of PHP Errors if Redis doesn't exist?
Instead of repeating yourself it's better to call isSupported method again. Do you have a suggestion how to improve the code?
Probably. Because when you initialise the class you then have to call isSupported before you do anything because you have no way of knowing what's going on. I'd do the isSupported check in the constructor before getting the connection - throw a RuntimeException if the class doesn't exist - meaning we can do a try/catch there. Then when you get the connection you can assume the class exists and don't need the duplicated check |
please provide your code suggestion and I will aply the improvement. |
changing self::isSupported into static::isSupported since the function is static
using throw will result in an non working Joomla site. using the error message people will still be able to use Joomla and change the config.
don't use Redis is Caching is not enabled in config.
Checked the code on my own hosting environment (CentOS, PHP 5.4, PECL extension for Redis, and ofcourse Redis service running) and it turns out fine. When Redis is installed by default on a clean Linux environment, authentication is disabled. Enabling authentication anyway in the Joomla! configuration (using this patch) gives a warning in the backend. Using a wrong IP or port-number also generates a warning. Tested succesfully. |
@mbabker could you review this one? just because I'm having some trouble to review right now https://twitter.com/hans2103/status/472858924497240065 |
If folks with Redis can try testing this, that's good enough for me. It'd be great if the code style issues could be cleaned up before merge, but we can fix it if need be too. |
Goes into |
@test
|
Yes, 3.4-dev branch would be best because this is a complete new feature. #codecompliance hmm, bummer. We are having too much beer here at jab14 and both @hans2103 as my own laptop here is lacking proper coding styles at this point. Let us know if it is an issue or not. |
I can clean it up and merge it later tonight if it's tested well. |
I succesfully tested it on byte.nl where Redis PECL is installed |
Merged for 3.4 at 5a845d2 |
Hi, It seems to me that this is the most relevant "forum" to seek some help. I have Redis 3.0.3 installed on my VPS and I use Joomla 3.4.5. I tried to test Redis cache with http://tools.pingdom.com/fpt/ (website performance testing). I ran test multiple times. The result was very disappointing. If I selected Redis cache in Joomla config my website loaded in 4-6 seconds. When I turned off Redis cache in Joomla config the website loaded in about 3.5 sec. The site loaded faster without Redis or when I turned Redis off. I opened a thread in Joomla.org but no-one seems to be able to give advice or investigate this issue further. Lets say for them it is easier to recommend another caching system than solve, investigate this issue. I have a managed VPS at knownhost. Im very satisfied with them but as Im not a developer, programer I don't know how to check Redis config or log files. Could anyone help me here please? I cant believe that Redis gives such a poor performance. Something must be wrong. Many thanks |
Hi, When you have such a delay, and you know that Redis is fast, the most logical conclusion is that your Joomla actually has no way to reach Redis with the current settings and hosting. Which settings are you using? |
Thanks for your answer. What you mean by which setting Im using? What settings of mine do you want to know? |
As soon as you enable Redis, there are numerous settings appearing in your Joomla Global Configuration that need to be configured: Redis Server Host, Redis Server Port, Redis Database. What did you enter there? These details need to match the details of your Redis service. You mentioned you "installed" Redis. Do you also mean that you actually configured Redis on your server to run as a service? Is Redis running? If so, you must know the port and database. |
Well...where to start.... As I mentioned earlier I have a managed VPS. The reason to be "managed" that Im just a simple website owner who has a busy website so I had to find a VPS. It is managed because "I don't know things". I don't know how to setup a VPS or install a program on VPS etc... I run 2 commands in WHM. I've also find a guide here: http://www.varunpant.com/posts/how-to-set-up-redis-in-ubuntu-linux There they say the redis.conf file should look similar to this: daemonize yes I checked my redis.conf file and there is not even port setting. Full of text but not much configuration. I have concerns about Redis configuration file but Im unable to attach here. |
The questions you are asking about Redis are actually not related to Joomla at all. The "redis-cli" output shows that your server is not running Redis as a service. You might have a PHP support for Redis clients, but if there is no Redis server available, it is like having PHP MySQL support without having a MySQL database server. Your hosting provider should provide you with Redis as a running service, or otherwise the work they have done now is pointless. If they are missing out on that point entirely, I recommend you switch hoster or hire somebody to setup the hosting for you, because Redis requires a system administrator to be setup. I don't think we can discuss this any further in this GitHub thread, because the issues you are having are not related to Joomla and/or the Redis support in Joomla that is offered here in this Pull Request. It is related to your server actually still not supporting Redis as a service. |
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33753&start=0
In PR #3397 user @andrewnester created the posibility for Redis Caching in Joomla. But it wasn't complete and there where some obsolete files included in the PR.
There for I've created a new pull request.
Credits to @andrewnester for the initial pull request. (forked from memcached)