Revenue Source

Welcome to the Revenue Source affiliate marketing forums.

You are viewing our internet marketing and SEO forums as a guest which gives you limited access to most of our discussions.  By joining our free community, you will have access to post affiliate marketing topics, communicate privately with other members (PM), exchange SEO strategies, and access many other special features.  Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems, please don't hesitate to contact us.

Go Back   Revenue Source > Site Design & Development > Databases
Reload this Page Using flow control functions for performance monitoring
Tags: , , , , ,

Reply
 
LinkBack Thread Tools Search this Thread
Old
  (#1 (permalink))
Affiliate Blogs is Offline
Revenue Source Veteran
Affiliate Blogs has a brilliant future here!
 
Affiliate Blogs's Avatar
 
Join Date: Oct 2005
Posts: 9,144
Jack of All Trades
CyberSpace United States
   
Using flow control functions for performance monitoring - 05-24-2008

I'm not big fan on flow control functions like IF or CASE used in MySQL Queries as they are often abused used to create queries which are poorly readable as well as can hardly be optimized well by MySQL Optimizer.
One way I find IF statement very useful is computing multiple aggregates over different set of rows in the single query sweep.
Here is how I like to use it for web site performance analyzes. As you can see in this table we have recorded "wtime" which is wallclock time it took to generate the page. We also track types of pages because they often have different performance profile.
PLAIN TEXT
SQL:
  1. [FONT='Courier New', Courier, monospace]mysql> SELECT count(*) cnt, avg(wtime) avw, sum(IF(wtime>0.3,1,0))/count(*) soso, sum(IF(wtime>1,1,0))/count(*) poor, sum(IF(wtime>5,1,0))/count(*) fatal FROM performance_log_080523;[/font]
  2. [FONT='Courier New', Courier, monospace]+---------+------------------+--------+--------+--------+[/font]
  3. [FONT='Courier New', Courier, monospace]| cnt | avw | soso | poor | fatal |[/font]
  4. [FONT='Courier New', Courier, monospace]+---------+------------------+--------+--------+--------+[/font]
  5. [FONT='Courier New', Courier, monospace]| 4412134 | 0.18669403011609 | 0.1280 | 0.0396 | 0.0017 |[/font]
  6. [FONT='Courier New', Courier, monospace]+---------+------------------+--------+--------+--------+[/font]
  7. [FONT='Courier New', Courier, monospace]1 row IN SET (7.51 sec) [/font]



This query scans through page generation log for some site and reports number of requests, average request time as well as classifies requests to multiple classes. From the same query we can see portion of requests which were over 300ms (12.8%) - so we call them "so so" as we set 300ms or less as performance goal for the web site. 4% of these requests get ranking "poor" being over 1 seconds and 0.1% of requests get "fatal" classification because we assume user will not wait over 5 seconds and will already go away.
On the side note I should say the average time is least usable because average does not tell you a lot. It is much better set performance goals for high percentage portion such as - 95% or 99% and see what fraction of requests matches this goal.
In this example if our 95% goal would be 1 seconds we would pass but for 95% 0.3 second response time we would fail, same as 99% requests served within 1 second.
Here is another example:
PLAIN TEXT
SQL:
  1. [FONT='Courier New', Courier, monospace]mysql> SELECT count(*) cnt, avg(wtime) avw, sum(IF(wtime>0.3,1,0))/count(*) soso, sum(IF(wtime>1,1,0))/count(*) poor, sum(IF(wtime>5,1,0))/count(*) fatal,page_type FROM performance_log_080523 WHERE bot='google' GROUP BY page_type;[/font]
  2. [FONT='Courier New', Courier, monospace]+-------+-------------------+--------+--------+--------+---------------+[/font]
  3. [FONT='Courier New', Courier, monospace]| cnt | avw | soso | poor | fatal | page_type |[/font]
  4. [FONT='Courier New', Courier, monospace]+-------+-------------------+--------+--------+--------+---------------+[/font]
  5. [FONT='Courier New', Courier, monospace]| 21954 | 0.36869757085721 | 0.4373 | 0.0545 | 0.0008 | search |[/font]
  6. [FONT='Courier New', Courier, monospace]| 25843 | 1.1290003426468 | 0.9114 | 0.4267 | 0.0081 | profile |[/font]
  7. [FONT='Courier New', Courier, monospace]...[/font]
  8. [FONT='Courier New', Courier, monospace]| 4393 | 0.63011296296095 | 0.5852 | 0.1689 | 0.0052 | rss |[/font]
  9. [FONT='Courier New', Courier, monospace]+-------+-------------------+--------+--------+--------+---------------+[/font]
  10. [FONT='Courier New', Courier, monospace]15 rows IN SET (5.87 sec) [/font]



In this example I hid some rows to obfuscate some date
In this query we're looking at response time for different pages and we can find "search" page responds within 1 second in about 95% while profile page in less than 60% - It is very important to do such grouping by user functions because otherwise you will not catch important but may be less used functions performance problems.
Another thing you may notice I look for performance stats not for all pages but just for pages retrieved by Google crawler. In many cases this is worth looking at (may be for all search bots rather than just google) because bots have very different site access pattern. In many cases your human visitors will visit relatively few hot pages, which will use content from the cache (or be served from the cache all together). Bots however tend to visit distinct pages which tends to have significantly lower cache hit rate.
Entry posted by peter | No comment
Add to: | | | |


Using flow control functions for performance monitoring - Read More...
  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: Using flow control functions for performance monitoring
Thread Thread Starter Forum Replies Last Post
AdBoards – the undiscovered goldmine of visitor flow trenkts Marketing Requests / Traffic Trades 0 02-19-2008 08:15 AM
Community News: eZ Publish 4.0.0 & eZ Flow 1.0 Released Affiliate Blogs Programming Help 0 12-04-2007 04:19 PM
Nick Halstead's Blog: Bad code, bad data flow, good idea? Affiliate Blogs Programming Help 0 05-15-2007 02:38 PM
New Merchant 13003 - 1-800 MY CASH FLOW, LLC - Real Estate Affiliate Program Affiliate Marketing News New Shareasale Merchants 0 05-08-2007 04:28 PM



© 2004-6 RevenueSource.com.  All rights reserved.  Do not duplicate or redistribute in any form.
This website and its logos/design are property of RevenueSource.com.  All rights reserved. vBSEO 3.2.0 RC7


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34