- Posts: 36
COMMUNITY FORUM
K2 making site very slow - please help
- Scott Lavelle
- Topic Author
- Offline
- Junior Member
Less
More
11 years 9 months ago - 11 years 9 months ago #109951
by Scott Lavelle
K2 making site very slow - please help was created by Scott Lavelle
Warning - long post!
I have a site I recently completed that is based on Joomla 2.5 with K2 playing a pretty big role on many of the pages.
Summary: This is a site we recently did for a local high school athletics department. There are about 20 different sports, each has a menu item and within each are several tabs. One of the tabs has a table of "upcoming events". I used "extra fields" to hold the details of the events.
So, to load that page, I pull k2_content by category. For the men's football sport, I pull all K2 Items that are in the category called Men's Football. Then for each item, I have the event name (who's playing whom), the date and time the event is happening, where the event is being held (what school), and the results of the event (who won the game). By putting the information in these extra fields, it also lets me pull the upcoming events to the front page of the site as well as to pull the "recent" results to the front page - so I can reuse the same entered data in many different ways on the site.
But on any page where the K2 items are used, it is REALLY SLOW. On pages that have no K2, it takes about 2 seconds or so to open the page. For pages that DO include K2 items (and their extra fields), the pages take 17 seconds or more to open. Since I have two K2_content modules on the home page, this means that the site itself doesn't open for about 17 seconds or more. This is not good. People give up on the site.
So, if I enable caching the site performs better, but updates (which happen all the time) either don't show up until WAY later because of the cache or the person doing the editing has to clear the cache, which causes each page to open slow until all of them are opened at least once to get them back in the cache.
I have spent about as much time troubleshooting this as I can and it's definitely K2 related. If I remove the K2 stuff, the site runs as expected. Enable them, and it sometimes even times out before the page loads. I have put the site in debug mode and see that there are a TON of queries related to the K2 extra fields (due to them being separated from the rest of the K2 Item), which I think is the major issue, but we are really only talking about 20 or so K2 Items and the related 5 or so extra fields each for each page. This doesn't seem like it should be a strain. I've created many sites that load a LOT more SQL data than that and the data comes back in a seconds or so.
I have tried this on two different (reliable) VPS hosts as well as on a locally run XAMPP server and it's equally bad on all of them.
The site actually works "ok" when in cached mode, so giving the link here may not really help much, but here it is anyway: www.chswarriors.com
Here are the K2 places:
Home page:
the Upcoming Events in the upper right
the Recent Results in the lower left
Each sports page (under the menus Men's sports and Women's sports):
The tab called schedule. These are the category based K2 Items and their extra fields described above. the more events, the slower the page.
If anyone has any ideas what I can do (short of scrapping the whole K2 thing, which would be a huge pain for this "already delivered site"), I'd really appreciate it.
Please help.
I have a site I recently completed that is based on Joomla 2.5 with K2 playing a pretty big role on many of the pages.
Summary: This is a site we recently did for a local high school athletics department. There are about 20 different sports, each has a menu item and within each are several tabs. One of the tabs has a table of "upcoming events". I used "extra fields" to hold the details of the events.
So, to load that page, I pull k2_content by category. For the men's football sport, I pull all K2 Items that are in the category called Men's Football. Then for each item, I have the event name (who's playing whom), the date and time the event is happening, where the event is being held (what school), and the results of the event (who won the game). By putting the information in these extra fields, it also lets me pull the upcoming events to the front page of the site as well as to pull the "recent" results to the front page - so I can reuse the same entered data in many different ways on the site.
But on any page where the K2 items are used, it is REALLY SLOW. On pages that have no K2, it takes about 2 seconds or so to open the page. For pages that DO include K2 items (and their extra fields), the pages take 17 seconds or more to open. Since I have two K2_content modules on the home page, this means that the site itself doesn't open for about 17 seconds or more. This is not good. People give up on the site.
So, if I enable caching the site performs better, but updates (which happen all the time) either don't show up until WAY later because of the cache or the person doing the editing has to clear the cache, which causes each page to open slow until all of them are opened at least once to get them back in the cache.
I have spent about as much time troubleshooting this as I can and it's definitely K2 related. If I remove the K2 stuff, the site runs as expected. Enable them, and it sometimes even times out before the page loads. I have put the site in debug mode and see that there are a TON of queries related to the K2 extra fields (due to them being separated from the rest of the K2 Item), which I think is the major issue, but we are really only talking about 20 or so K2 Items and the related 5 or so extra fields each for each page. This doesn't seem like it should be a strain. I've created many sites that load a LOT more SQL data than that and the data comes back in a seconds or so.
I have tried this on two different (reliable) VPS hosts as well as on a locally run XAMPP server and it's equally bad on all of them.
The site actually works "ok" when in cached mode, so giving the link here may not really help much, but here it is anyway: www.chswarriors.com
Here are the K2 places:
Home page:
the Upcoming Events in the upper right
the Recent Results in the lower left
Each sports page (under the menus Men's sports and Women's sports):
The tab called schedule. These are the category based K2 Items and their extra fields described above. the more events, the slower the page.
If anyone has any ideas what I can do (short of scrapping the whole K2 thing, which would be a huge pain for this "already delivered site"), I'd really appreciate it.
Please help.
Please Log in or Create an account to join the conversation.
- jean-philippe
- Offline
- Premium Member
- [email protected]
11 years 9 months ago - 11 years 9 months ago #109952
by jean-philippe
Emond, Jean-Philippe
Replied by jean-philippe on topic Re: K2 making site very slow - please help
Hi Scott Lavelle,
I see that you have many error on your website.. i see that you use (I suppose) A third-party app to compress your Javascript.. Your "K2" javascript load before the jquery.js.
maybe just try your "page load" without your third-party app compressing files ??
Best Regards,
I see that you have many error on your website.. i see that you use (I suppose) A third-party app to compress your Javascript.. Your "K2" javascript load before the jquery.js.
maybe just try your "page load" without your third-party app compressing files ??
Best Regards,
Emond, Jean-Philippe
Please Log in or Create an account to join the conversation.
- jean-philippe
- Offline
- Premium Member
- [email protected]
11 years 9 months ago #109953
by jean-philippe
Emond, Jean-Philippe
Replied by jean-philippe on topic Re: K2 making site very slow - please help
Sorry..
I'Ve see your code... and... your problem is your "mod_k2_content" just be sure that you don't have any error code... i see that you have many comment... and i suppose that you have a loop...
Best regards,
I'Ve see your code... and... your problem is your "mod_k2_content" just be sure that you don't have any error code... i see that you have many comment... and i suppose that you have a loop...
Best regards,
Emond, Jean-Philippe
Please Log in or Create an account to join the conversation.
- Scott Lavelle
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 36
11 years 9 months ago - 11 years 9 months ago #109954
by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
I have modified the k2_content routine with a conditional to check if a setting in the backend was chosen and modify the query accordingly. To validate that it wasn't my code cause the issue, I upgraded to the newest version of K2 in a test, which removed any modifications I made to the code. This didn't help. So the version you are seeing on the live site is with my modifications. When running on the new version of K2, my edits are not there and there is no notable difference in the performance.
Basically, what the code I added does is check to see if the k2 item has been marked in the backend as "within the last 45 days". If it is, then I add a bit to the query to say to only pull certain events that have a created date within the last 45 days.
In the case of the items that are on the "sports pages", the two switches that are checked are both "negative" so the query remains unmodified, so the code is identical to the original K2_content code.
So, in short, my code edits only apply on the home page examples, not the sports pages. And replacing my edited version with the original K2_content php doesn't improve things.
Good observation, but I don't think it is what's causing the issues here...
Also, I'm using the JaT3 framework and the css/js compression built in there. I have to at least combine the css files or I have issues with the Internet Explorer css limit on the Inside Sports...coaches directory page, but even with things in no compression, no minification, no combining, no cache, it still has the problem.
Basically, what the code I added does is check to see if the k2 item has been marked in the backend as "within the last 45 days". If it is, then I add a bit to the query to say to only pull certain events that have a created date within the last 45 days.
In the case of the items that are on the "sports pages", the two switches that are checked are both "negative" so the query remains unmodified, so the code is identical to the original K2_content code.
So, in short, my code edits only apply on the home page examples, not the sports pages. And replacing my edited version with the original K2_content php doesn't improve things.
Good observation, but I don't think it is what's causing the issues here...
Also, I'm using the JaT3 framework and the css/js compression built in there. I have to at least combine the css files or I have issues with the Internet Explorer css limit on the Inside Sports...coaches directory page, but even with things in no compression, no minification, no combining, no cache, it still has the problem.
Please Log in or Create an account to join the conversation.
- Scott Lavelle
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 36
11 years 9 months ago - 11 years 9 months ago #109955
by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
So - to level the playing field a little:
I have setup a test site based on the production one and have done the following:
The home page will not display the "recent results" because they depend on the query modification I put in, so this is not the best example. Use a sports page, like Mens Basketball, then the tab on that page called "schedule", which is just a list of K2 Items, specifically calling their extra fields into the page. All I did was modify the output template for this according to a recent K2 blog post about how to use extraa fields anywhere on a site. Here's the code I used to do the table output. This doesn't change anything about how many queries are run and doesn't add any additional logic to the page. It simply changes the code from iterating over "all extra fields for the item", instead directing it to use specific ones to build the table.
What seems to be the issue is that the "normal" way to use K2 would be to show a single k2 item on a page with its associated extra fields. In this case, I'm loading all of the k2 items in a category and the extra fields that go with each. Still doesn't seem like it should be killing the site.
Here's the link to the test site. I sure would like some feedback about what can be done to speed this up!
chstest.technicalrs.net
Thanks,
Scott
I have setup a test site based on the production one and have done the following:
- Removed my custom bit of code from the mod_k2_content php file
- Turned off caching so you can see how badly it performs
- Turned on debugging so you can see the queries that are being generated
- Turned off all js and css compression options
The home page will not display the "recent results" because they depend on the query modification I put in, so this is not the best example. Use a sports page, like Mens Basketball, then the tab on that page called "schedule", which is just a list of K2 Items, specifically calling their extra fields into the page. All I did was modify the output template for this according to a recent K2 blog post about how to use extraa fields anywhere on a site. Here's the code I used to do the table output. This doesn't change anything about how many queries are run and doesn't add any additional logic to the page. It simply changes the code from iterating over "all extra fields for the item", instead directing it to use specific ones to build the table.
<tr>
<?php echo "<td>" . htmlspecialchars($item->extraFields->EventName->value) . "</td>"; ?>
<?php echo "<td>" . $item->extraFields->Eventdate->value . ", " . $item->extraFields->EventTime->value ."</td>"; ?>
<?php echo "<td>" . $item->extraFields->EventLocation->value . "</td>"; ?>
<?php echo "<td>" . $item->extraFields->HomeAway->value . "</td>"; ?>
<?php echo "<td>" . $item->extraFields->Results->value . "</td>"; ?>
</tr>
What seems to be the issue is that the "normal" way to use K2 would be to show a single k2 item on a page with its associated extra fields. In this case, I'm loading all of the k2 items in a category and the extra fields that go with each. Still doesn't seem like it should be killing the site.
Here's the link to the test site. I sure would like some feedback about what can be done to speed this up!
chstest.technicalrs.net
Thanks,
Scott
Please Log in or Create an account to join the conversation.
- Scott Lavelle
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 36
11 years 9 months ago #109956
by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
Anyone have any ideas on this?
Please Log in or Create an account to join the conversation.
- Scott Lavelle
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 36
11 years 9 months ago #109957
by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
Waiting patiently for anyone with any sort of comments or solutions to this issue. Is this not a problem in general for folks out there? I only have about 350 K2 Items with 6 Extra Fields - I would expect this sort of behavior is I had many thousands, but this small number, only about 40 of which appear on any given, full, page, seems like it would be a no-brainer for such an industry standard Joomla extension.
Do I need to switch this over to Zoo or something else to get it to perform correctly? I'd like to be able to continue to use K2 for future sites as well as "fix" this one, but with this performance, I would need to look at other CCK options.
Any help is greatly appreciated by both me and my clients.
Do I need to switch this over to Zoo or something else to get it to perform correctly? I'd like to be able to continue to use K2 for future sites as well as "fix" this one, but with this performance, I would need to look at other CCK options.
Any help is greatly appreciated by both me and my clients.
Please Log in or Create an account to join the conversation.
- Scott Lavelle
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 36
11 years 9 months ago #109958
by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
Now getting less patient and disappointed in the lack of feedback. I see a lot of complaints about K2 being slow for one reason or another and thought that folks got their answers about "why" and went on their way without updating the thread. Bu tnow I'm starting to get the impression that people just give up and either just accept it the way it is or they find a different way to handle the situation.
I'm sure getting to the bottom of this would help others in the community to speed up their sites as well as help the developers of the extension to make things work better.
Please help.
I'm sure getting to the bottom of this would help others in the community to speed up their sites as well as help the developers of the extension to make things work better.
Please help.
Please Log in or Create an account to join the conversation.
- Scott Lavelle
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 36
11 years 9 months ago #109959
by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
:S
Weeping. Is there any support out there for this component? Pleas help - just rying to use the application the way that I believe it was designed to be used.
Weeping. Is there any support out there for this component? Pleas help - just rying to use the application the way that I believe it was designed to be used.
Please Log in or Create an account to join the conversation.
- Scott Lavelle
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 36
11 years 8 months ago #109960
by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
Really? Nothing? I guess I will have to start using Zoo for this stuff instead...like I want to learn the idiosyncrasies of yet another system. :(
Please Log in or Create an account to join the conversation.