NinjaRSS Syndicator Substantially Slows Down Joomla Websites

One of the things that Joomla sites must have (by default), and currently don’t, is RSS syndication. RSS syndication allows your content to be syndicated across the web, which means better exposure, which in turn means more traffic. We have no idea why Joomla doesn’t have this as a built-in functionality, and we’re almost sure that it won’t have this in the foreseeable future, simply because RSS, as a syndication tool, seems to be losing grounds to social networks such as Twitter and Facebook. Even Google doesn’t believe in RSS anymore.

So, in the meanwhile, what do most Joomla websites use as an RSS tool? Well, if there is any mainstream RSS tool for Joomla, it must be NinjaRSS Syndicator. We know, the presence of Ninja in the name doesn’t command respect, but, for some reason, NinjaRSS Syndicator is the most used RSS extension for Joomla, even for very large websites. One would think that that reason (yes, we know there are two thats, but they do make sense!) for that tool to be very common is because of its stability and its performance. If you actually believe this is the case, then let us tell you a little story…

Earlier in the day a customer called us and told us that his company’s Joomla website is crashing – with a lot of those Cannot connect to database MySQL errors. We checked the load on the server and it was extremely high (we’re talking about 70%) and MySQL was generating a load of about 1,200% (yes, that’s 1,200!). We restarted MySQL and Apache and enabled the MySQL Slow Query Log to reveal the bottlenecks on the website. Fifteen minutes later, the website crashed, but this time, we had a conclusive evidence of who the culprit was. It was this query:

SELECT DISTINCT u.id as userid, IFNULL(c.id,a.catid) as catid, a.sectionid as secid, a.id as id, a.*, a.introtext as itext, a.fulltext as mtext, u.name AS author, u.usertype, u.email as authorEmail, a.created_by_alias as authorAlias, a.created AS dsdate, a.modified as updated, c.title as catName, CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END as catslug
FROM #__content AS a
LEFT JOIN #__users AS u ON u.id = a.created_by
LEFT JOIN `#__categories` AS c on c.id = a.catid
WHERE a.state='1'
AND a.id IN (SELECT content_id FROM #__content_frontpage)
AND (a.access = 1 OR a.access = 5)
AND (c.access = 1 OR c.access = 5)
AND (a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2013-11-12 10:17:47') AND (a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2013-11-12 10:17:47')
ORDER BY a.created DESC LIMIT 20;

The above query was taking 13 seconds to execute, and was examining 59,543 rows (that’s about 60k rows), and MySQL was attempting to execute it every couple of seconds! And, which file contained this query? Well, it was none other than the ninjarsssyndicator.php file, which was located under the components/com_ninjarsssyndicator/models directory. In other words, it was the famed NinjaRSS Syndicator extension that was causing this load on the server.

So, what did we do to fix the problem?

The query was slow because of the usage of the DISTINCT keyword at the beginning of the query, which will have to ensure that every row returned by MySQL is unique. Technically, the returned rows must be unique without even using the DISTINCT keyword. So, removing the word DISTINCT from line 130 in the ninjarsssyndicator.php file (again, which is located under the components/com_ninjarsssyndicator/models directory) fixed the problem.

And what does that mean?

It means that even those extensions that most Joomla administrators trust and use on a daily basis can be flawed with performance issues (and/or security issues) that can bring down their websites in a matter of minutes. Joomla administrators must be diligent with their choice of extensions and must examine their logs regularly for performance issues.

If you have the same problem on NinjaRSS Syndicator, then we hope you found this post useful. If you didn’t, or if you need help with another non-performing extension, then please contact us. We are extremely knowledgeable about Joomla, our work is professional and fast, and we don’t charge that much!

One Response to “NinjaRSS Syndicator Substantially Slows Down Joomla Websites”
  1. Pingback by How to Create an RSS Newsletter Subscription Functionality on Your Joomla Website | itoctopus — November 18, 2013 @ 11:47 pm

    […] downloaded NinjaRSS Syndicator. We then installed it and optimized it. (NinjaRSS Syndicator, for those who don’t know, is a Joomla extension that generates an RSS […]

Leave a comment