Skip to main content
Topic: Intermittent Loading Slowdowns (Read 8949 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Intermittent Loading Slowdowns

Reply #15

In doing some digging, it looks like the daily maintenance scheduled task is emptying out the cache directory.  This of course removes all the css/js hive compilations which then need to be regenerated as demanded, which can be slow. 

Re: Intermittent Loading Slowdowns

Reply #16

Yup, step one of daily maintenance
Code: [Select]
		// First clean out the cache.
clean_cache();

And doing that flushes the hive's etc by default ... Not sure why daily calls that TBH
So
a) remove that
or
b) add a parameter like clean_cache(full = true) and with daily call it as clean_cache(false) (with adjustments to protect the hive)
or
c) something else

Re: Intermittent Loading Slowdowns

Reply #17

I had similar issue, but I thought that it was my shared server... Then I found option Minify Javascript and CSS files, disabled it and site is loading much faster

Re: Intermittent Loading Slowdowns

Reply #18

That makes sense, it can be expensive to create those hives, so you don't want to do it daily.  I think we can just change the call in maintenance to be
Code: [Select]
clean_cache('data');
and that will take care of the problem.  Need to test that though.

ETA: that seems to work fine
Last Edit: November 10, 2014, 04:49:03 pm by Spuds

Re: Intermittent Loading Slowdowns

Reply #19

Cool digging!
Yep, it doesn't make much sense to clean up everything.

Actually... why clean up the cache daily at all?
Bugs creator.
Features destroyer.
Template killer.

Re: Intermittent Loading Slowdowns

Reply #20

similar problem, 6,99 seconds to open the main page, then everything ok
sorry for my bad english

Re: Intermittent Loading Slowdowns

Reply #21

Daily cache cleaning if it checks and removes really old things might make sense.  But otherwise I'm not sure the point. 

Re: Intermittent Loading Slowdowns

Reply #22

Made the change suggested by spuds.  Will see if that clears everything up delay wise over the next few days.

Thanks for all the help here.

Re: Intermittent Loading Slowdowns

Reply #23

Great .. let us know how that works

For sure if a user / admin came to a site and triggered a hive generation it would be slow to load on that page, like seconds long.  And it would be random since a bot or someone else may have triggered it before,  And there are 100's of combinations, depends on settings and what action is being done.  Definitely something we don't want to throw out each day :P

As to why that call is there, I can see maybe some use for the filebased cache, that could leave crud behind.

Re: Intermittent Loading Slowdowns

Reply #24

I was thinking that one option could have been to use a php script to serve the css and js to reduce the time (in the sense that loading the page an hash is computed, and passed as parameter to a file added to the head as script or link:
Code: [Select]
	<link rel="stylesheet" href="http://www.elkarte.net/community/assets.php?hive=89b6b8d4ab3ed05f8104005cc092f02f475877a9;type=css?d77925ee" id="csscombined" />
<script src="http://www.elkarte.net/community/assets.php?hive=9a8029a7644dc0290120719ff63ed5eb69a260c7;type=js?252f4f7b" id="jscombinedtop"></script>
for example, but even that way, it would mean that the css and the js would appear with some 2/3 seconds of delay on the page, resulting in an unpleasant experience.
Bugs creator.
Features destroyer.
Template killer.

Re: Intermittent Loading Slowdowns

Reply #25

It's neat, but isn't minification and combining somewhat outside the scope of a forum engine? Surely that should fallback to the job of the actual server, using something like the PageSpeed module. I use the CloudFlare CDN with RocketLoader to do all that heavy lifting on my site.

Spoiler (click to show/hide)

I don't mean to be negative, I'm just curious.

Re: Intermittent Loading Slowdowns

Reply #26

I think you will find, for a lot of users, that is going to be to complicated, so we wanted to provide something that was a one click affair.  Nothing else to sign up for,  nothing required, etc.  Mods, themes, etc are just taken care of by the core right now.

What you have, using a CDN, is certainly the best way to go.  I've thought about writing an addon that would do just that (and to verify that we have the hooks in place to do that), meaning to build out the CDN js/css in place of the built in minimizing. 

QuoteI was thinking that one option could have been to use a php script to serve the css and js to reduce the time (in the sense that loading the page an hash is computed, and passed as parameter to a file added to the head as script or link:
I'm not sure what to do TBH ... its a one time slowdown and then its done (but it sucks when its you).  One thought I had was to have a task that gets kicked off once you click that button to start building min files of the js/css then the combiner would find those and use them in the hive with no delay.  Could even ship 1.02 with min files and until you change a file they would be good to use.


Re: Intermittent Loading Slowdowns

Reply #27

Quote from: Spuds – I think you will find, for a lot of users, that is going to be to complicated, so we wanted to provide something that was a one click affair.  Nothing else to sign up for,  nothing required, etc.  Mods, themes, etc are just taken care of by the core right now.

Ah, fair enough. It's certainly quick and easy :)

Quote from: Spuds – I'm not sure what to do TBH ... its a one time slowdown and then its done (but it sucks when its you).  One thought I had was to have a task that gets kicked off once you click that button to start building min files of the js/css then the combiner would find those and use them in the hive with no delay.  Could even ship 1.02 with min files and until you change a file they would be good to use.

What about pages requiring multiple scripts/stylesheets? Doesn't minimizing those in source defeat the purpose, since you've then got to combine and re-minimize them anyway?

The only way to avoid the need for combining sheets and scripts is to use SPDY, which not all web servers can support.
Last Edit: November 12, 2014, 09:28:21 am by ant59

Re: Intermittent Loading Slowdowns

Reply #28

Just wanted to report that since changing the clear cache call to have the 'data' argument I've not seen the random slowdowns.  Will continue to watch.

Also I do appreciate the ability to have Elk combine and minify things without any external sites.

As to pre-generating the cached files what about a script that calls the predictably most common pages that random visitors are likely to see.  Forum index, category, board, topic, registration, profile, recent topics.  Ones that would show up for new users who might be especially put off by a site that seems slow to respond up front.  Once people are registered infrequent slowdowns that would occur after the site was modified likely would not drive them away.  And even for them you could probably handle most of it with the post page, pm pages, and new / unread topics.

Re: Intermittent Loading Slowdowns

Reply #29

It seems that disabling hostname lookups was the cure. Since then, I've had no major slowdowns from script delay. The only thing to show up in the "slowlog" is BadBehaviour, which is a fair trade-off. Not using Elkarte minification or combiner.