[MODDB] Cache Guests Pages

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
User avatar
balboag
Registered User
Posts: 76
Joined: Wed Jul 13, 2011 3:52 pm
Location: Galicia, Spain
Name: Gerardo

Re: [RC] Cache Guests Pages

Post by balboag » Fri Mar 08, 2013 10:32 pm

Hi, sorry my ignorance, but what about caching pages for registered users?

User avatar
Kot Matroskin
Registered User
Posts: 126
Joined: Sat May 29, 2010 9:44 am
Location: Minsk, Belarus
Name: Vitaly Filatenko
Contact:

Re: [RC] Cache Guests Pages

Post by Kot Matroskin » Fri Mar 08, 2013 10:43 pm

It is not so easy to be done fast, without big effort from my side. Different forum roles, different accessibility, topics tracking information at the least...

I'll wait for next phpBB release with ajax, hope it will be easy to operate with forum content.

User avatar
Kot Matroskin
Registered User
Posts: 126
Joined: Sat May 29, 2010 9:44 am
Location: Minsk, Belarus
Name: Vitaly Filatenko
Contact:

Re: [RC] Cache Guests Pages

Post by Kot Matroskin » Tue Mar 12, 2013 9:13 pm

Version 1.1.1 has been released. Latest update:

Bugfix: file cache cleanup doesn't work if the mod uses different cache type than system (forum) cache

User avatar
heredia21
Registered User
Posts: 942
Joined: Sun Apr 18, 2010 6:14 pm
Contact:

Re: [RC] Cache Guests Pages

Post by heredia21 » Sat Mar 16, 2013 5:27 pm

Seems like an interesting mod. Anyone test this?
Best BlackBerry website for all users! BlackBerry News - http://blackberryempire.com

User avatar
Kot Matroskin
Registered User
Posts: 126
Joined: Sat May 29, 2010 9:44 am
Location: Minsk, Belarus
Name: Vitaly Filatenko
Contact:

Re: [RC] Cache Guests Pages

Post by Kot Matroskin » Sat Mar 16, 2013 6:04 pm

Yes.

Peter77sx
Registered User
Posts: 3257
Joined: Wed Nov 09, 2005 2:51 pm

Re: [RC] Cache Guests Pages

Post by Peter77sx » Sat Mar 16, 2013 7:56 pm

What happened to the extra debug stats this MOD had originally, is there a way to enable this again?

Thanks

User avatar
Kot Matroskin
Registered User
Posts: 126
Joined: Sat May 29, 2010 9:44 am
Location: Minsk, Belarus
Name: Vitaly Filatenko
Contact:

Re: [RC] Cache Guests Pages

Post by Kot Matroskin » Sat Mar 16, 2013 8:39 pm

Peter77sx wrote:What happened to the extra debug stats this MOD had originally, is there a way to enable this again?
It looks like your browser returns locally cached instance of the page, that is why you don't see additional timing. So I'd advise you try to use Ctrl+F5 for page refreshing, to force getting cached page from server, not from local browser cache.

This behavior is a result of latest changes. It should slightly improve the performance, but results of caching are not so obviously. :)

Peter77sx
Registered User
Posts: 3257
Joined: Wed Nov 09, 2005 2:51 pm

Re: [RC] Cache Guests Pages

Post by Peter77sx » Sat Mar 16, 2013 11:07 pm

Okay thank you I got that sorted out :)


Have you tested this with some navigation?get=value in portal.php? I ask because I use a cms that uses page?get=value and it doesn't easily update for guest nor let me navigate within. I keep getting fetched the same page even if the link parameter changes. viewtopic, index and viewforum work just fine.

User avatar
Kot Matroskin
Registered User
Posts: 126
Joined: Sat May 29, 2010 9:44 am
Location: Minsk, Belarus
Name: Vitaly Filatenko
Contact:

Re: [RC] Cache Guests Pages

Post by Kot Matroskin » Sun Mar 17, 2013 8:04 am

Sorry, I can't imagine what did you meant by "navigation?get=value in portal.php". I didn't find any mention about "navigation" word within portal.php, also there are no any request_var() calls within.

Haravikk
Registered User
Posts: 261
Joined: Sat Nov 02, 2002 4:42 pm

Re: [RC] Cache Guests Pages

Post by Haravikk » Sun Mar 17, 2013 9:49 am

Okay, so I've been using your mod for a while now and I've noticed one slight issue on bigger sites; memory usage.

Since the mod currently uses the regular phpBB file-cache the entire contents of the cached page are loaded into memory before anything is done with them, which can cause possible memory issues even though the pages exit relatively quickly.

I know that the basic file cache is by far the easiest way to handle this, I'm wondering if the mod might function better if it cached files in a manner more like how phpBB stores cached templates; i.e - as a PHP file in the format:

Code: Select all

<?php if (!defined('IN_PHPBB')) exit; ?>
<html>
    <head>
...
This eliminates the need to load anything into memory as PHP instead just spits the contents out into the output buffer when you include the file, which should have a lower overall overhead.

If that's too complex, then you may want to try to rearrange the code to ensure that the echo $cache_item; occurs as early as possible (you can use an output buffer to safely do it before headers are set), as this allows you to unset $cache_item sooner and save on memory a little. Using an included file is probably still better overall, but it may help.

It's an issue with the phpBB file cache not being the most efficient; even some of the commonly used cache files like data_globals.php isn't the most memory-friendly; I don't understand why that wasn't just an includable PHP file as well, but that's just how it is :)


Anyway, the memory issue is mostly only going to affect a site that has a high volume of guest traffic, but a low volume of repeat page-views, i.e - guest users that aren't pulling pages from their local cache.

User avatar
Kot Matroskin
Registered User
Posts: 126
Joined: Sat May 29, 2010 9:44 am
Location: Minsk, Belarus
Name: Vitaly Filatenko
Contact:

Re: [RC] Cache Guests Pages

Post by Kot Matroskin » Sun Mar 17, 2013 10:51 am

Can you prove memory issues by any numbers? I'm not sure that it should be an issue, because usual page load uses the same memory amount, or even more (my mod do not need to initialize much additional variables, just html page content).

Lets imagine what is happened with memory when page loaded without my mod.

Initialized much variables. Memory increased.
page_footer() creates page content, writes it to output buffer. It is $template->display('body'); call. Memory increased.

In case of my mod page displayed with the following way:

No need to initialize much variables;
CGP::display_if_cached() loads page content from cache, writes it to output buffer. Memory increased. The same as usual page page_footer() does.

And I'm not sure that I need to perform unset($cache_item) immediately after echo $cache_item;. As you can see there is garbage_collection(); after couple of lines below. I see no benefit on extra early unset($cache_item).


I can see two potential causes of increased memory using.

Case 1 (doubtful):
it is instruction to save page content within CGP::cache_content_page():

Code: Select all

			// cache page content
			$cache_item = ob_get_contents();
			
			$expires = $cache_ext->put($cache_key, $cache_item, $cache_ttl * 60);
Immediately after that the method is ended, ever the script is finished, because this method usually calls at the end of page_footer(). So, I see no benefit in using unset(), or ever in rewriting this code to the following:

Code: Select all

			// cache page content
			$expires = $cache_ext->put($cache_key, ob_get_contents(), $cache_ttl * 60);
But I'll do it in next release, I think.

Case 2:
Are you sure that you use file cache for my mod? If you're using any kink of memory cache, and do not force using file cache (see mod settings), it can cause significant memory usage.

User avatar
Kot Matroskin
Registered User
Posts: 126
Joined: Sat May 29, 2010 9:44 am
Location: Minsk, Belarus
Name: Vitaly Filatenko
Contact:

Re: [RC] Cache Guests Pages

Post by Kot Matroskin » Mon May 20, 2013 2:36 pm

The mod has been successfully validated recently. So, this topic will be closed, all support will be provided in corresponded section. Thanks all for testing!

Locked

Return to “[3.0.x] MODs in Development”

cron