1 (edited by hurry 2007-12-06 11:19)

Topic: WP Cache like Mod for PunBB which will make fully static PunBB pages

Greetings. I know PunBB is very light and fast and that's what I like the most about it. But for a shared hosting, static pages are the only way to go to survive diggs or slashdots since the maximum database connections are limited.

So my question is whether it is theoretically possible to build a WP-Cache (the famous WordPress cache plugin) like Plugin or Mod for PunBB which will make zero database query (connection) fully static html PunBB pages for the forum home page, viewforum and viewtopic pages and store them in the cache for the time we specify in the admin. I think with such a plugin, one will never have to worry about max connections for shared hosting or digg effect again and PunBB would become super super fast. Of course, it would be great if this cache should dynamically change when any of the PunBb pages is edited like it happens for the WP-Cache plugin for Wordpress at http://mnm.uib.es/gallir/wp-cache-2/ .

If so, any broad ideas how such a plugin or mod could be made, which files would need to be changed etc.? I find with WP-Cache installed, my WordPress loads a tab bit faster than even my Punbb forum.

Thanks in advance.

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

This would only be for guest users, correct?

3

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

WP-Cache works for WP logged in users also. I don't see why not for logged in users also. I recommend for logged in users also and an option to switch it off for logged in users if possible. Because if you have 100-150 logged in users on PunBB, again the Shared hosting would start giving maximum connections exceeded error. So it needs to work for logged in users also. In WP Cache, admins even have a way to remove a specific post from the Wp Cache in the admin but that may be too advanced.

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

PunBB (and indeed all forum software) relies on being dynamic more than Wordpress or any other blog software. For Wordpress, having comments refresh every hour isn't a big deal, since the main content is the posts: on the other hand, PunBB really needs posts done and shown in real time.
So yes, it would be possible to write such a mod: a mod could write files with the filename being the group ID, filename, and various parameters, for example. However, I'm not sure how useful it would be and how easy it would be to dynamically expire certain parts if they were to change.

5

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

Even in a forum, the thousands of older topics don't have much activity and are mostly forgotten by regular visitors unless they are read via search, new visitors etc. They still load many queries when visitors come in from search engines. If they are static html, then it would save so many database queries and connections. If the cache can dynamically update the topic which has changed like Wp Cache, this PunBB Cache mod would be a great boon to those who are on shared hosts.

6

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

hurry wrote:

If the cache can dynamically update the topic which has changed

Dynamically update? That's not a cache, that's how things already work. Caching the forum doesn't work. Been there, tried it, binned it.

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

hurry wrote:

Even in a forum, the thousands of older topics don't have much activity and are mostly forgotten by regular visitors unless they are read via search, new visitors etc.

Except that the example you gave with Digg would likely be an issue with one topic, not an entire forum wink

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

I have a feeling you'd be putting a whole lot of load on the server if you're saving new cached files every other second. And if it's really such a busy forum, I'd be a bit worried about file locks too.

It can be done, but I doubt it would make alot of difference.

9 (edited by hurry 2007-12-06 14:15)

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

Dynamically update? That's not a cache, that's how things already work.

WP Cache does dynamically change only the WordPress new or edited posts or comments and again adds them to the cache. I don't know how it is done but you can refer to WP Cache plugin page. Normally there are no static html pages on the forum. Each page involves database queries.

Each viewtopic or viewforum page makes many queries to the database and most shared hosts have a limit of 30 or 50 maximum simultaneous database connections. Database queries also use server RAM and CPU which is also limited on a shared host. This makes it a maximum of maybe around 100 forum high browsing visitors to suspend our shared hosting account imho. Static html pages consume only pure bandwidth and hardly any RAM and CPU. When the shared host suspends our account due to exceeding the max database connections, it becomes an issue of the while forum not just one topic. smile

10 (edited by hurry 2007-12-06 14:18)

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

I have a feeling you'd be putting a whole lot of load on the server if you're saving new cached files every other second. And if it's really such a busy forum, I'd be a bit worried about file locks too.

I don't think Wp Cache for WordPress puts any load on the blog. In fact it totally speedens up WordPress and hardly any load for the server as it makes static html pages. It caches the page not every second but when someone visits the page.

It can be done, but I doubt it would make alot of difference.

It may not make a difference for dedicated servers or for small forums but for bigger forums on shared hosting, it will save the day. Instead of 100 or 200 visitors, one can easily scale to a thousand simultaneous forum visitors on shared hosting due to minimum database queries.

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

You're missing the point. I didn't say anything about doing it automatically every second, I'm talking about when alot of users are online and posting.

12 (edited by MrMister 2007-12-06 14:25)

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

I already do something similar but on a much smaller scale.
All the information on my portal page (Top posters, User Groups, Forum statistics and so on) is cached using Cache Lite http://pear.php.net/package/Cache_Lite
VERY easy to work with, no problems with it and it's been in use for over 9 months.

If anyone wants it I can post a snipet of the code I use but you can easily find samples on the Net.
EDIT: see sample and explanation here: http://phpnuke.org/modules.php?name=PHP … -lite.html
Oh, I also use XCache for that extra hoomph wink

13

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

I'm talking about when alot of users are online and posting.

I understand. I don't think caching would load the server much. If it does, it will be easily offset by the great decrease in load after caching. Or one can switch off caching during high posting time. Basically the majority of visitors come to browse the forum. Only a small percentage will post. So the thousands of database queries from the visitors can be avoided with static html pages. Phpbb 3 has put in lot of work on caching. of course it is twice as slow as punbb.

Thanks MrMister. Can you please post the code for PunBB? I am not a programmer so I don't know how to use it for PunBB.

14

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

Just ensure something like eAccelerator, APC or Xcache are installed on your PHP setup and you will get much the same benefit as designing something akin to WP Cache for punBB, with far less hassle. All are popular and common PHP caches.

15

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

I have eAccelerator but still every forum page runs 8 or 9 queries to the database. In Wordpress, WP Cache runs in addition to eAccelerator. eAccelerator does not save the site from diggs or high volume of users. But Wp Cache has been found to do that as it generates completely static html pages which the common php caches don't normally I think.

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

8 queries is nothing. And it's still only one connection.

17

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

sirena wrote:

Just ensure something like eAccelerator, APC or Xcache are installed on your PHP setup and you will get much the same benefit as designing something akin to WP Cache for punBB, with far less hassle.

I agree, I use APC and it's great, my sites just pop and I can handle 5 times the number of users.

You honestly have to decide on one method, I've read cases where WP Cache had issues with PHP accelerators, as in handing out blank pages to users. Also, Wordpress has it's issues with a Digg effect, thus making their cache necessary where in PunBB's case you can handle the storm.

18

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

hurry wrote:

Dynamically update? That's not a cache, that's how things already work.

WP Cache does dynamically change only the WordPress new or edited posts or comments and again adds them to the cache.

I understand what you mean, but what I'm referring to is the fact of: how does it update the cached data? By connecting to the db and updating the cache. So in theory, you are swapping a dynamically generated page for a dynamically updated cached page. As you can guess, the difference there would be, db wise?

Caching is designed to take the load off PHP itself, not the db. If you try to achieve both, you'll end up with an outdated cache.

19

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

I think you better transfer to paid hosting so you dont have problem about the queries eating up your bandwidth. there many of them offering at low prices.

My site at Lessonko|Text Quotes at Text Paradise |Ultimate Bounds

20 (edited by hurry 2007-12-07 10:01)

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

8 queries is nothing. And it's still only one connection.

Yes, but it all builds when there are a lot of simultaneous visitors on the forum. PunBB forum pages load very fast so the visitors would browse many pages in a shorter time than other forums. So there is a chance that there may be many simultaneous database connections to the database at some point of time and that is enough for the shared host to suspend the account or for the forum to go down with errors.

you will get much the same benefit as designing something akin to WP Cache for punBB, with far less hassle.

As I pointed out above, I don't think a Php Cache gives exactly the same benefit as a fully static cache like WP Cache for example would because the forum pages will still execute queries to the database as per my knowledge. If that was the case, WordPress people would use only one of them at a time. But so many are using WP Cache in addition to a Php cache. I don't think it is a hassle to design such a MOD for PunBB. It will remove the hassles for those who want to run a higher volume PuBB forum on a shared host with that max db connections restriction.

I've read cases where WP Cache had issues with PHP accelerators, as in handing out blank pages to users.

I think this problem was only for a previous version of XCache and WP Cache. As far as I know, WP Cache has no reported problems with other PHP Caches.

Caching is designed to take the load off PHP itself, not the db. If you try to achieve both, you'll end up with an outdated cache.

I don't get you on this. WP Cache (which caches for reducing db load) works well with PHP Caches (which cache for reducing php load) and they both play very well together on the same shared hosting with an updated (not outdated) cache system when a post or comment is new or edited.

I think you better transfer to paid hosting so you dont have problem about the queries eating up your bandwidth.

I am already on a paid shared hosting and that is what we are discussing about. Please read the above replies. The queries don't eat up the bandwidth. They eat up the RAM (mostly) and CPU of the shared server. I already said that paid shared hosts have a limit of 30 to 50 simultaneous database connections which is main problem. Many have faced this problem of "maximum database connections exceeded" with PunBB too on paid shared hosting. They are many topics about it on this forum. I guess one of the main purposes and advantages of designing PunBB was to make it run smoothly on a paid shared hosting also even for a high volume and visitor forum. I think that out of all popular forum scripts only PunBB is so lightweight, that it can faciltiate a high volume forum on a paid shared hosting. And with such a full static page PunBB MOD, it would allow a few thousands of simultaneous visitors on a paid shared hosting imho. Please remember than a shared hosting is less than $10 monthly while a reasonable VPS is around $50/month  and dedicated is much more. Thanks.

21

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

Hmmm. Maybe you should perhaps have a look at Rickard's News Generator plug-in -  http://punbb.org/downloads.php - and see if you could tweak/hack it to meet some of your needs. It generates pure static HTML out of punbb forums.

22 (edited by hurry 2007-12-07 09:59)

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

Thanks Sirena. I will check that though I would'nt know what to do from it as I am not a programmer. I greatly hope that one of our PunBB geniuses on this forum decide to make such a static html cache MOD for PunBB. This PunBB forum is one of most helpful and active communities out there. smile

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

Hmm, well, permissions are the biggest issue here. Unless you only cache those pages that are viewable for guests.

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

Indeed: without a database query, how would you know what group someone is in?

25 (edited by hurry 2007-12-07 12:02)

Re: WP Cache like Mod for PunBB which will make fully static PunBB pages

Yes, the pages viewable to guests certainly need to be cached as 90% of the visitors are guests including the search bots and we want to avoid the load on db especially from their browsing. I remember now that a few times my forum went down due to multiple connections was due to this search bots whom we don't want to stop sad . For example the PunBB forum presently has:

    Registered users online: 2
    Guests online: 28

So it is the guests including bots who need to view the cached pages more than anyone else. smile Please make this MOD if you can. It will a great help for us on shared hosts.