Page views verses MySQL queries

I’ve just done a quick analysis of page views verses MySQL select queries:

  • 16.5 select queries per second
  • 7.3 page views per second

The caveat is that the page views are from Google Analytics and will be slightly under-reporting the actual page views as clients which don’t support JavaScript will not be counted. However, it is reasonable to say that we are averaging more than 2 select queries per page view.

This strikes me as quite a high number. I would like to target a ratio of 1:1 or less for selects to page views which would half the total number of SQL queries and would be a great step to increasing the performance of the site.

I think I am also going to refactor some of my code so that the cache logic is shifted out of the main application into my Python SQL methods. This will simplify the application and make it easier for me to put memcache in front of virtually every query.

PS. I also notice that the query cache hit rate is absolutely terrible! I really need to either fix this (by putting updates into a batch and doing them less frequently) or just switch the query cache off.

Leave a Reply

You must be logged in to post a comment.