[wp-hackers] MySQL HEAP Persistent Object Cache

David Chait davebytes at comcast.net
Thu Apr 19 06:34:37 GMT 2007


How much will the shared hosting administrators hate you (us?) for 
implementing something that tries to take advantage of something shared 
hosters should be able to do? ;)

I'd be interested to find out if there's a way to run a MySQL command 
set that will test/verify whether this will work on a given shared host, 
and whether it is worth it (i.e., do they actually allocate enough ram 
to mysql to make it useful).

-d

Robert Deaton wrote:
> After much discussion with Andy and tossing ideas back and forth, I
> finally sat down for two hours tonight and threw this together.
>
> Here's the brief rundown, as I am fading quickly and have class in the 
> morning.
>
> This uses a special MySQL engine that stores the information in RAM,
> which is much faster than storing to disk, which is what the default
> object cache does. In theory, this object cache should be faster,
> that's what I'd like you to help me find out :). This is intended to
> help shared hosts once it is in a more final stage. There are a few
> features I would still like to add.
>
> To use it, download the file, make sure it is named "object-cache.php"
> and stick it in your wp-contents/ directory.
>
> Next, using the MySQL console, PHPmyAdmin, or whatever else, issue the
> following query:
> CREATE TABLE trunk_memcache (hash CHAR(32), num TINYINT, expires INT,
> a CHAR(255) NOT NULL default '', b CHAR(255) NOT NULL default '', c
> CHAR(255) NOT NULL default '', d CHAR(255) NOT NULL default '', INDEX
> USING BTREE (hash,num), INDEX USING BTREE(expires)) ENGINE = MEMORY;
>
> Then, open up your wp-config.php file, and insert the following line
> somewhere before the require_once:
> define('ENABLE_CACHE', true);
>
> Useful data includes any change in load time from no cache or from the
> default file-based object cache (rename your
> wp-content/object-cache.php to enable the old object cache, always
> make sure its actually writing to disk before sending in any
> benchmarks).
>
> Questions are welcome, both technical and non-technical. Any
> benchmarks, either numeric or subjective, are welcome (I'd prefer the
> numeric kind, of course). Enjoy.
>
> [The file may be attached to this mail, if not, there is a text
> version online. http://lushlab.com/plugins/mysql_heap_object_cache/ ]
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>   



More information about the wp-hackers mailing list