Optimizing PHP<>MySQL performance
- by BarsMonster
I am trying to optimize my PHP<MySQL on this test script:
<?
for($i=0;$i<100;$i++)//Itterations count
$res.= var_dump(loadRow("select body_ru from articles where id>$i*50 limit 100"));
print_r($res);
?>
I have APC, and article table have an index on id. Also, all these queries are hitting query cache, so sole MySQL performance if great.
But when I am using ab -c 10 -t 10 to bench this scipt, I am getting:
100 itterations: ~100req/sec (~10'000 MySQL queries per second)
5 itteration: ~200req/sec
1 itteration: ~380req/sec
0 itteration: ~580req/sec
I've tried to disable persistent connections in PHP - it made it slower a bit.
So, how can I make it work faster, provided that MySQL is not limiting performance here?