Front page could be faster

Bug #636151 reported by Jeroen T. Vermeulen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Low
Unassigned

Bug Description

I'm having a look at the performance of the front page. It just took 5,331ms to render, 4,556 of which was "SQL time." (It probably got faster once memcached was primed for my personal fragments).

Almost all of the time went into counting branches ("WHERE private = %s"—I assume %s is false; 2,005ms) and orphaned specifications (1,770ms).

The database can service the public-branches count in half a second once warmed up. (I'm not sure if we really need the branch count to exclude branches not visible to the user. Does that make sense for a global count?) In any case, there's probably no need for the global branch count to update interactively. We can get old but otherwise accurate numbers of public branches instantly from the postgres statistics.

The orphaned-specifications list went down to about 100ms on a warm database. Perhaps this information should be cached more aggressively in memcached. There doesn't seem to be anything personal about the information, so this may just be a matter of moving it from a personally-cached page fragment to a smaller, publicly-cached one.

Then, a lot of database queries for the featured-project listing could be avoided by prejoining Product, Product.icon (LibraryFileAlias), Product.icon.content (LibraryFileContent), and the licensing information (by rendering ProductWithLicenses objects instead of Product objects—see the ProductWithLicenses class). It would only save about 670ms, but if the other two queries can be elided then suddenly that's a big savings.

Finally, all of this should be coming from the slave store!

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 636151] [NEW] Front page could be faster

On Sun, Sep 12, 2010 at 3:45 PM, Jeroen T. Vermeulen
<email address hidden> wrote:
> Public bug reported:
>
> I'm having a look at the performance of the front page.  It just took
> 5,331ms to render, 4,556 of which was "SQL time."  (It probably got
> faster once memcached was primed for my personal fragments).

Do you mean 'launchpad.net', or one of the site specific root pages?

> Then, a lot of database queries for the featured-project listing could
> be avoided by prejoining Product, Product.icon (LibraryFileAlias),
> Product.icon.content (LibraryFileContent), and the licensing information

LibraryFileContent should never be needed by the appserver in GET requests.

If you saw requests for Product.icon.content, you probably were
looking at lpnet; have a look at edge - it shouldn't be doing that
lookup anymore.

-Rob

affects: launchpad → launchpad-registry
Revision history for this message
Curtis Hovey (sinzui) wrote :

All project/team icons are in the library. I sent an email to the dev list a few months ago about the formatters we use for icon. I thought it was a good candidate for memcache because we know that icons change very rarely, and we could invalidate the cache when the icons change. I still have a scribbling on my whiteboard about how to generate a predictable memcache key for ObjectFormatterAPI

The private issue for bugs, and branches is moot I think. We are showing counts of objects, if the count is valuable for public objects, then I think it will also be valuable to include private objects.

Changed in launchpad-registry:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Curtis Hovey (sinzui) wrote :

I marked this low because we do not have a concrete list of action we can take that can be prioritised.

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 636151] Re: Front page could be faster

On Tue, Sep 14, 2010 at 5:48 AM, Curtis Hovey
<email address hidden> wrote:
> All project/team icons are in the library. I sent an email to the dev
> list a few months ago about the formatters we use for icon. I thought it
> was a good candidate for memcache because we know that icons change very
> rarely, and we could invalidate the cache when the icons change. I still
> have a scribbling on my whiteboard about how to generate a predictable
> memcache key for ObjectFormatterAPI

It will almost certainly take longer to query memcache than to just
linkify the icons, now that the file alias and file content stuff has
been cleaned up.

> The private issue for bugs, and branches is moot I think. We are showing
> counts of objects, if the count is valuable for public objects, then I
> think it will also be valuable to include private objects.

We don't differentiate though: As an example.
Spm, an admin, sees 123456 projects.
Fred, an anonymous user see 123423 projects.

Will Either of them notice the difference if we showed count(*) rather
than filtering on visibility?

-Rob

Revision history for this message
Curtis Hovey (sinzui) wrote :

The artefact numbers are intended to show the scale of the collections being searching. The specifics are not important.

Curtis Hovey (sinzui)
tags: added: performance tech-debt
Revision history for this message
Robert Collins (lifeless) wrote :

84 queries/external actions issued in 0.40 seconds

Changed in launchpad:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.