Tuesday, September 21, 2010

Site Performance Issue Resolve

Warning, there is a lot of geek talk in this post ;)

When it comes to site performance and optimization it becomes a cat and mouse game between the developer and the growing user base. For the last 2 weeks I notice high CPU usage from the database. My first attempt to solve the problem was to enable query caching, increase the size of the temp tables, restarting the service, etc. At first it appeared that page load speed were back to normal, but after another spike in traffic myVidster's servers could not keep up. Last night during peak usage I decided to look at the queries that the database were processing. I notice several update queries in the queue and I wonder why myVidster is executing so many updates, most queries should be selects or inserts. Then I remember that I reorder all the videos in a channel when a new one was added (which requires an update to those videos)! This is not an issues when a user has a few videos, but as myVidster grows user's collections have grown to the 100s and 1000s of videos!

I change the logic so that an update is no longer needed to videos in a channel when a new video is added. Doing this drop the database's CPU usage in half and page load speed was back to normal. One a side note, I notice that users are now trying out our storage upgrade service! For those who do not know what this is, adding storage to your account will allow you to backup your videos to myVidster for safe keep and viewing. More info on our upgrade page.

2 comments:

Mharish said...

Thanks for sharing this post. I really appreciate your efforts and I will be waiting for your next write. packers and movers marathahalli bangalore

JANA GANGA said...

Good Posting...
Personality Development Programs in Chennai