Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-03-13 10:26:00

rossharvey
Member
From: Earth. Sometimes.
Registered: 2005-03-16
Posts: 233
Website

Massive Lag Before Page Load

Hey TXP wizards,

Some help would be gratefully appreciated if you could spare a moment. I’ve (out of the blue) been hit with a huge lag when loading a blog post. An example:

http://www.rossharvey.com/blog

(Click any of the blog entries.)

It never used to do that. It only occurs on single articles, the rest of the site is fine. All I’ve done to the backend recently is add a new section, and add that section to the blog listing page (it only has one post in it). the article template has not changed.

I’ve tried disabling the social media calls yet the problem persists. Using the debug mode yielded no errors.

Any ideas?

Offline

#2 2015-03-13 10:49:39

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: Massive Lag Before Page Load

I tried this page:

www.rossharvey.com/weddings/best-wedding-photographer-2014

According to my web inspector, that’s a 38MB page. That’s terrifying. Also, I’m seeing upwards of 200 timers firing, most of which seem to be Twitter- and Google-related.

Offline

#3 2015-03-13 11:06:48

rossharvey
Member
From: Earth. Sometimes.
Registered: 2005-03-16
Posts: 233
Website

Re: Massive Lag Before Page Load

The page size/load is nothing to do with the lag. There is a long pause before the page will even resolve. That has only happened very recently after years of working without issue.

The CMS/server seems to be getting stuck before loading the page. Timers – is there anything I can do about that? I’m sing their official plugin code and practices.

Some blog posts have a huge amount of content on them, not much I can do really as image quality is paramount. I’m lucky enough to not have to worry too much about the content/speed penalties Google may inflict; the benefit of the number and quality of images out weighs the potential SEO drawbacks. You should see the size of the Burma post ;)

Offline

#4 2015-03-13 11:22:02

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: Massive Lag Before Page Load

I just loaded the page without much lag but I’d agree with Pete that the images are indeed too large. Did you consider using a lightbox type plugin which would load the larger images on clicking on their thumbnails?

Alternatively, put your install in debug mode and check if any of the queries are taking too long to load.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2015-03-13 11:26:55

rossharvey
Member
From: Earth. Sometimes.
Registered: 2005-03-16
Posts: 233
Website

Re: Massive Lag Before Page Load

I’ll try debug mode, thanks.

I did yes, in fact I use a slideshow with lazy loading for the homepage to keep it optimised for google efficiency.

The ‘storyboards’ I post have become an expected part of my brand. People expect them and want to see them, so moving to slideshows is a tricky prospect. Although far more useful in terms of speed!

Offline

#6 2015-03-13 11:34:55

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: Massive Lag Before Page Load

rossharvey wrote #289006:

The page size/load is nothing to do with the lag. There is a long pause before the page will even resolve.

Ish. There’s a long pause before the content starts appearing. This might be down to the huge lump of JS in the <head>, much of it appears to be loading asynchronously which makes the loading order somewhat unpredictable.

The CMS/server seems to be getting stuck before loading the page. Timers – is there anything I can do about that? I’m sing their official plugin code and practices.

I’m assuming that for each photo there’s a call to grab each of the Pinterest, Google Plus, Twitter and Facebook badges. That’s a lot of stuff going on with the quantity of photos. Has your web host changed anything at their end, recently?

Some blog posts have a huge amount of content on them, not much I can do really as image quality is paramount. I’m lucky enough to not have to worry too much about the content/speed penalties Google may inflict; the benefit of the number and quality of images out weighs the potential SEO drawbacks.

I’m not thinking about Google, I’m thinking about slower broadband and mobile users. Your images are pretty well optimised, though I could shave another 10% or so of the file size off with ImageAlpha and ImageOptim – the quantity of photos means that won’t make a big dent in the overall page payload. There are 300 requests in the URL I tried; combine that the with the size, and it’s not going to be speedy.

Try shifting your JS to the bottom of the page, and keep your CSS at the top. Try loading the JS without the async options when it’s at the end. Try removing all references to all the social button stuff and get a benchmark for just the page as-is, then start adding them back in one by one, testing page speed as you go.

Offline

#7 2015-03-13 11:36:03

rossharvey
Member
From: Earth. Sometimes.
Registered: 2005-03-16
Posts: 233
Website

Re: Massive Lag Before Page Load

Here’s the output from the debug:

<!-- Runtime:    25.147 -->
<!-- Query time: 0.050801 -->
<!-- Queries: 36 -->
<!-- Memory: 5596Kb, <txp:smd_link_to_prev> -->
<!-- txp tag trace: 
[SQL (0.00215816497803): select name, data from txp_lang where lang='en-gb' AND ( event='public' OR event='common')]
[SQL (0.00627398490906): select name, code, version from txp_plugin where status = 1 AND type IN (0,1) order by load_order]
[SQL (0.00056004524231): select ID,Section from textpattern where url_title like 'nikon-d750-street-photography-review' AND Section='street' and Status >= 4 limit 1]
[SQL (0.000250816345215): select page, css from txp_section where name = 'street' limit 1]
[SQL (0.00155997276306): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where ID=170 and Status in (4,5)]
[article 170]
[SQL (0.00066089630127): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from textpattern where Posted > '2015-03-11 14:09:05' and Section = 'street' and Status=4 and Posted < now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') order by Posted asc limit 1]
[SQL (0.000596046447754): select ID, Title, url_title, unix_timestamp(Posted) as uposted
			from textpattern where Posted < '2015-03-11 14:09:05' and Section = 'street' and Status=4 and Posted < now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') order by Posted desc limit 1]
[SQL (0.000789880752563): select host from txp_log where ip='82.2.18.1' limit 1]
[SQL (0.000457048416138): select user_html from txp_page where name='street']
[Page: street]
<txp:output_form form="struct_header" />
	[SQL (0.000753879547119): select Form from txp_form where name='struct_header']
	[Form: struct_header]
	<txp:if_section name="default">
		[<txp:if_section name="default">: false]
	</txp:if_section>
	<txp:if_section name="letters">
		[<txp:if_section name="letters">: false]
	</txp:if_section>
	<txp:if_section name="awards">
		[<txp:if_section name="awards">: false]
	</txp:if_section>
	<txp:if_section name="slideshows">
		[<txp:if_section name="slideshows">: false]
	</txp:if_section>
	<txp:if_section name="venue">
		[<txp:if_section name="venue">: false]
	</txp:if_section>
	<txp:if_section name="creative">
		[<txp:if_section name="creative">: false]
	</txp:if_section>
	<txp:if_section name="about">
		[<txp:if_section name="about">: false]
	</txp:if_section>
	<txp:if_section name="contact">
		[<txp:if_section name="contact">: false]
	</txp:if_section>
	<txp:if_section name="portfolio">
		[<txp:if_section name="portfolio">: false]
	</txp:if_section>
	<txp:if_section name="archive">
		[<txp:if_section name="archive">: false]
	</txp:if_section>
	<txp:if_section name="learn">
		[<txp:if_section name="learn">: false]
	</txp:if_section>
	<txp:if_section name="weddings">
		[<txp:if_section name="weddings">: false]
	</txp:if_section>
	<txp:if_section name="tag">
		[<txp:if_section name="tag">: false]
	</txp:if_section>
	<txp:if_section name="search,county">
		[<txp:if_section name="search,county">: false]
	</txp:if_section>
	<txp:if_section name="default">
		[<txp:if_section name="default">: false]
		<txp:if_section name="tag">
			[<txp:if_section name="tag">: false]
			<txp:if_section name="weddings">
				[<txp:if_section name="weddings">: false]
				<txp:ob1_title order='<txp:if_individual_article>article,sitename<txp:else />section,sitename</txp:if_individual_article>' separator=' | ' />
					[attribute 'order']
					<txp:if_individual_article>
						[<txp:if_individual_article>: true]
					</txp:if_individual_article>
					[/attribute]
					[SQL (0.000446081161499): select Title from textpattern where ID = 170]
			</txp:if_section>
		</txp:if_section>
	</txp:if_section>
	<txp:if_section name="default,slideshows,collection-wed1,collection-wed2,slideshow-gallery">
		[<txp:if_section name="default,slideshows,collection-wed1,collection-wed2,slideshow-gallery">: false]
	</txp:if_section>
	<txp:site_url />
	<txp:feed_link flavor="atom" format="link" label="Atom" />
	<txp:feed_link flavor="rss" format="link" label="RSS" />
	<txp:rsd />
	<txp:if_section name="contact">
		[<txp:if_section name="contact">: false]
	</txp:if_section>
	<txp:if_section name="portfolio,faq">
		[<txp:if_section name="portfolio,faq">: false]
	</txp:if_section>
	<txp:if_section name="weddings,reviews,street">
		[<txp:if_section name="weddings,reviews,street">: true]
	</txp:if_section>
	<txp:if_individual_article>
		[<txp:if_individual_article>: true]
		<txp:if_article_category name="grid" number="1">
			[<txp:if_article_category name="grid" number="1">: false]
			<txp:section/>
		</txp:if_article_category>
	</txp:if_individual_article>
	<txp:if_section name="default">
		[<txp:if_section name="default">: false]
	</txp:if_section>
	<txp:section name="default" title="1" link="1">
	</txp:section>
	<txp:section name="portfolio" title="1" link="1">
		[SQL (0.000265121459961): select title from txp_section where name='portfolio']
	</txp:section>
	<txp:section name="awards" title="1" link="1">
		[SQL (0.000281095504761): select title from txp_section where name='awards']
	</txp:section>
	<txp:section name="about" title="1" link="1">
		[SQL (0.000241994857788): select title from txp_section where name='about']
	</txp:section>
	<txp:section name="contact" title="1" link="1">
		[SQL (0.000221967697144): select title from txp_section where name='contact']
	</txp:section>
	<txp:section name="letters" title="1" link="1">
		[SQL (0.00022292137146): select title from txp_section where name='letters']
	</txp:section>
	<txp:section name="learn" title="1" link="1">
		[SQL (0.000249862670898): select title from txp_section where name='learn']
	</txp:section>
<txp:if_article_list>
	[<txp:if_article_list>: false]
</txp:if_article_list>
<txp:article form="item_wedding" listform="list_wedding" section="street" sort="Posted desc" limit="5" />
	[SQL (0.000316858291626): select Form from txp_form where name='item_wedding']
	[Form: item_wedding]
	<txp:output_form form="code_title_nav" />
		[SQL (0.000287055969238): select Form from txp_form where name='code_title_nav']
		[Form: code_title_nav]
		<txp:if_article_category name="grid" number="1">
			[<txp:if_article_category name="grid" number="1">: false]
		</txp:if_article_category>
		<txp:if_article_category name="blog" number="1">
			[<txp:if_article_category name="blog" number="1">: true]
			<txp:smd_prev section="weddings,slideshows" category="blog">
				[SQL (0.0140459537506): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where Status IN (4) AND ( Category1 IN ('blog') OR Category2 IN ('blog') )  AND Section IN ('weddings','slideshows')  AND (now() <= Expires or Expires = '0000-00-00 00:00:00') ORDER BY Section ASC,Category1 ASC,Category2 ASC,Posted ASC]
				<txp:smd_link_to_prev>
				</txp:smd_link_to_prev>
			</txp:smd_prev>
			<txp:title />
			<txp:custom_field name="sub" />
			<txp:smd_next section="weddings,slideshows" category="blog">
				[SQL (0.0124320983887): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where Status IN (4) AND ( Category1 IN ('blog') OR Category2 IN ('blog') )  AND Section IN ('weddings','slideshows')  AND (now() <= Expires or Expires = '0000-00-00 00:00:00') ORDER BY Section DESC,Category1 DESC,Category2 DESC,Posted DESC]
				<txp:smd_link_to_next>
				</txp:smd_link_to_next>
			</txp:smd_next>
		</txp:if_article_category>
	<txp:article_image />
		[SQL (0.000620126724243): select * from txp_image where id = 16667]
	<txp:gho_comments_invite zero="Add Comment" one=" Comment" more=" Comments" format="text"/>
		[SQL (0.0003981590271): select Annotate, AnnotateInvite from textpattern where ID='170']
		[SQL (0.000830888748169): select count(*) from txp_discuss where parentid='170' and visible='1']
	<txp:output_form form="code_social" />
		[SQL (0.000380992889404): select Form from txp_form where name='code_social']
		[Form: code_social]
		<txp:permlink />
		<txp:if_article_image>
			[<txp:if_article_image>: true]
			<txp:images>
				[SQL (0.000318050384521): select * from txp_image where id IN ('16667') order by name ASC ]
				<txp:image_url />
			</txp:images>
		</txp:if_article_image>
		<txp:title/>
		<txp:permlink />
	<txp:excerpt />
	<txp:body />
	<txp:output_form form="code_return_folio" />
		[SQL (0.00023889541626): select Form from txp_form where name='code_return_folio']
		[Form: code_return_folio]
		<txp:if_article_category name="grid" number="1">
			[<txp:if_article_category name="grid" number="1">: false]
		</txp:if_article_category>
	<txp:output_form form="code_social_bar" />
		[SQL (0.000226974487305): select Form from txp_form where name='code_social_bar']
		[Form: code_social_bar]
		<txp:output_form form="code_social" />
			[Form: code_social]
			<txp:permlink />
			<txp:if_article_image>
				[<txp:if_article_image>: true]
				<txp:images>
					[SQL (0.000264167785645): select * from txp_image where id IN ('16667') order by name ASC ]
					<txp:image_url />
				</txp:images>
			</txp:if_article_image>
			<txp:title/>
			<txp:permlink />
	<txp:output_form form="code_comments" />
		[SQL (0.000313997268677): select Form from txp_form where name='code_comments']
		[Form: code_comments]
		<txp:if_comments_allowed>
			[<txp:if_comments_allowed>: true]
			<txp:if_custom_field name="facebook">
				[<txp:if_custom_field name="facebook">: false]
				<txp:permlink />
			</txp:if_custom_field>
			<txp:if_comments>
				[<txp:if_comments>: true]
				<txp:if_comments_preview>
					[<txp:if_comments_preview>: false]
				</txp:if_comments_preview>
				<txp:comments />
					[SQL (0.000874996185303): select *, unix_timestamp(posted) as time from txp_discuss where parentid=170 and visible=1 order by posted ASC ]
					[SQL (0.000424861907959): select Form from txp_form where name='comments']
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
					[Form: comments]
					<txp:comment_web />
					<txp:comment_name link="0" />
					<txp:comment_name link="0" />
					<txp:comment_message />
			</txp:if_comments>
			<txp:comments_form />
				[SQL (0.00100016593933): select ip from txp_discuss_ipban where `ip` = '82.2.18.1' limit 1]
				[SQL (0.000298023223877): select Form from txp_form where `name` = 'comment_form' limit 1]
				<txp:comments_error wraptag="div" break="br" class="column span-6 last notice" />
		</txp:if_comments_allowed>
<txp:ob1_pagination firsttext="&laquo; First" previoustext="Prev" nexttext="Next" lasttext="Last &raquo;" ulclass="pagination" liselected="active" />
<txp:output_form form="struct_footer" />
	[SQL (0.00028395652771): select Form from txp_form where name='struct_footer']
	[Form: struct_footer]
[ ~~~ secondpass ~~~ ]
 -->

Any ideas?

Thanks for looking.

Offline

#8 2015-03-13 12:10:52

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: Massive Lag Before Page Load

<!-- Runtime:    25.147 -->
<!-- Query time: 0.050801 -->
<!-- Queries: 36 -->
<!-- Memory: 5596Kb […] -->

The query time relative to runtime makes me think that the problem lays outside of Textpattern. Try moving the JS down the page until after the content and zap the async stuff while you’re troubleshooting. Any better?

Offline

#9 2015-03-13 12:26:10

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Massive Lag Before Page Load

I don’t think JS is responsible for the runtime, just disable it — no difference. It’s rather txp struggling with some error. For example, there are nested <a> in

            <div class="span-1 padding-top1em">
              <a rel="prev" href="http://www.rossharvey.com/weddings/belmond-le-manoir-wedding-old-parsonage" title="Belmond Le Manoir - Wedding - Old Parsonage">
                <a rel="bookmark" href="http://www.rossharvey.com/weddings/belmond-le-manoir-wedding-old-parsonage" title="Belmond Le Manoir - Wedding - Old&#160;Parsonage"><img src="/img/v3/arrow-large-left.gif" alt="Previous"></a>
              </a>
            </div>

It does not explain the lag, but could indicate the error position (<txp:output_form form="code_title_nav" />?). Try to comment out the forms, until you find an error.

Offline

#10 2015-03-13 12:36:15

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Massive Lag Before Page Load

Hi Ross. Great site you have there. Congratulations.

I’d do this test:

1. remove most or all the images, and reload the page. Does it load quickly now? Does the debug info show a far lower number for Runtime?

2. If it indeed runs quicker when removing the images, then my bet is that the issue could be that Textpattern/PHP is somehow hitting each image in the filesystem, so to grab some info for each image (probably the width and height). For such amount of images per page, that could be costly.

Please, test & report back. Thanks.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#11 2015-03-13 12:46:58

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Massive Lag Before Page Load

<!— Memory: 5596Kb, <txp:smd_link_to_prev> —>

That’s got me worried. Does that imply smd_horizon is the biggest memory hog? According to the SQL timings, smd_horizon spends twice as long doing its stuff as all the other queries combined!

But as Pete says, the query time is a tiny fraction (less than 0.2%) of the overall page load time. And the pictures continue to load asynchronously once the lag is out of the way so it’s not necessarily the monstrous page weight.

Following on from what etc says, do you have an unintended loop situation going on in your output_form chain somewhere? As far as I remember, Txp won’t pick that up unless it’s an article loop. But I can’t see any evidence in the page source of that kind of thing.

Another avenue: if you use a limit attribute on your <images> tag, do things improve? And how many images do you have in the images folder? When the number of files starts to exceed a certain amount (usually over about 700 – 1000 is the sweet spot) things start to slow down when listing directories or performing file operations.

EDIT: maniqui beat me to the file system idea.

Last edited by Bloke (2015-03-13 12:47:30)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#12 2015-03-13 12:49:21

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: Massive Lag Before Page Load

www.rossharvey.com/portraits/holly – one image, still slow. And isn’t image info stored in db? I have even tried to disable image queries in my browser — still no luck. And www.rossharvey.com/portfolio loads quickly.

Last edited by etc (2015-03-13 12:59:29)

Offline

Board footer

Powered by FluxBB