MovableType and > 250(0) categories
Thursday, February 9th, 2006Warning: Rambling about work ahead.
I went off on MovableType’s atrocious performance while posting to Lifehacker awhile back. Turns out that one of MT’s biggest performance pain points is the huge number of possible post categories the Gawker sites (including Lifehacker) use - a number that goes well into the thousands. (Why, you ask? Well, narrow topic silos and focused category pages make for good sponsorship opportunities and highly-targeted text ads and great Google-fu, and we’re an advertising-supported business.)
Anyway, we use a plugin for MT that turns categories into “tags,” allowing you to enter categories in a del.icio.us style input box versus the clumsy category dropdown. “Go nuts with tags!” was the editorial edict. So we did, adding categories at a clip. Sadly, we were shooting ourselves in the foot. Rendering the interface with a list of hundreds of tags slowed things considerably, specifically, the “suggest a tag” Javascript on the New and Edit Entry pages. Apparently MT’s not built to handle more than 250 2500 categories per site, and we’re the first to push this limit. (Buh? 2500 is a lot more reasonable than 250. Tx Anil.) Also, apparently MT’s database interface makes what only needs to be one query for one recordset one query PER CATEGORY - thus, hundreds of queries per page request, hence the slowdown. (As a developer, can I just say - WTF, 6A? Anyway.)
Gawker’s solution was to remove the helper Javascript from the MT interface and have us enter tags cold; for me and my co-editors this was unacceptable, given how prone we are to typos and crazy variations of the same tag (”Mac,” “OS X,” “Mac OS X”, “Stuff we like,” “Things we like,” “Books”, “book,” etc.)
Fortunately for Gawker, I don’t have any access to the MT installation or template editing/creation for Lifehacker, so I was a bit handcuffed, not able to do much except complain loudly. Finally, to stop the tag mess from getting worse editorially, I wrote a Greasemonkey script which includes the static category list Javascript from afar on those pages, which is super damn fast AND gives us back the past tag helper. I’d publish that script but it’s got a little too much information about our server setup and is specific to the tags plugin, so I won’t. But you get the idea.
If we can get a category template of that Javascript include publishing every few hours and including newly-created tags (the existing one doesn’t update with new tags, boooo), life will be good.
Now back to our regularly-scheduled programming. (Ha!)