Contact Activity November 13, 2008 9:17 AM   Subscribe

I just noticed a little AJAXified link on the sidebar to show Contact Activity. Is this something new, or am I tripping?
posted by dunkadunc to MetaFilter-Related at 9:17 AM (28 comments total) 1 user marked this as a favorite

It's 15 minutes ago new.
posted by jessamyn (staff) at 9:17 AM on November 13, 2008


We just made live a little page-load-relief code to load the contact activity (which is a sometimes massive query) apart from the main load of the front page, yeah.

You may also be high, though.
posted by cortex (staff) at 9:18 AM on November 13, 2008


The front page is super fast now, since that sidebar thing used to hang the front page for about 30 seconds during the heavy traffic times, but yeah, it kinda loads over on the right in a ajax fashion (so it can take up to 30 seconds if need be, but you can still read the rest of the front page while it loads).
posted by mathowie (staff) at 9:22 AM on November 13, 2008


Thanks Greg, try it again I think I fixed up the problem.
posted by pb (staff) at 9:33 AM on November 13, 2008


Pretty neat, although I dispute the claim that the front page is super fast now. But perhaps the blame for that can be laid my computer or firewall.
posted by DU at 10:13 AM on November 13, 2008


This has given me a Simon Le Bon.
posted by Jofus at 10:18 AM on November 13, 2008


Thanks for all the enhancing enhancement stuff you do guys.
posted by netbros at 10:19 AM on November 13, 2008


very nice! pb, do you do any cacheing on the recent activity? I'm surprised to see it take 3-6 seconds longer than the rest of the page, especially with my small number of contacts.
posted by boo_radley at 10:19 AM on November 13, 2008


boo_radley, no there's no caching—that's definitely part of the problem. The query is a massive join across almost a dozen tables and it's always assembled in real time. The problem is that our built-in CF memory cache can only hold so many queries, and these user activity queries are unique to each user. This is probably way more than you wanted to know, but yeah I'm thinking that a disk cache or even db cache that's reset on activity (or on first visit of the session + every 15 minutes) might be another way to handle this. This feels like a partial fix to me, I think we'll need to revisit this again soon.
posted by pb (staff) at 10:32 AM on November 13, 2008 [1 favorite]


Thank you for this. Waiting for the front page to load was getting maddening.
posted by middleclasstool at 10:41 AM on November 13, 2008


Which now strikes me as a negative way of saying what I wanted to say, which was thank you and you guys are awesome.
posted by middleclasstool at 10:43 AM on November 13, 2008


Owww, the little spin-y thing goes round and round!

Can't you add an index to the database if the underlying query takes forever?
posted by orthogonality at 11:01 AM on November 13, 2008


pb writes "The query is a massive join across almost a dozen tables and it's always assembled in real time."

Yeah, don't do that. Assembled in real time means the database can't cache the result set or even the query plan.

Unless you're using a group by, write a view that exposes a user_id, then use a prepared statement with the user_id parametrized.
posted by orthogonality at 11:07 AM on November 13, 2008


Yeah, the tables are already indexed like mad.
posted by pb (staff) at 11:07 AM on November 13, 2008


Unfortunately we also modify the query for each user based on their filter prefs (the series of checkboxes on the contact activity page). Which means it isn't conducive to being a stored procedure or view.
posted by pb (staff) at 11:09 AM on November 13, 2008


Just wondering: jessamyn, finally caught the Father Ted bug?
posted by goodnewsfortheinsane at 11:27 AM on November 13, 2008


why not just tie together the applicable rss feeds and embed those in that magic box?
posted by blue_beetle at 11:31 AM on November 13, 2008


pb writes "Unfortunately we also modify the query for each user based on their filter prefs (the series of checkboxes on the contact activity page). Which means it isn't conducive to being a stored procedure or view."

Two things: 1) the majority of user probably, like me, haven't changed the default prefs, so you can optimize for the most case. 2) for anyone else, join to the table holding the prefs, either with a construct like ...'union select whatever from other_activity join user_contacts join user_prefs where user_id = xxx and other_pref = true'.
posted by orthogonality at 11:36 AM on November 13, 2008


Great advice ortho, I'll give those a shot.
posted by pb (staff) at 4:28 PM on November 13, 2008


jessamyn, finally caught the Father Ted bug?

No idea what you're talking about, my dad's name is Tom.
posted by jessamyn (staff) at 4:32 PM on November 13, 2008


Too bad. I was thinking of this (because of the deletion reason).
posted by goodnewsfortheinsane at 5:23 PM on November 13, 2008


Careful now!
posted by TwoWordReview at 11:06 PM on November 13, 2008 [2 favorites]


Thanks again for the help orthogonality. The query is so much better as a stored procedure that I just included it in the page as it was before.
posted by pb (staff) at 2:21 PM on November 14, 2008


Hooray!
posted by jessamyn (staff) at 6:17 AM on November 15, 2008


Wait, you took my spinny thing away? GIVE IT BACK YOU BASTARD I LIKE IT.
posted by middleclasstool at 10:57 AM on November 16, 2008


Also, if you depolarize the forward manifold, then invert the tachyon stream on the secondary shunt valve, you might get a couple of more percent out of the query engines; just watch your snark-occlusion filter, they tend to get jammed open when the queries are running hot like that. But in general you can fix those cases by increasing the hug-density, but only if you can get a complete encompassment with the hug-arms in a lateral alignment.
posted by blue_beetle at 12:58 PM on November 16, 2008


Remember, websites is serious bidness.
posted by blue_beetle at 12:59 PM on November 16, 2008


middleclasstool, anytime you need a fix go here. (Here if you use the plain theme.)
posted by pb (staff) at 9:59 AM on November 17, 2008 [1 favorite]


« Older How to cook a pony.   |   Who has the most favorited comment? Newer »

You are not logged in, either login or create an account to post comments