Page 1 of 1

Questions about caching and speed

Posted: Fri Feb 23, 2007 12:04 pm
by robswan
Hi Ted and Co.

Just spent the last few days in the office playing around with CMSMS and it's absolutely brilliant. I'm about to roll it out to add CMS to four sites for various small businesses.

My only gripe is the speed - I guess I've got to wait until 2.0 rolls out so I can use full page caching, but I was wondering if there were any other options that I could use to speed it up? I notice 'caching' a couple of times in the source code... and I'm vaguely aware that Smarty has it's own caching system...

I've tweaked the 'Cache' plugin so that it actually works with content blocks (although to get the admin panel to pick up the blocks correctly I had to just have the plugin overwrite function.content.php (rather than creating the new function.ccontent.php). [I've literally just taken the guts out of ccontent and put it back into the right place in content, I can share if anyone wants it]

I'm getting on average ~1.5 seconds for each page load, sometimes I'm getting 0.3 seconds if I'm lucky. But that's on a small site with only 5 pages. On a slightly larger site with 30 pages I'm weighing in at ~10 seconds.

I'm using Dreamhost for hosting.

All of these sites are generally static site, so full page caching would work fine. Having implemented it into 2.0, could you give me any idea of whether it would be relatively easy to hack into 1.0.4?

Many thanks,

Rob Swan
Fuelled on Coffee Limited

Re: Questions about caching and speed

Posted: Fri Feb 23, 2007 12:18 pm
by cyberman
robswan wrote: I can share if anyone wants it]
Can you send it via pm? So I can include it in next release ...

Re: Questions about caching and speed

Posted: Fri Feb 23, 2007 2:09 pm
by Pierre M.
@cyberman : include in the next release of your cache hack or include an upgraded cache hack into 2.0 core to make it the "full page caching" feature ?

@robswan : meanwhile, if you have it, you can try Apache's mod_cache. If you don't have it, you can tell you "dream" hoster to provide it. Hosters should love mod_cache.

Pierre M.

Re: Questions about caching and speed

Posted: Fri Feb 23, 2007 2:36 pm
by Ted
@Pierre: 2.0 already has a full page caching feature in it using cache lite.

Re: Questions about caching and speed

Posted: Fri Feb 23, 2007 2:52 pm
by Pierre M.
Thanks a lot Ted ! Wonderfull !

Re: Questions about caching and speed

Posted: Fri Feb 23, 2007 3:44 pm
by kermit
robswan wrote: I'm getting on average ~1.5 seconds for each page load, sometimes I'm getting 0.3 seconds if I'm lucky. But that's on a small site with only 5 pages. On a slightly larger site with 30 pages I'm weighing in at ~10 seconds.

I'm using Dreamhost for hosting.
provided everything is setup right, 10 seconds on a 30 page cmsms site would be considered SLOW.  i'd drop phpsysinfo into your web space and see what exactly is running these sites... http://phpsysinfo.sourceforge.net/

i might expect 10+ second load times if i was serving on apache running on windows 98 (my text environment many moons ago), but not on a real production server.  my cmsms sites typically run between 0.6 seconds and 4 seconds per page view (timed by fasterfox).. the slower times would be when the local pc doesn't have the dns cached or if a web page needs to pull some feeds with the rss module. otherwise, anything over 1 second i consider slow.

Re: Questions about caching and speed

Posted: Fri Feb 23, 2007 9:02 pm
by robswan
kermit wrote: my cmsms sites typically run between 0.6 seconds and 4 seconds per page view (timed by fasterfox)
I've been relying on the debug comment added to the bottom of the generated page to judge the time it's taken, e.g.

Code: Select all

<!-- Generated in 4.111695 seconds by CMS Made Simple using 25 SQL queries -->
Presumably this is the best way of timing packages because that time is exactly how long CMSMS has spent generating the page, and won't include any other factors?

I know a lot of this is going to be fixed by 2.0 doing full page caching, but sites that I currently have live (for example the site I just threw up at www.mcst.co.uk as a charitable favor) do seem to be a bit sluggish...

I'll look into phpsysinfo, maybe it's just Dreamhost being slow. Ta for the link.

Re: Questions about caching and speed

Posted: Sun Jun 24, 2007 2:32 pm
by tkeil69575
My site (www.dansoftaustralia.net) has an abnormally large number of queries (I think it's due to the number of times I used {cms_selflink ...} on the home page),
Hi Daniel,
I had the same problem with my site having over 70 queries!
cms_selflink in the main template was causing an additional 30 queries just to display the header image with the link  ...

removing (hardcoding)

{cms_selflink dir="start" text="$sitename"}

solved the problem.

The cms_selflinks in the content where not the problem, it was just this line in the template ... can only recommend not to use it here ...

tina

Re: Questions about caching and speed

Posted: Sun Jun 24, 2007 3:11 pm
by Pierre M.
Daniel15 wrote: EDIT: If your host doesn't have it already, install eAccelerator. eAccelerator improves the load times considerably.
Yes, Ted has suggested the use of such PHP accelerators several times.
Pierre M.

Re: Questions about caching and speed

Posted: Mon Jun 25, 2007 6:27 am
by cyberman
tkeil69575 wrote: I had the same problem with my site having over 70 queries!
Maybe the problem comes from News module - please look here for a (german) solution

http://forum.cmsmadesimple.org/index.ph ... l#msg24418

Re: Questions about caching and speed

Posted: Mon Jun 25, 2007 8:59 am
by tkeil69575
Hi cyberman,
thanks for the suggestion, but no ... I disabled all modules, including news and it did not have any effect on the high number of queries. Removing the line as stated in my previous post, solved the problem. I now have 17-20 queries pp. and am very happy :)

greetings
tina

Re: Questions about caching and speed

Posted: Mon Feb 04, 2008 5:21 pm
by kendo451
I run CMSMS sites on servers with three different web hosts.  All the sites are of similar size and make similar numbers of SQL queries to generate the page.

On only one of my three hosts does this problem occur - identical to yours: Networksolutions.com. 

I have analysed the problem and I believe that this host has too high of a load on their shared MySQL server.  So static pages and files load very fast, but any page requiring MySQL queries takes three to ten seconds to be generated.

The best solution is to call the host and complain about the MySQL server speed.  If that doesn't work, consider changing to a new web host.

PS, here is an example of the site generation time from the three different hosts:

Site javajs.com hosted with Clinch Mountain Communications (0.017 seconds/query):

Code: Select all

<!-- Generated in 0.393048 seconds by CMS Made Simple using 23 SQL queries -->
Site benlueders.com hosted on VDeck (0.024 seconds/query):

Code: Select all

<!-- Generated in 0.688768 seconds by CMS Made Simple using 18 SQL queries -->
Site dominiontruss.com hosted on Network Solutions (0.245 seconds/query):

Code: Select all

<!-- Generated in 10.305407 seconds by CMS Made Simple using 42 SQL queries -->

Re: Questions about caching and speed

Posted: Mon Feb 04, 2008 7:25 pm
by kendo451
I just called Network Solutions about this again.  They didn't admit it outright, but the tech told me they are upgrading to MySQL 5.0 next week.

So, what I think happened is they stopped upgrading their MySQL boxes to handle the growing load of their shared hosting sites, because they are setting up the new boxes with 5.0.  This has caused the latency on the shared MySQL server to increase a lot.

If you are using a shared hosting plan and your page generation time is more than 1 second, there is probably an overloaded shared MySQL server to blame for it.

Re: Questions about caching and speed

Posted: Thu Feb 07, 2008 3:16 pm
by kendo451
Still not having much luck with Network Solutions.

Further analysis of the problem with various hosts leads me to believe it is most likely to occur when MySQL is not on localhost.  Ie., big hosting companies that have their MySQL set up as a farm have high latency with SQL queries.  The only way to avoid this is to host with a company where the DB is run on the same box as the webserver, or get a virtual private server, or dedicated server.

In the meantime I am trying to get the ccache functions working with multiple content blocks to try to reduce the number SQL queries.