Keyword

K2 making site very slow - please help

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 2 months ago - 12 years 2 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.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago - 12 years 2 months ago #109952 by 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,

Emond, Jean-Philippe

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #109953 by 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,

Emond, Jean-Philippe

Please Log in or Create an account to join the conversation.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 2 months ago - 12 years 2 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.

Please Log in or Create an account to join the conversation.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 2 months ago - 12 years 2 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:
  • 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
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 2 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
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 2 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.

Please Log in or Create an account to join the conversation.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 2 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.

Please Log in or Create an account to join the conversation.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 2 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.

Please Log in or Create an account to join the conversation.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month 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.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago #109961 by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
Sorely disappointed in the lack of response. I understand that K2 is a free extension, but with its popularity, I would have expected better support from the community and/or developers. I have really tried to make extensive use of the extension in this project, but it will be the last time I do so since it has rendered the site a support dilemma! Now I basically MUST go back to the drawing board to re-create what I have already done with K2 because of what appear to be pretty limiting issues.

Please someone, prove me wrong. Tell me what is going in with the slowness. Anything - really!

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #109962 by sawan gupta
Replied by sawan gupta on topic Re: K2 making site very slow - please help
Tell me one thing scott how u r converted the list form to menu tabs......



Means that, if i enter the new entry in the extra field it seems on web page like a list form
example
i select 4 field that it show like -
Award
Publication
Conference
Research

but i want to show this in menu tabs form like -
Award Publication Conference Reserch



how can it is possible give me some help

Please Log in or Create an account to join the conversation.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago #109963 by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
Sawan,

I used the information from the K2 blog about how to get the values of specific fields rather than the whole list of extra fields. So I used this code in place of what's there. The only real differences are that 1. It creates an html table rather than an unordered list and 2. It specifies the fields individually rather than iterating over the whole list of fields (even though in this case I actually use all of the values, which allows the individual placement. I'm sure you could probably use the iterative loop to load the html table too if you wanted to use all the fields - this was just clearer to me. Here's the code:
<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>

Hope that helps.

Please Log in or Create an account to join the conversation.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago #109964 by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
One quick note: doing the above seems to be a supported way of accomplishing this, but it obviously has killed my site performance. I don't know why, obviously, but take the advice with a grain of salt! :(

Please Log in or Create an account to join the conversation.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago #109965 by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
Well, this post has now been out here for a month and I am nearly the only one who has posted anything to it: feel like I'm talking to myself...

I guess I have to give up and find another way to accomplish this. 20 second load times are totally unacceptable, especially for what amounts to about 25 records actually being loaded out of a table with only a few hundred in total. Ridiculous.

An not one single developer that I can tell! Really? One of the most popular extensions for Joomla and not one bit of help. One of only a handful of CCK options and not one bit of help?

Grrr.

Please Log in or Create an account to join the conversation.

More
12 years 1 month ago #109966 by Jack Hughes
Replied by Jack Hughes on topic Re: K2 making site very slow - please help
Hey Scott,

I appreciate your frustration, however I wanted to provide you with some feedback that might shed some light on lack of response to your problems.

#1. You did not provide any meaningful specs on your software. Was it K2 2.6.5?? Are you running any K2 related plugins?? LAMP stack?? What template did you build off of??

#2. Overall negative tone of your posts.

K2 is free. People who help out usually do so out of the kindness of their heart. When I see a negative person posting about problems that I usually don't experience then I just move on.

I can't debug your problems but I can say this: When there is a 15-20 delay from your website when a page loads, it's something more than K2.

I would suggest you look at the performance and functionality using a simpler template that's not loading as much javascript. Strip the site back, test and then build up.

Also, if you are thinking of using Zoo then try a YooTheme as well. I find that templates can cause lots of problems.

Hope this helps and good luck.
Jack

Please Log in or Create an account to join the conversation.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 1 month ago #109967 by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
Jack,

While I appreciate your perspective here, I provided a lot of detail about the issue I was having, but you're right that I didn't supply the exact K2 version. The code that I presented was based on the K2 Blog post showing off this new possibility in using the code to display individual "extra fields" - that was v2.6.2. I have upgraded that now to 2.6.5 in hopes that the new "speed improvements" that were advertised in 2.6.2+ would have some effect here. They didn't. But, the demo version of the site is now on K2 2.6.5, nonetheless.

Please note that I didn't start with a negative tone, and I don't feel that it got negative until after there was pretty much no response. I understand that K2 is free. I also understand that it is one of the most popular extensions to the Joomla system, has a pretty big user community, and is used in tons of templates from many different vendors. As such, I was really hoping for some community or developer support.

I understand that you can't debug my problems, but honestly, neither can I and this is why I came here for ideas. If you take a look at the demo site that I've posted and go to any of the non-K2 pages (basically anything that is not the home page and is not under one of the men's or women's sports menus), you will find that the pages load just fine. I just tested this now - 19seconds for the home page - 2 seconds for several different pages without K2 on them. Even the "coaches directory", which loads up about 25 articles with articles anywhere, loads in about 3 seconds. One sports page with a schedule of 15 games take 10+ seconds to load.

This is not a problem with the site in general. When I take the two K2 content modules off the home page, the speed problems are gone. If I remove the one K2-filled tab from the sports pages, they load just fine. This is almost definitely a K2 issue. I've tested this about as many ways as I could. I use the same T3 framework from Joomlart for all of the sites I build and none of them have this issue except this one - and MANY of them use K2, just not where they load a pile of extra fields on the page where they are having to pull many k2 items with their associated extra fields per page - usually they pull k2 items for Blog purpose or like our web design portfolio does, more or less one k2 item at a time or just a list of them without extra fields.

Please Log in or Create an account to join the conversation.

  • Scott Lavelle
  • Scott Lavelle's Avatar Topic Author
  • Offline
  • Junior Member
More
12 years 2 weeks ago #109968 by Scott Lavelle
Replied by Scott Lavelle on topic Re: K2 making site very slow - please help
Well, I waited long enough. I have switched over to using Ohanah for my events and tweaked the output a little to make it the same as what I was doing with K2. And it's rediculously faster. Was taking 20+ seconds to load a page with a list of K2 items on it and now it's <2 seconds.

I had an announcement go out that encouraged a bunch of visitors to the site. It got about 49 on at once at peak. This is basically nothing in the world of web, but because the site was loading so slowly, every one of those visitors was repeatedly hitting refresh - at least this is my best guess - and the entire VPS was completely overloaded. All sites on the box slowed to a crawl and this site never even came up for them. Embarrassing.

There is no question that it was K2 that was killing it. As soon as I disabled the extensino, the whole site was instantly usable and the whole server load dropped from 90+ (this is the WHM reading) to <1.

So now I am running with no caches other than the template cache and the site is SO responsive. I still have to figure out one other part, but I have some ideas.

I didn't get any useful help here and I'm disappointed. Out of principal, I'm going to be using something else in those places where I WAS using K2 on new sites. I simply can't be embarrassed like this again because of the performance of 1 extension.

Please Log in or Create an account to join the conversation.

More
11 years 1 week ago #109969 by John Kahrhoff
Replied by John Kahrhoff on topic Re: K2 making site very slow - please help
Hello - this thread is old now, but I agree with Scott regarding the ever increasing load times of K2 content. I am using a JoomlArt template that came with K2 system pre-loaded. K2 is Free, but I have purchased several other items from the company.

I have no custom code on my site - none - and I stay away from non-native extensions. In other words - I used the native components on the template and the Joomla core.

I am using the latest stable version of Joomla and K2 and it is having problems. The sad part it that I built my site and articles around it and it just started slowing down...

I stumbled on this thread because I am searching for a solution.

I will continue to search!


Thanks!

Please Log in or Create an account to join the conversation.

More
11 years 6 days ago #109970 by Lefteris
Replied by Lefteris on topic Re: K2 making site very slow - please help
@John Kahrhoff

Things are simple regarding performance:

1. Enable Joomla! caching. Set it's interval to a logical value.
2. Enable the core system cache plugin.
3. Update K2 and Joomla! to their latest versions.
4. Finally in any case, you can always enable the system debugger. It will give you information regarding the page load and which extensions take a lot of time to load.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum