Optimizing landing pages

Posted by Oleg Shaldybin on Stack Overflow See other posts from Stack Overflow or by Oleg Shaldybin
Published on 2010-04-02T18:59:02Z Indexed on 2010/04/02 19:03 UTC
Read the original article Hit count: 165

In my current project (Rails 2.3) we have a collection of 1.2 million keywords, and each of them is associated with a landing page, which is effectively a search results page for a given keywords. Each of those pages is pretty complicated, so it can take a long time to generate (up to 2 seconds with a moderate load, even longer during traffic spikes, with current hardware). The problem is that 99.9% of visits to those pages are new visits (via search engines), so it doesn't help a lot to cache it on the first visit: it will still be slow for that visit, and the next visit could be in several weeks.

I'd really like to make those pages faster, but I don't have too many ideas on how to do it. A couple of things that come to mind:

  • build a cache for all keywords beforehand (with a very long TTL, a month or so). However, building and maintaing this cache can be a real pain, and the search results on the page might be outdated, or even no longer accessible;

  • given the volatile nature of this data, don't try to cache anything at all, and just try to scale out to keep up with traffic.

I'd really appreciate any feedback on this problem.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about scalability