Tag Archives: FAQs Help and Tutorials

Javascript Widget Performance

I received the following question today from Rustin over at The Blog Frog, a cool community service for mommy bloggers:

Like MBL, we use external javascript that is referenced from the blog. If our site ever goes down, even for 2 minutes, browsers try to load the javascript and pause for 30 seconds. Publishers then get upset that we are blocking their blog and take us off. How did you get around this with MBL? How did you display real-time data (when user visits their picture immediately shows up), but decouple from the database (which I assume was necessary)?

Since we have been asked this question more times than I can count, I figured it was time to post a quick response on the blog so anyone who is interested could benefit…

Posted in Performance | Tagged , , , , , , | 2 Comments

Fast MySQL InnoDB count. Really fast

Last night I was pairing with John on a feature for an upcoming release. I wanted to count the number of rows in a table so we could run analytics and track performance. I <3 metrics, ya know?

“Tim, this is simple. Why are you writing about this?”

select count(*) from messages;

And it is simple. If this were MyISAM. See, MyISAM always stores the number of rows on the table header. So, whenever we ask “how many rows are there?”, it can just grab the count and return it. Not InnoDB.

In InnoDB (for internal reasons), the number of rows has to be counted. Every single time. One of the tables we were counting was over 1.2 million rows. On a small EC2 instance with no other queries/major processes, this takes 1 minute and 20 seconds. This is unacceptable.

Posted in tech | Tagged , , , , , , , , | 1 Comment