Brad Fitzpatrick (bradfitz) wrote in lj_dev,
Brad Fitzpatrick

Friends view optimization

I just committed a new optimization for the generation of the friends view, where the results from a previous friends page construction can aid a subsequent one, by caching the results from time to time.

Yes, we've done this in the past, but the implementation was always wrong. Changes to the approach this time around:

1) it's not required. if it won't work, it falls back quickly to old algorithm.

2) it doesn't tax the database. very simple schema, and all the real bookkeeping is done in perl (on the cheap webservers), not in the database. there's even a parameter to adjust how often cache updates happen

3) an out-of-date cache (if aforementioned parameter is set to non-zero) still helps the old algorithm. so any cache is good.

The patch is here, for those curious:

I've been testing this for a number of hours this evening, and I'm relatively convinced it works, but the friends view code is some of the trickiest/ugliest in the codebase, so I made it an option for now. If you want to enable it, visit:

Note: the optimization only affects when you're logged in and looking at your own friends view without any filters.

Happy browsing/testing!

Update: newest code live, 3 bugs squished. if your cache is corrupt/old, turn beta testing on again to clear it.... then test out for a few hours before reporting any bugs.

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded