Wednesday, January 25, 2012

Site Optimization and the Law of Diminishing Returns

If you have reading my blog, site optimization has always been apart of my development.  Techniques like rewriting slow sql queries and in memory caching will boost the performance of your site and reduce the need of purchasing more hardware. 

Currently myVidster's growth is at 16% (Source: Google Analytics).  While this is great, I have to activity monitor the site to ensure that performance stays optimal.  Most pages like the homepage, video bookmark and user profile will load within a second even during peak traffic.  Performance starts to take a hit when viewing a collection homepage and user subscription page when the video bookmark count are in the 1k+ range.  In this case performance is reduce to 2-4 seconds.

In response I have spent the last few weeks combing though my code and doing some house keeping cleaning up my code and updating sql queries.  In the end I was only able to increase performance by 500-1000ms.  On the bright side I did reduce the memory consumption of my PHP processes :).

Now we enter the Law of Diminishing Returns.  Do I spend more time trying to optimize my code or do I upgrade or add new hardware?  I know I can only do so much optimization before I get to the point that the benefits no longer justify the time I am spending (time is money).  You also have side affects where an update intended for optimization breaks or limits site's functionality.

With that said, I will most likely add a new server to handle myVidster's growth.  I being a geek always enjoy adding a new server to the family.  Well that is all for now, take care and keep collecting!

Saturday, January 21, 2012

New Feature: Subscription Viewer

Yo dawg, I herd you like viewing your video subscriptions, so I put an subscription viewer in your chat bar so you can view your subscriptions while you watch videos.
I hope I got that meme right :).  As stated in the meme (or lack of), you can now view your subscriptions while you navigate myVidster!  Before I started developing this feature I had set 3 goals.  The viewer needed to have a simple user interface, fast loading and non obtrusive. Here is a summary of how I accomplished these goals.

User Interface:
The viewer looks a lot like the existing subscription page, but with fewer features (you cannot search/display videos by user).  Users are given the option to naviagate though their subscriptions by clicking the prev and next buttons.  The state of the viewer (what page its on) is maintain while the user navigates the site.  To notify the user of new videos collected by those they follow, the existing video bookmarks in the viewer will fade out and the new video bookmarks will fade in.

Fast Loading:
Smart caching is used to speed up load times and when the data needs refreshing the data is pulled from mysql memory tables.  Other features like minify html/js/css are also used to minimize the 'payload' sent to the user's web browser.

Non Obtrusive:
By default the viewer will remain open and auto refresh is enabled.  While I feel these features are great I know some users would prefer not to use them.  I can see this being the case with users with low resolution monitors (especially older laptops) where the viewer is taking up too much space.  With that in mind, users can disable the keep open and auto refresh feature.

I hope you will enjoy this new feature as much as I enjoyed coding it :).  That is all for now and keep collecting!

Sunday, January 1, 2012

A geeky explanation on myVidster's growth

It's time to start the new year by geeking out!  December was a great month in terms of growth.  To give you an idea of myVidster's growth rate I ran a few queries for video bookmarking.

Video bookmarks for the last 3 months.
Oct: 300,460
Nov: 308,709
Dec: 357,149

Now lets take the daily average for December which gives us 11,520 video bookmarks a day!  We also have over 163,000 registered users.

To manage our growing community and to keep the site running smoothy I have added another server to the family :).  Currently myVidster operates on 4 servers, now lets break down what each server is doing.

Server1: Web Server
Server2: Database
Server3: Chat/Messaging
Server4: Search

The servers do other important tasks, but the ones listed above are their primary tasks.  I have also been hard at work with code optimization for the search, chat/messaging and database services.  I will like a make a side note that chat/messaging performance has been improve greatly, so please message away!

Well that is it for now, take care and keep collecting!