• Register or
  • Sign In
    • Forgot your password?
    • Forgot your username?
    Or sign in with your account on:
    Facebook
    Twitter
    Google
    LinkedIn

K2 | The powerful content extension for Joomla! developed by JoomlaWorks

  • home
  • about
  • blog
  • documentation
  • extend K2
  • showcase
  • community
  • demo
K2 brings the good parts from Drupal and Wordpress into Joomla!
  • Index
  • Recent Topics
  • Search
Welcome, Guest

To post messages, you need to login first.
K2 Community Forum
K2 Community Forum
New to K2? Ask here first!

K2 making site very slow - please help
(1 viewing) (1) Guest
Reply Topic
New Topic
  • Page:
  • 1

TOPIC: K2 making site very slow - please help

K2 making site very slow - please help 3 months, 1 week ago #169348

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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.
Last Edit: 3 months, 1 week ago by Scott Lavelle. Reason: added details about which area are problems
Reply Quote

Re: K2 making site very slow - please help 3 months, 1 week ago #169350

  • jean-philippe
  • ( User )
  • OFFLINE
  • Senior Boarder
  • j-p.emond@netlys.com
  • Posts: 62
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
Last Edit: 3 months, 1 week ago by jean-philippe.
Reply Quote

Re: K2 making site very slow - please help 3 months, 1 week ago #169351

  • jean-philippe
  • ( User )
  • OFFLINE
  • Senior Boarder
  • j-p.emond@netlys.com
  • Posts: 62
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
Reply Quote

Re: K2 making site very slow - please help 3 months, 1 week ago #169353

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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.
Last Edit: 3 months, 1 week ago by Scott Lavelle. Reason: added more detail about compression
Reply Quote

Re: K2 making site very slow - please help 3 months, 1 week ago #169384

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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
Last Edit: 3 months, 1 week ago by Scott Lavelle. Reason: Added item to bullt list and formatted
Reply Quote

Re: K2 making site very slow - please help 3 months, 1 week ago #169445

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
Anyone have any ideas on this?
Reply Quote

Re: K2 making site very slow - please help 3 months ago #169550

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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.
Reply Quote

Re: K2 making site very slow - please help 3 months ago #169649

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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.
Reply Quote

Re: K2 making site very slow - please help 3 months ago #169805

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14


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.
Reply Quote

Re: K2 making site very slow - please help 2 months, 3 weeks ago #170048

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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.
Reply Quote

Re: K2 making site very slow - please help 2 months, 2 weeks ago #170172

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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!
Reply Quote

Re: K2 making site very slow - please help 2 months, 2 weeks ago #170188

  • sawan gupta
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
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
Reply Quote

Re: K2 making site very slow - please help 2 months, 2 weeks ago #170202

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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.
Reply Quote

Re: K2 making site very slow - please help 2 months, 2 weeks ago #170203

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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!
Reply Quote

Re: K2 making site very slow - please help 2 months, 1 week ago #170521

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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.
Reply Quote

Re: K2 making site very slow - please help 2 months, 1 week ago #170615

  • Jack Hughes
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
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
Reply Quote

Re: K2 making site very slow - please help 2 months ago #170624

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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.
Reply Quote

Re: K2 making site very slow - please help 1 month, 2 weeks ago #171576

  • Scott Lavelle
  • ( User )
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
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.
Reply Quote
Reply Topic
New Topic
  • Page:
  • 1
K2 Community Forum
K2 Community Forum
New to K2? Ask here first!
Find this topic helpful? Why not share it with others?
Tweet
Powered by Kunena
Time to create page: 0.55 seconds
Advertisement
  • Contact us
  • Join the K2 Expert Companies list
  • Privacy Policy
back to top
Copyright © 2006 - 2013 JoomlaWorks Ltd.. All rights reserved. K2 is a joint project by JoomlaWorks Ltd. & Nuevvo Webware Ltd., released under the GNU/GPL v2 license.
Joomla! is a registered trademark of Open Source Matters, Inc. JoomlaWorks/Nuevvo are not affiliated with or endorsed by Open Source Matters or the Joomla! Project.
designed by Nuevvo