Convert WP Super Cache plug-in for bbPress ?
Does anyone have links or documents on how I can convert WordPress’ Super Cache plugin for use with bbPress?
Or, has it already been done?
Ipstenu (Mika Epstein)Moderator
@frooyo – Either get Donncha to explain the plugin (good luck, he’s busy) or download it for WP and study it. Honestly, I think you’re a little nuts, only because you’re picking possibly the most complicated plugin in the history of WP to convert as your first plugin
Actually, I don’t believe people have tried converting SuperCache over yet. Because everyone is under the mentality that bbPress is “already fast enough”.
I would like to take on the challenge to converting the plug-in myself. What I don’t understand is why people are giving me a hard time for attempting to create a plug-in. I’m simply trying to better the bbPress community.
As such, all I’m asking for is a little bit of assistance and that’s:
– What is the hook to perform an action immediately after a new Post/comment?
– What is the hook to perform an action immediately before rendering the frontpage?
– What is the hook to perform an action immediately before rendering a topic page?
Ipstenu (Mika Epstein)Moderator
@frooyo – Start here: http://phpxref.ftwr.co.uk/bbpress/nav.html?index.html
It has all the functions and probably the hooks as well. That’s where I start when I want to figure out what’s up. You can view the code in the pages, and click on links to explain what each function etc is. I have no idea what functions etc you’ll need. I’d personally start by boning up on WP-Super-Cache, seeing what it hooks into on WP, and then, under the assumption the WP and BB has similar structures, look for the BB version of the WP hooks.
And then I’d get a beer.
frooyo I am certain not trying to discourage you from learning more about how bbPress works and trying to create plugins – however you should be able to find those hooks easily by reading the code. That’s how I learned everything I know about bbPress, I keep the windows search window open and pointed to the bbPress folder and I search for things. Many times the hooks are in the dozen php files in the bbPress root, sometimes you have to dig much deeper into the core files. If you can’t follow the code, you need to reconsider what you are attempting to do.
I have no idea what other plugins you’ve written, modified or ported from WordPress but this is not exactly and easy conversion to start with. You need to understand what can and can’t be cached and it’s very different from WordPress.
I’ve ported a few plugins and themed bbPress and built from scratch many WordPress plugins, and to be honest I wouldn’t try and port that plugin. There are way to many unknowns to consider when caching and it’s just a lot of work.
Also, I don’t think there are enough positives to warrant the headache inducing long nights that will cause just for the insignificant amount of resources being saved since so many users are going to be logged in. Unless your forum is ranked in the top 100 of all forums on the internet, you’re not getting enough traffic to go through that kind of trouble. You’re better off upgrading your server IMHO.
“Why logged in users can’t have cached pages? (This is what I am not able to understand)”
Because when you log in your given headers with cache control = “no-cache”.
We run a varnish head and cluster on top of another farm running nginx. Having said that we’ve changed our forum index to link the login page. Meaning users must navigate to that page to log-in. This allows us to cache the front page (for a short time) on varnish.
We manually force the cache on some pages (rejecting all cookies first).
Forum content gets updated frequently, and you don’t want to cache user logged in sessions or content that changes as speedily as forums. In this I completely agree with how automatic has done it and everyone else out there should take this model as a good base.
If you want cache your best non-destructive option is memcached server.
Memcache is going to be an absolutely useless suggestion for 95%+ of bbPress users.
Most won’t have the knowledge or resources to set it up and the performance boost will be trivial, almost non-existent for a single server setup (on a shared host it won’t even be a possibility). A proper mysql cache, opcode cache, and local disk cache will come within the same single digit performance gains of memcache.
Memcache is only beneficial for multi-server systems, it’s why it was invented in the first place.
The way to cache forums properly is to cache parts of the pages and build the page based on each user on demand. This allows much more dynamic content.
Large forums usually have an additional problem with several bots crawling them at once at any given time which is why caching every single page in a page cache (like wp super cache) can be a problem. The bots will fill the cache with many one-time hits which have to be purged very soon after they are created.
I won’t pretend to know what kind of user base bbpress caters to or even what actual type of users are out there are using it but memcache is still an option, and one only the end user can determine him/herself; No matter how trivial single digit returns may be to the end user.
If MySQL is a bottleneck, then memcached can help on small sites (some pages reduce to zero queries). In those cases though people generally don’t have access to memcached.
My point exactly about access. On a single server setup you might as well give more resources to mysql, it’s much more practical. The idea is to try to eliminate the bottleneck to mysql when you have contention among many clients. You won’t likely get that in a single server setup if mysql is done right.
The memcache layer in wp/bbpress is only one step above the mysql layer and the only thing you are saving is a few cpu cycles from when it decodes the serialized data from mysql to memory. It certainly doesn’t help at all the fact that bbPress 1.0, like WP, now does a gazillion copies of an object in memory as it references data, instead of using pointers like 0.9 does – all those copies add up, you can actually time the 50% decrease in performance on each ROW when displaying the front page with 25 topics and it gets magnified with each plugin used.
Cache Type Cache Gets/sec
Array Cache 365000
APC Cache 98000
File Cache 27000
Memcached Cache (TCP/IP) 12200 <<<<====---
MySQL Query Cache (TCP/IP) 9900
MySQL Query Cache (Unix Socket) 13500 <<<<===---
Selecting from table (TCP/IP) 5100
Selecting from table (Unix Socket) 7400
Maybe someone should write an interface into the wp/bbpress memcache object manager to use APC/eaccelerator shared memory instead on single server systems. Apparently that would be significantly faster.
Where is the reference by value happening?
WP Super Cache works automatically if you use deep integration.
Would you mind describing how you we able to do the deep integration to get WP SuperCache to work with bbPress.
- You must be logged in to reply to this topic.