GitHub User: HurricaneJames
I didn't see your comment before I posted mine. I don't remember everything I did, but counter_cache was probably the single biggest improvement. I also recall using memcached for storing certain results.
That said, I was doing some pretty unnecessary tag stuff. It was possible to create queries of tags with logical and, or, and not operators. Features that ultimately went mostly unused.
I implemented my own tagging system similar to the code you wrote a while back, but I noticed that it did not scale well. If you only have a few tags it works fine, but if you have hundreds of thousands or millions and similar numbers of articles then performance degrades substantially. I ended up having to do quite a bit of caching to get acceptable performance, especially for the tag cloud.
I did not use, or know about, the acts_as_taggable_on gem at the time. Does anybody know how well it scales? If not I will definitely be running some performance tests on it this week.