LGF

more options

  

Advertisement

  

Link address:
Link title:
Description: 
Remaining:

Tech Note: Live Comments, 2

Sci/Tech | Sat, Nov 29, 2008 at 2:58:09 pm PST

I had to take down the front page live comment updates for a couple of days to figure out why MySQL was deadlocking. We all know how painful that can be.

Turns out that MyISAM tables suffer from an obscure problem related to concurrent reads and writes, that’s exacerbated when the SELECT query uses a GROUP BY clause. The comments at LGF need to be stored in MyISAM tables in order to allow the use of FULLTEXT indexing, which greatly helps with searching. But the Ajax DB query that periodically checked for new comments in each front page thread was causing that deadlock condition.

The solution was to use a separate table in InnoDB format (which doesn’t have the concurrent deadlocking problem) that is updated every time a comment is posted, with just the info needed to display the live comments on the front page. This ends up being much faster as well, which is a good thing since the code runs in every logged-in browser, every 15 seconds. It’s been running for over an hour with no sign of deadlocking, so I’m prepared to pronounce the bug dead.

If that made no sense to you, worry not. Hey, look! An open thread!

430 comments

^ back to top ^

log in
Name:
Pass:

Register (closed) Forgot Your Password? My Account Re-send Confirmation (To log in, cookies must be enabled in your browser!)

► LGF Headlines

► Top 10 Comments

► Bottom Comments

► Recent Comments

► Tools/Info

► LGF Hits

► Slideshows

► Resources

► Never Forget

► Statistics

► Tag Cloud

► Contact

You must have Javascript enabled to use the contact form.
Your email:

Subject:

Message:


Messages may be published in our weblog, unless you request otherwise.
Tech Note:
Using the Contact Form

► News/Opinion

► Blogs

Chunks of funk.

Vote for LGF!
weblog awards