[wp-hackers] Jeff Atwood on WP Overhead

Jacob Santos wordpress at santosj.name
Thu Apr 24 15:59:55 GMT 2008


Jeremy Clarke wrote:
> Jacob Santos is a genius.
>   

Sarcasm? I'm not actually, which is to say that there are far better 
developers than myself and quite a few of them are on this mailing list. 
Quite a humbling experience thinking you're awesome to finding people 
who actually are awesome.

> Also, one thing I've done and felt worked well was just caching
> arrays/objects in the options table using custom keys in my private
> plugins, like if I had a long slow query of "get all users, make sure
> they have posted recently, check if they have an avatar uploaded,
> organize them into random sets of 5" I would then just save the
> resulting array into a wp option and create another option that has a
> unixtime expiry date after which the first option will be refreshed.
> Replaces heavy strain on the db with extremely light strain and
> doesn't have any filesystem overhead. It's how WP already works for
> storing feeds fetched through magpie.
>
> Are there problems with this system? Other than the obvious semantic
> issue (they're not 'options'), is there a performance problem I'm not
> picking up on? Why not just create a 'caches' table that mimicks the
> options table and give everything a key, value and expiry? Obviously
> you'd still want to use supercache for sites that are getting tons of
> hits, but this system would work really well for everyone right out of
> the box, without fiddling with folder permissions etc.
>   

On NFS systems where the file system is separated from the web server, 
it might be quicker. However you wouldn't get the performance, like if 
you had a memory cache, APC, XCache, memcache, which will store 
variables in memory where it can be accessed far quicker than that in a 
database.

Likewise, having serialized data in a database row prevents accurate 
searching of contents. However, it probably doesn't violate it since 
what you are interested is not what is in the data, but the index to get 
the data.

There is overhead from the amount of transfer between the database and 
PHP. The smaller the amount of data, the quicker it can reach PHP. 
Likewise, it would increase the complaints about the amount of queries 
being made.

-- 

Jacob Santos

http://www.santosj.name - blog
http://funcdoc.wordpress.com - WordPress Documentation Blog/Guide Licensed under GPLv2

Also known as darkdragon and santosj on WP trac.



More information about the wp-hackers mailing list