Brad Fitzpatrick (brad) wrote,
Brad Fitzpatrick

6 degrees of separation

I implemented 6 degrees of separation tonight for LiveJournal. It took all of about an hour.

It looks like I started working on it 3 years ago once because when I went to type:

$ emacs dev/

I expected to get a new file, but there was already something there! And I knew it was old code because it used the ancient LJ APIs (which no longer worked). An ls -l dev/ showed a date in Dec 2000! Crazy.

Anyway, memcache made it easy, and I've known how I'd implement it for the past 3 years apparently.... just never got back around to it.

Don't expect it on the live site anytime soon, but it'll probably get posted to lj_dev/lj_nifty for testing in a bit here.

lj@mayor:~$ time dev/ brad elims | tail -2
returning via friend-of-friend intersection with friendof-friendof
PATH: (2)brad, (1635)revjim, (438547)babycola, (714565)dorsai, (1095875)elims,

real 0m1.201s
user 0m0.540s
sys 0m0.060s

Note: That's without prefetching certain memcache objects in big requests so there are a lot of unnecessary round-trips in there still. The time will come down. I'm also not caching any subpaths yet.

Also consider it takes 0.6 seconds just to invoke Perl loading the LJ libraries. So not bad.
Tags: perl, tech

  • Ukraine

    Nobody reads my LiveJournal anymore, but thank you to everybody in Russia protesting Putin's insane war against Ukraine. (I know it's risky…

  • Happy Birthday!

    Happy 20th Birthday, LiveJournal! 🐐🎂🎉

  • hi

    Posting from the iPhone app. Maybe I'm unblocked now.

  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.