Jul 03, 2009, 09:33 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Read what MODx Developers say: MODx Dev. Blogs
Pages: [1] 2   Go Down
  Print  
Author Topic: Wayfinder slowness issue  (Read 4615 times)
0 Members and 1 Guest are viewing this topic.
devtrench
Member
**
Posts: 53



WWW
« on: Jan 25, 2008, 05:45 PM »

I'm using wayfinder to load a menu that is 4 levels deep and has about 750-1000 items in it.  Here is the snippet call:

[[Wayfinder?startId=`0`&level=4]]

This call takes about 10 seconds to process every single page load.  I was under the impression that since I'm calling this snippet cached that it would just grab it out of the cache after processing it once. 

Anyway, it's terribly slow and I'd appreciate any advice on how to make this faster.  Is this amount of data just to much for Wayfinder/MODx to handle? 

I'm running this site on an OS X server (1.4), Apache 1.3, PHP 5.1.2

Thanks,

James


Logged

rthrash
Foundation
*
Posts: 10,471



WWW
« Reply #1 on: Jan 25, 2008, 05:48 PM »

Is this on a public server that we could see a link?
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
sottwell
Documentation Team
*
Posts: 8,825



WWW
« Reply #2 on: Jan 26, 2008, 03:25 AM »

If the document is cached and the snippet call is cached, then the whole page will be cached, menu and all.
Logged

sottwell.com has moved to a lovely Solaris 10 server!
Log in username guest, password guestuser.
Templates are now becoming available at http://sottwell.com/templates.html
rthrash
Foundation
*
Posts: 10,471



WWW
« Reply #3 on: Jan 26, 2008, 09:41 AM »

The reason I ask if there's a public link because I wanted to see if there's any other elements that might not be loading. I've seen missing favicons or JS files cause a similar behavior. And depending on what's going on with your Wayfinder template it may be something missing that's causing a similar behavior.
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
devtrench
Member
**
Posts: 53



WWW
« Reply #4 on: Jan 27, 2008, 10:17 PM »

Sure, here is the link to my test case.  The only difference between these two pages is that the snippet code mentioned in my first post has been removed in the testindex page

Slow page with the Wayfinder code (takes about 25-30 seconds to load)
http://www.gips.org/dev

Fast page without Wayfinder code (takes about 3 seconds to load)
http://www.gips.org/dev/testindex

Let me know if you find anything out or need more information from me.  Thanks for looking into this!!!

Ok, and I figured out one more thing.  The this page was set to NOT be cached because it uses the Maxi gallery snippet (I forgot that I did that).  When I set the page to cache, the first time it takes forever to load, but subsequent times it is much faster (about 3 seconds or less).  So, does anyone know any workarounds for that??  Note that Cacheable is set to NO on the examples above to show the speed difference.

James
Logged

ganeshXL
Testers
*
Posts: 1,923


true is true


WWW
« Reply #5 on: Jan 27, 2008, 11:09 PM »

There's something strange in line 129-131:

Code:
<?
// Use the following syntax $param = 'value';
?><li style="margin-top:10px">

Why can I view PHP via "view source" in my browser? Find out where this is coming from and delete it from that snippet/chunk or whatever it is. Maybe it's confusing the parser...

Then, you might also check if maybe the accuweather stuff is maybe slowing things down. And the usual routine checks: Are all CSS and JS files on the server? Are their paths correct? etc.
Logged

ganeshXL
Testers
*
Posts: 1,923


true is true


WWW
« Reply #6 on: Jan 27, 2008, 11:20 PM »

Actually, I just noticed one more strange thing: The extremely slow-loading page sends UTF-8 server headers, but you declare ISO-8859-1 via HTML-tags.

And in all cases, it never hurts to check your HTML + CSS.
The W3C validator reports 187 HTML-errors and 14 CSS errors.

http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.gips.org%2Fdev%2F
http://jigsaw.w3.org/css-validator/validator?profile=css21&warning=0&uri=http%3A%2F%2Fwww.gips.org%2Fdev%2F

Logged

devtrench
Member
**
Posts: 53



WWW
« Reply #7 on: Jan 28, 2008, 07:44 AM »

As far as UTF-8 vs ISO-8859-1, MODx sets that via PHP and it overrides the meta tag (at least it does in firefox)  The Setting is in the Manager Configuration.  You probably know this already, but it took me a while to figure out and should be corrected.  Thanks for pointing that out and for finding the php output stuff.  I'll look into that.

James
Logged

zi
MODx Special Forces /
Administrator
*
Posts: 3,329


May Peace Be On You


WWW
« Reply #8 on: Jan 28, 2008, 07:56 AM »

You can also use MODx timing tags for more timing information as well. It might help.
Logged

devtrench
Member
**
Posts: 53



WWW
« Reply #9 on: Jan 28, 2008, 09:39 AM »

Ok, I think I need to reformulate my question.  I know that the issue lies with the giant menu.  When it loads the first time the page takes about 30 seconds to load.  The snippet does get cached so subsequent calls to that page take only about 3 seconds for me.  I think I confused myself on this issue because the page in the example was set to be uncached since it uses MaxiGallery.

So, I don't know why Wayfinder takes such a long time to process this amount of pages.  If I take the level parameter down to 2, it takes much less time,  so I'm beginning to think that I've started to stretch the limits of wayfinder with this amount of pages.  Anyone have ideas on how to make this faster for every page on the first load?  Since the large main menu is the same everywhere I wonder if I could use wayfinder to write a file, and include that file instead of the snippet code.

Has anyone done anything like that before, or have a better idea?? 

Thanks,

James
Logged

zi
MODx Special Forces /
Administrator
*
Posts: 3,329


May Peace Be On You


WWW
« Reply #10 on: Jan 28, 2008, 09:51 AM »

An idea clicks in my mind is, use the wayfinder menu in a separate document as a content and call it in a TV with @Binding

OR

use getField? snippet to call the doc content.

Ofcourse be sure to keep that doc cached, and untick the "Empty cache?" check box to prevent cache clearing automatically.

Hope you got my point...
Logged

bunk58
Committed to MODx
*****
Posts: 1,397


David Bunker


WWW
« Reply #11 on: Jan 28, 2008, 10:04 AM »

IMHO it seems that you're duplicating the menu for the second, third and fourth level items in the left column depending which page you are visiting.
Could you not have a  level 1 top menu and the side menu for levels 2,3 & 4 of the parent page?
This might speed up the page loading.

David
Logged

ganeshXL
Testers
*
Posts: 1,923


true is true


WWW
« Reply #12 on: Jan 28, 2008, 10:12 AM »

I don't think any amount of items should slow the site down as much as your example shows.
Even your "fast" loading site (about 3 seconds) is really slow. I think it's simply a rather slow database connection.
The fact that you're including so many items with your WF call certainly doesn't speed things up.

But yes, you can of course store the Wayfinder output to a static file and include that in your template. Instead of a file you can use a chunk, or even a new document.
Just make sure the editors remember to update this chunk. You could also write a little plugin that updates your menu-chunk every time a document is created or changed. The system event would probably be OnDocFormSave. Useful API functions would be http://wiki.modxcms.com/index.php/API:runSnippet + http://wiki.modxcms.com/index.php/API:getChunk. I wonder if there's a setChunk() / saveChunk() available too...
hmm, just found out there is apparently a putChunk() function available, though it's not documented in the Wiki...

I believe items that don't change frequently shouldn't necessarily be called via database-calls. e.g. generating an XML file via PHP + mxSQL on every new request is not as efficient as storing a file on the server and just let Apache serve it as a regular text-file.
« Last Edit: Jan 28, 2008, 10:14 AM by ganeshXL » Logged

devtrench
Member
**
Posts: 53



WWW
« Reply #13 on: Jan 28, 2008, 10:51 AM »

IMHO it seems that you're duplicating the menu for the second, third and fourth level items in the left column depending which page you are visiting.
Could you not have a  level 1 top menu and the side menu for levels 2,3 & 4 of the parent page?
This might speed up the page loading.

David


I agree with you, this was a client request that we couldn't talk them out of.

I don't think any amount of items should slow the site down as much as your example shows.
Even your "fast" loading site (about 3 seconds) is really slow. I think it's simply a rather slow database connection.
The fact that you're including so many items with your WF call certainly doesn't speed things up.

But yes, you can of course store the Wayfinder output to a static file and include that in your template. Instead of a file you can use a chunk, or even a new document.
Just make sure the editors remember to update this chunk. You could also write a little plugin that updates your menu-chunk every time a document is created or changed. The system event would probably be OnDocFormSave. Useful API functions would be http://wiki.modxcms.com/index.php/API:runSnippet + http://wiki.modxcms.com/index.php/API:getChunk. I wonder if there's a setChunk() / saveChunk() available too...
hmm, just found out there is apparently a putChunk() function available, though it's not documented in the Wiki...

I believe items that don't change frequently shouldn't necessarily be called via database-calls. e.g. generating an XML file via PHP + mxSQL on every new request is not as efficient as storing a file on the server and just let Apache serve it as a regular text-file.

As I write more on this post I think what you wrote or some variation of it will be what I have to do.

I'm not a server admin, and this is the first time I've worked on a production MAMP environment, so that certainly hasn't helped me out.  I've wondered about the database being slow.  I know it is not caching queries, but I can't figure out how to turn that on.  The database is on the same server and is only used for MODx so it shouldn't be this slow.

Thanks for all of your help and keep the ideas coming if you've got more.

James
Logged

ganeshXL
Testers
*
Posts: 1,923


true is true


WWW
« Reply #14 on: Jan 28, 2008, 10:53 AM »

OK, I just tried this, and it works fine here:

a) create a chunk. Leave it empty. Name it whatever you want, e.g. testMenu

b) create a plugin. Enter this:
Code:
$myChunk = 'testMenu'; // your chunk name
$params['startId'] = '0';
$params['level'] = '4';
$html = addslashes($modx->runSnippet('Wayfinder', $params));
$sql= "UPDATE " . $modx->getFullTableName("site_htmlsnippets") . " SET snippet='$html' WHERE name='$myChunk'";
$result= $modx->dbQuery($sql);

c) Check the system event OnDocFormSave + save the plugin.

d) Change your template: Replace your Wayfinder call with your chunk: {{testMenu}}

Now, every time you edit a doc, the Menu code is being regenerated and stored in your chunk. This should speed up things quite a bit...
Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!