Optimize Page Generation? Cache helps?

Support for IntegraMOD 140

Moderator: Integra Moderator

Optimize Page Generation? Cache helps?

PostAuthor: ZacFields » Thu Aug 24, 2006 10:30 pm

I was reading through a guy's problem with page generation and I have to say, I am feeling his pain.

I feel as though I've been just losing member after member because IM just takes so darn long to load!

Can anyone explain to me a little about the cache of the blocks and such? I have heard that adjusting these can really help.

Like if cache is turned off for a block, and I want to turn it on and run from cache like every 24 hours... I can do this? I'm just a little confused on some simple stuff I can do to bring down this 4.5 second page generation time.

Zac
Last edited by ZacFields on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.

ZacFields
Sr Integra Member
Sr Integra Member
 
Posts: 426
Likes: 0 post
Liked in: 0 post
Joined: Wed May 24, 2006 11:14 pm
Cash on hand: 0.00

PostAuthor: ZacFields » Thu Aug 24, 2006 10:53 pm

Ok sorry guys the only thing I really needed to know I ended up finding...but I would like to report on the results.

Before Adjusting Cache:
portal.php took 4.514 seconds

After Adjusting Cache"
portal.php takes 1.442 seconds

Worked wonders. I just gave a cache value to everything in the portal. Even if it's just 1 minute! It's better that way than having the cache turned off for stuff like the navigation menu. As long as you put a cache on it, it speeds things up so much.

I recommend everyone who has an integramod forum to adjust those values. Give cache to EVERYTHING. Even like the "Users visited in last 24 hours" block. Why refresh that everytime you load the index page? Nobody sits there for 15 minutes waiting for that thing to scroll through, so I set it for 24 hours.

Zac
Last edited by ZacFields on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.

ZacFields
Sr Integra Member
Sr Integra Member
 
Posts: 426
Likes: 0 post
Liked in: 0 post
Joined: Wed May 24, 2006 11:14 pm
Cash on hand: 0.00

Re: Optimize Page Generation? Cache helps?

PostAuthor: found it » Fri Aug 25, 2006 2:26 am

Hi

Excellant results.....a good job..

Just one thing could you post how you did it so other users who do not know can benifit from what you learnt...if that is ok...

:mrgreen:
Last edited by found it on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
[url=http]themes.[/url]
http://www.founditforum.com :: [url=http]Joining people together[/url]

[url=http][img=left]http://www.bbful.com/bbful_banner2.png[/img][/url]
User avatar
found it
Dev Team
Dev Team
 
Posts: 792
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 4:29 am
Cash on hand: 0.00

PostAuthor: ZacFields » Fri Aug 25, 2006 11:45 am

Sure, not a problem at all. Here is the rundown.

Instructions on using the Cache to speed up your forums

First, I'll explain to you why you are adjusting the Cache to speed up the forums. First of all, when you load up a page in IntegraMod, you're running many various queries to your database. However, the more queries you have to run, the slower that page will load.

It doesn't have to be this way... There are a lot of things on your IM blocks that don't need to be queried with every page-load. For instance, how often does your navigation menu change? Basically never, right? But still, as you navigate your site, your menu is being refreshed every single time. This is taxing on your SQL server and slows page loading.

This is where the Cache comes in. To put it simply, IM has the ability to store these blocks in a cache. So instead of querying the database for updated information, you can set some of your blocks to only refresh every XX amount of seconds. So when you open a page, blocks such as your navigation block aren't being queried every single page load but rather they are just popping right up almost as if it was hard-coded into the page.

Here are the instructions,

1. Go into your ACP and then click on the "IM PORTAL" tab.

2. Within the IM PORTAL tab, click on "Blocks Management."

3. Click on the "IntegraMod Default" (which is usually the only link in there)

4. Now you have a list of all the blocks in front of you. Look for all the blocks that say "YES" in the ACTIVE field and check to make sure it also says "YES" in the cache field. If not, you can click on the "EDIT" link and turn the cache on.

5. Now you need to decide how often do you need that block to be refreshed. For your navigation menu, (if you change it periodically) maybe just put 24 hours or 48 hours. (Remember the cache duration is in SECONDS, so you have to find out how many seconds you want before it will refresh)


Quick Cache Suggestions, these are the values that I run personally

-Donations Block: 172,800 (48 Hours)
-Board Navigation: 172,800 (48 hours)
-User Info : 3,600 (1 hour)
-Who is Online: 300 (5 minutes)
-Recent Topics: 300 (5 minutes) <-- many might disagree with this decision
-Welcome Msg on portal: 172,800 (48 hours)
-Latest News : 172,800 (48 hours) <-- my news almost never changes, so this suited me.
-Site Survey: 172,500 (48 hours) <-- many might also disagree with this one
-Mini Calendar: 86,400 (24 hours) <-- Not sure how this will affect it...but it made sense to me.
-Statistics: 300 (5 minutes)
-Album: 300 (5 minutes)
-Links: 172,800 (48 hours)
-Active Users: 172,800 (48 hours) I should also mention that I have it set to pull out the last 2 weeks worth of active users, so for most people this time frame won't work.

So there you have it. My portal page now loads between 1.5 and 2 seconds where usually it would consistantly load between 4 and 5 seconds.

Most other pages I have gone from 3.5 seconds down to well under 1.5 seconds.

Zac
Last edited by ZacFields on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.

ZacFields
Sr Integra Member
Sr Integra Member
 
Posts: 426
Likes: 0 post
Liked in: 0 post
Joined: Wed May 24, 2006 11:14 pm
Cash on hand: 0.00

Re: Optimize Page Generation? Cache helps?

PostAuthor: found it » Fri Aug 25, 2006 12:01 pm

Absolutely fantastic thank you very much for that...

:mrgreen:
Last edited by found it on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
[url=http]themes.[/url]
http://www.founditforum.com :: [url=http]Joining people together[/url]

[url=http][img=left]http://www.bbful.com/bbful_banner2.png[/img][/url]
User avatar
found it
Dev Team
Dev Team
 
Posts: 792
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 4:29 am
Cash on hand: 0.00

Re: Optimize Page Generation? Cache helps?

PostAuthor: ZacFields » Fri Aug 25, 2006 12:32 pm

This definitely helps a lot, especially on forums that frequently have (at peaks) sometimes 20+ users on at the same time as mine does. When you have 20 people on high speed connections zipping through the forums running 50+ queries per page and sometimes ammassing 3-4 pages per minute, one can see how it can be taxing on the SQL server especially on a shared host.

But for anyone looking for a quick-fix to the page generation difference between IM and a standard PHP, you need not look any further than the cache.

Glad to help...couldn't find anything like this on the forums and I think A LOT of people can benefit from this. I understand why the defaults are the way they are...because if somebody is unfamiliar with the cache and they change something on their navigation menu and they load the page and that change doesn't appear on the page, then they get confused and think things don't work. But when you set it up yourself, you are aware of this and know that you can just go in and clear the cache and the change will be reflected.

But my advice for you guys would be to adjust it to however you feel is necessary for your boards.

Zac
Last edited by ZacFields on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.

ZacFields
Sr Integra Member
Sr Integra Member
 
Posts: 426
Likes: 0 post
Liked in: 0 post
Joined: Wed May 24, 2006 11:14 pm
Cash on hand: 0.00

PostAuthor: ZacFields » Fri Aug 25, 2006 10:45 pm

*EDIT*

DO NOT CACHE "User Info"

I can't believe I was so stupid. Basically, which ever user was browsing my website when it cached that block, his avatar and screen name was shown for the next hour (the length of time I had my cache set for that block)

So do not cache that block because it will confuse the heck out of everyone! lol

Zac
Last edited by ZacFields on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.

ZacFields
Sr Integra Member
Sr Integra Member
 
Posts: 426
Likes: 0 post
Liked in: 0 post
Joined: Wed May 24, 2006 11:14 pm
Cash on hand: 0.00

PostAuthor: Master Dwarf » Fri Aug 25, 2006 10:54 pm

If you have static blocks where the info would not change at all, would setting at the cache to 9999999 work? I set most of mine according to what ZacFields mentioned but I am still getting 3-4 second load times.
Last edited by Master Dwarf on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Sean Kelley
http://www.GrumblingDwarf.com
Wisconsin Region Game Site
User avatar
Master Dwarf
Integra Supporter
Integra Supporter
 
Posts: 102
Likes: 0 post
Liked in: 0 post
Joined: Sun Apr 09, 2006 9:26 am
Cash on hand: 0.00
Location: Madison, WI

PostAuthor: tmotley » Sat Aug 26, 2006 4:04 pm

The caching does seem to make my site load more quickly. <img>

[Page generation time: 0.4353s (PHP: 83% | SQL: 17%) | SQL queries: 40 | GZIP enabled | Debug off]

News block - if you cache it, the index, categories, & archive links do not function properly. It just seems to refresh the page...

I turned off my news cache and it works again.
Last edited by tmotley on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
User avatar
tmotley
IntegraMODerators
IntegraMODerators
 
Posts: 524
Likes: 0 post
Liked in: 0 post
Joined: Mon Mar 27, 2006 3:56 am
Cash on hand: 0.00
Location: Missouri, USA

PostAuthor: Master Dwarf » Sat Aug 26, 2006 6:13 pm

"tmotley";p="14160" wrote:
News block - if you cache it, the index, categories, & archive links do not function properly. It just seems to refresh the page...

I turned off my news cache and it works again.


Yeah, I experienced the same thing.
Last edited by Master Dwarf on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
Sean Kelley
http://www.GrumblingDwarf.com
Wisconsin Region Game Site
User avatar
Master Dwarf
Integra Supporter
Integra Supporter
 
Posts: 102
Likes: 0 post
Liked in: 0 post
Joined: Sun Apr 09, 2006 9:26 am
Cash on hand: 0.00
Location: Madison, WI


Return to IntegraMOD 140

Who is online

Registered users: App360MonitorBot, Bing [Bot], Google [Bot], Paulmagall