I recently installed a new server with:
- debian squeeze
- apache2
- php5.3.3-7
- sqlite
When migrating my application from an older server I observed that it runs much slower. I isolated the problem, sqlite updates runs more than 10 times slower.
Both sqlite are version 2.8.17, the older server runs PHP Version 5.2.6-1+lenny3 Here is the benchmark script I used:
function write($value) {
$dbh = sqlite_open('mt.sq');
$sql = "REPLACE INTO hash (key,value,lm) VALUES ('test','$value','dummy')";
sqlite_query($dbh, $sql);
$dbh = sqlite_close($dbh);
}
$n = 100;
$start = microtime(true);
for($i=0;$i<$n;$i++) write($i);
$avg = (microtime(true) - $start) / $n;
echo "Average write time: ".$avg."[s]";
New Server Results: Average write time: 0.0795[s]
Old Server Results: Average write time: 0.0032[s]
Here is the database for testing:
BEGIN TRANSACTION;
CREATE TABLE hash(
key PRIMARY KEY,
value,
lm
);
INSERT INTO hash VALUES('test',99,'dummy');
COMMIT;
I dont know where to search. Does anyone observe same performance problems?
Any help will be much appreciated.
/dev/md2 /var ext3 defaults 0 2and the one of the new one:/dev/md2 /var ext4 defaults,relatime 0 2