I wonder that how can I be sure what's making this CPU load. Which part of site or which code, function? Php or MySQL?
I heard some debug tool, benchmark tests.
Is there a way to know whats going on in the code?
What tool (script) do you recommend?
I tried PhpED Debug Profiler tool and it tells this database connection is takes most of execution times:
$connection = @mysql_connect($dbhost, $dbuser, $dbpass)
or die ("Can not connect to database");
$db = @mysql_select_db($dbname, $connection)
or die ("Can not select database.");
I use this database connection on config.inc file. On my site outgoing links open in a new window and every link has a frame to count hits, commenting and voting. So every click makes a database connection to UPDATE hit value.
I think this can make that CPU load problem.
Is there any difference between using mysql_connect and mysql_pconnect?
Maybe I must use file based counting system which I dont prefer. What do you think?
I dont understand how can 3000 visitors make that problem. Also in Cpanel I see %2 or %3 cpu load but it has a red sign. Shared hostings say they allow "10%-20%" CPU usage. So what's wrong on my condition?
Please help me to get rid off this problem. I tried 3 hosting provider and same problem comes up. Do I need a dedicated host for this site ? (!!!)