News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Caching, needed ?

Started by a10, October 02, 2019, 04:25:01 PM

Previous topic - Next topic

a10

With the tech \ resources advances of any 'normal' server \ hosting through the years is there any substantial benefit in caching ?

In this case for a forum with daily 5000 to 15000 pageviews, approx 100 members logging in. SSD, 1GB ram, 2x cpu.

Question arose after had some strange behaviour yesterday, among other things code apearing on top of pages. Cleared cache and all immediately back to normal. Now running without any cache (was level 1), everything just as fast.
2.0.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

vbgamer45

Busy sites yes it helps alot. It depends more on forum size, the number of posts,topics, and mods installed.


I would like to know what code appeared on top of pages.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Shambles

Seen that many times. Smells of a corrupted cache file. Clearing cache usually fixes the issue but prevents us diagnosing the cause.

peterbehlendorf

You can do a lot of caching through the .htaccess file.

Have a read on gtmetrix

Arantor

Quote from: a10 on October 02, 2019, 04:25:01 PM
With the tech \ resources advances of any 'normal' server \ hosting through the years is there any substantial benefit in caching ?

In this case for a forum with daily 5000 to 15000 pageviews, approx 100 members logging in. SSD, 1GB ram, 2x cpu.

Question arose after had some strange behaviour yesterday, among other things code apearing on top of pages. Cleared cache and all immediately back to normal. Now running without any cache (was level 1), everything just as fast.

If you're at that sort of level, going up to a real cache might benefit you - e.g. memcache, Redis.

Quote from: peterbehlendorf on October 02, 2019, 04:53:51 PM
You can do a lot of caching through the .htaccess file.

Have a read on gtmetrix

Caching at that level only helps static assets or rarely changing pages; SMF is frequently neither of these things.

a10

Thing is, my forum is lightning fast without cache, reason for the question.

I don't know if this has any relevance but "Page created in 0.023 seconds" and therabout is the norm. Pages shows close to instant (even on the bad mobile hotspot connection my laptop is connected to right now. And am currently in a country far from the hosting).
2.0.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

Arantor

In which case you probably don't need it because your server has enough hardware to cope just fine without caching. But it's something to get straightened out if you grow significantly.

a10

Quote from: Arantor on October 02, 2019, 05:27:10 PM
In which case you probably don't need it because your server has enough hardware to cope just fine without caching. But it's something to get straightened out if you grow significantly.

Thanks, that's the impression I got.

Did some testing, the'worst' page to 'construct' is surely the (13 years of) stats, "Page created in 0.111 seconds with 23 queries", next to instant.

Search is relatively slow compared to 'normal' pages, 1 to 2 seconds. No index may be the cause of that, but zero problem.
2.0.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

Arantor

And it's not like caching will help you either with search ;)

drewactual

setting up compression right, setting up expires on static components and particular file types, and using http2 is, in my opinion, the better strategy to turbo up a page.  OPCache may offer some help under high loads, but... it seems to me it is better for keeping processor's from hyper loading when traffic does arrive, and so that resource is available for other things as needed. 

using push that http2 offers allows you to send and stage resources the user is going to need- compressing them makes that faster, and brotli is better than gzip.   images that appear regularly are good candidates for a full year of time to live, and CSS and JS are good candidates for at least three months (though i have those set at one year too, now).

i'd be curious to see a10's results in chrome's diagnostic panel and comparing both with cache, and without, and the waterfalls compared in each resource required to build his page... i wager most those items are cached right there locally already. 

a10

Quote from: drewactual on October 02, 2019, 08:13:52 PM
i wager most those items are cached right there locally already.
Browser cache not involved. If someday my forum should not deliver pages instantly (going above 0.05 s ? lol) I may test some caching.
2.0.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

drewactual

aye, but the unfortunate thing about caching is much of it is out of your control- and it's enough to make Goldilocks to pull her hair out and make herself bald at times... it's frustrating because you may change a page and be very happy with the results- even setting the expires, but a switch somewhere in between renders your page to a user based on cache- you can only hope that cache uses resources/files still available or doesn't mix up the (now)different files when sending that to users.  cache busting is a big business because of this. 

ISP's and switches, routers and hubs... they will cache your page with or without your permission so they can seemingly render a page faster to their customers.  it's almost impossible to stop and it's best to attempt cooperation by setting expires dates, revalidates, ect.

Arantor

While those things are legitimately annoying to deal with, it's not relevant to the question of application level caching the OP was talking about...

drewactual

Quote from: Arantor on October 03, 2019, 01:02:48 PM
While those things are legitimately annoying to deal with, it's not relevant to the question of application level caching the OP was talking about...

i get that... i was just attempting to offer a little sideways thought that caching is going to happen anyway.  outside of our control.  and, it is getting more and more sophisticated- perhaps to the point caching at application level within SMF is---- redundant? 


Arantor

No,it really isn't redundant.

I've worked on SMF sites where they were averaging more than a post a second, every second of the day. Caching was the difference between a few hundred bucks a month in hosting and a few thousand.

If caches beyond the application were sufficient, I could put my feet up and not need to run a fleet of servers that exist solely to do caching for the stuff I do now. They are really not the same thing.

drewactual

that's not what i meant, either. 

if you're seeing that kind of traffic then you'd be needing anything and everything.  for a site that comfortably sits on a shared server and requires no more resources than allotted to manage the load, i'm going to suggest that the cache's used by servers on switches is enough and the caching on the application isn't that big an impact and could simply be left alone... until traffic comes, then... it's different.  i am interested in how much traffic justifies what, though, such as "If you're seeing this kind of traffic, consider using ___ level caching".  because, in spite of everything i've said on the subject, i'd rather have something staged and functional when traffic does arrive rather than the machine stumbling all over itself when being caught unprepared.

i don't know what those lines of disembark are, but i'd like to know them.... for instance:  what load/traffic would be a place where maximum application caching should be considered? what are the drawbacks?  if the drawbacks aren't very threatening, why not just cache at that level to begin with so you don't get caught crawling?

 

Arantor

-sigh-

OK, so let's begin at the very beginning.

Even SMF out of the box turns some level of caching on because some really cheap-ass hosts object to the number of queries SMF does with even the slightest load and doing several queries and keeping the result, or reusing the results between requests so you don't have to touch the DB, this is generally beneficial.

Why do some sites not use it out of the box? Because they make their first 5 posts and they don't appear immediately and assume things are broken, even though it's absolutely working as designed.

Why do some sites not cache to the fullest extent possible? Because most hosts don't provide the good tools out of the box; shared hosts don't provide memcache to you or Redis if you're in a place where you can use that.

The lines of disembark are the logical conclusion that your assertions run into - you're asserting that you don't need to use application level caching almost as a general point of order, a fact which everything I do at work fundamentally disagrees with (if Moodle doesn't have its own application level cache, it's basically unusable, SMF is better but it does really benefit from caching)

drewactual

Man I'm not asserting anything I'm asking for knowledge.

drewactual

so i typed that last response on the phone and it rang forcing me to cut it short- and then in the hours that transpired SOMETHING SHINY happened, as usual.  At any rate, I'm not attempting to assert anything, i'm seeking understanding.  your last response, Arantor, gave better insight i didn't own before.  thanks.

Advertisement: