How to test PHP and MySql performance

Discussion in 'PHP' started by ernest1a, Feb 19, 2010.

  1. #1
    Do you know for any script which tests PHP and Mysql performance or if possible also memory consuming?

    Thank you
     
    ernest1a, Feb 19, 2010 IP
  2. systematical

    systematical Peon

    Messages:
    81
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Your options are limited within PHP. Your best bet is to use mysqls tools. You can test query execution time by doing something like this:

    
    $s = microtime(true);
    $sql = "SELECT * FROM table";
    $result = mysql_query($sql);
    $e = microtime(true);
    
    $t = $e - $s;
    
    Code (markup):
    The variable "$t" would tell you how long the execution took. I actually implement something similiar to this in my core database logic and log any query that takes longer than 5 seconds to execute.
     
    systematical, Feb 19, 2010 IP